6. Méthode de cryptage définie
pFan.encrypt = { //# 加密
md5 : fonction (mots) { //# md5 哈希算法
/*
* Crypto-JS 3.1.2
*
http://code.google.com/p/crypto-js
*/
var CryptoJS = fonction (s, p) {
var m = {}, l = m.lib = {}, n = function () { }, r = l.Base = { extend : function (b) { n.prototype = this ; var h = nouveau n ; b && h.mixIn(b); h.hasOwnProperty("init") || (h.init = function () { h.$super.init.apply(this, arguments) }); h.init.prototype = h; h.$super = ceci ; return h }, create: function () { var b = this.extend(); b.init.apply(b, arguments); return b }, init : function () { }, mixIn : function (b) { for (var h in b) b.hasOwnProperty(h) && (this[h] = b[h]); b.hasOwnProperty("toString") && (this.toString = b.toString) }, clone : function () { return this.init.prototype.extend(this) } }, q = l.WordArray = r.extend( { init : function (b, h) { b = this.words = b || []; this.sigBytes = h != p h : 4 * b.length }, toString : function (b) { return (b || t).stringify(this) }, concat: function (b) { var h = this.words, a = b.words, j = this.sigBytes b = b.sigBytes; (j % 4) pour (var g = 0; g < b; g ) h[j g >>> 2] |= (a[g >>> 2] >>> 24 - 8 * (g % 4) & 255) << 24 - 8 * ((j g) % 4) sinon si (65535 < a.length) pour (g = 0; g < b; g = 4) h[j g >>> 2] = a[g >> 2]; sinon h.push.apply(h, a); : function () { var b = this.words, h = this.sigBytes; b[h >> 2] &= 4294967295 << s.ceil(h / 4) }, clone : function () { var b = r.clone.call(this); b.words = this.words.slice(0); ) { pour (var h = [], a = 0; un &Lt ; b; a = 4) h.push(4294967296 * s.random() | 0); return new q.init(h, b) } }), v = m.enc = {}, t = v.Hex = { stringify: function (b) { var a = b.words; b = b.sigBytes ; pour (var g = [], j = 0; j < b; j ) { var k = a[j >>> 2] >>> 24 - 8 * (j % 4) & 255 ; g.push((k >>> 4).toString(16)); g.push((k & 15).toString(16)) } return g.join("") }, analyser : function (b) { for (var a = b.length, g = [], j = 0 ; j &Lt ; un j = 2) g[j > ;> ; 3] |= parseInt(b.substr(j, 2), 16) << 24 - 4 * (j % 8) ; return new q.init(g, a / 2) } }, a = v.Latin1 = { stringify: function (b) { var a = b.words; b = b.sigBytes ; pour (var g = [], j = 0; j < b; j ) g.push(String.fromCharCode(a[j >>> 2] >>> 24 - 8 * (j % 4) et 255)); return g.join("") }, analysez : function (b) { for (var a = b.length, g = [], j = 0; j < a; j ) g[j >>> ; 2] |= (b.charCodeAt(j) & 255) << 24 - 8 * (j % 4) ; return new q.init(g, a) } }, u = v.Utf8 = { stringify: function (b) { try { return decodeURIComponent(escape(a.stringify(b))) } catch (g) { throw Erreur ("Données UTF-8 mal formées"); } }, analyser : function (b) { return a.parse(unescape(encodeURIComponent(b))) } },
g = l.BufferedBlockAlgorithm = r.extend({ reset: function () { this._data = new q.init; this._nDataBytes = 0 }, _append: function (b) { "string" == typeof b && (b = u.parse(b)); this._data.concat(b); this._nDataBytes = b.sigBytes }, _process : function (b) { var a = this._data, g = a.words, j = a .sigBytes, k = this.blockSize, m = j / (4 * k), m = b.ceil(m) : s.max((m | 0) - this._minBufferSize, 0); * k; j = s.min(4 * b, j); si (b) { pour (var l = 0; l < b; l = k) this._doProcessBlock(g, l); splice(0, b); a.sigBytes -= j } return new q.init(l, j) }, clone : function () { var b = r.clone.call(this); _data.clone(); return b }, _minBufferSize: 0 }); l.Hasher = g.extend({ cfg : r.extend(), init : function (b) { this.cfg = this.cfg.extend(b); this.reset() }, reset : function () { g.reset.call(this); this._doReset() }, mise à jour : function (b) { this._append(b); this._process(); return this }, finalize : function (b) { b && this ._append(b); return this._doFinalize() }, blockSize : 16, _createHelper : function (b) { return function (a, g) { return (new b.init(g)).finalize(a) } } , _createHmacHelper : function (b) { return function (a, g) { return (new k.HMAC.init(b, g)).finalize(a) } } }); var k = m.algo = {}; retourne m
}(Mathématiques);
(fonction(s) {
fonction p(a, k, b, h, l, j, m) { a = a (k & b | ~k & h) l m; return (a << j | a >>> 32 - j) k } fonction m(a, k, b, h, l, j, m) { a = a (k & h | b & ~h) je m; return (a << j | a >>> 32 - j) k } fonction l(a, k, b, h, l, j, m) { a = a (k ^ b ^ h) je m; return (a << j | a >>> 32 - j) k } fonction n(a, k, b, h, l, j, m) { a = a (b ^ (k | ~ h)) je m; return (a << j | a >>> 32 - j) k } pour (var r = CryptoJS, q = r.lib, v = q.WordArray, t = q.Hasher, q = r .algo, a = [], u = 0; 64 > u ) a[u] = 4294967296 * s.abs(s.sin(u 1)) | 0 ; q = q.MD5 = t.extend({
_doReset : function () { this._hash = new v.init([1732584193, 4023233417, 2562383102, 271733878]) }, _doProcessBlock : function (g, k) {
pour (var b = 0; 16 > b; b ) { var h = k b, w = g[h]; g[h] = (w << 8 | w >>> 24) & 16711935 | (w << 24 | w >>> 8) & 4278255360 } var b = this._hash.words, h = g[k 0], w = g[k 1], j = g[k 2], q = g[k 3], r = g[k 4], s = g[k 5], t = g[k 6], u = g[k 7], v = g[k 8] , x = g[k 9], y = g[k 10], z = g[k 11], A = g[k 12], B = g[k 13], C = g[k 14], D = g[k 15], c = b[0], d = b[1], e = b[2], f = b[3], c = p(c, d, e, f, h, 7 , une[0]), f = p(f, c, ré, e, w, 12, une[1]), e = p(e, f, c, ré, j, 17, une[2]) , d = p(d, e, f, c, q, 22, a[3]), c = p(c, d, e, f, r, 7, a[4]), f = p(f , c, d, e, s, 12, a[5]), e = p(e, f, c, d, t, 17, a[6]), d = p(d, e, f, c , u, 22, a[7]), c = p(c, d, e, f, v, 7, a[8]), f = p(f, c, d, e, x, 12, a [9]), e = p(e, f, c, ré, y, 17, a[10]), d = p(d, e, f, c, z, 22, a[11]), c = p(c, d, e, f, A, 7, a[12]), f = p(f, c, d, e, B, 12, a[13]), e = p(e, f , c, d, C, 17, a[14]), d = p(d, e, f, c, D, 22, a[15]), c = m(c, d, e, f, w , 5, a[16]), f = m(f, c, d, e, t, 9, a[17]), e = m(e, f, c, d, z, 14, a[18 ]), d = m(d, e, f, c, h, 20, a[19]), c = m(c, d, e, f, s, 5, a[20]), f = m (f, c, d, e, y, 9, a[21]), e = m(e, f, c, d, D, 14, a[22]), d = m(d, e, f , c, r, 20, une[23]), c = m(c, ré, e, f, x, 5, une[24]), f = m(f, c, ré, e, C, 9 , une[25]), e = m(e, f, c, d, q, 14, une[26]), d = m(d, e, f, c, v, 20, une[27]) , c = m(c, d, e, f, B, 5, a[28]), f = m(f, c, d, e, j, 9, a[29]), e = m(e , f, c, d, u, 14, a[30]), d = m(d, e, f, c, A, 20, a[31]), c = l(c, d, e, f , s, 4, a[32]), f = l(f, c, d, e, v, 11, a[33]), e = l(e, f, c, d, z, 16, a [34]), d = l(d, e, f, c, C, 23, a[35]), c = l(c, d, e, f, w, 4, a[36]), f = l(f, c, d, e, r, 11, a[37]), e = l(e, f, c, d, u, 16, a[38]), d = l(d, e , f, c, y, 23, a[39]), c = l(c, d, e, f, B, 4, a[40]), f = l(f, c, d, e, h , 11, a[41]), e = l(e, f, c, d, q, 16, a[42]), d = l(d, e, f, c, t, 23, a[43 ]), c = l(c, d, e, f, x, 4, a[44]), f = l(f, c, d, e, A, 11, a[45]), e = l (e, f, c, d, D, 16, a[46]), d = l(d, e, f, c, j, 23, a[47]), c = n(c, d, e , f, h, 6, a[48]), f = n(f, c, d, e, u, 10, a[49]), e = n(e, f, c, d,
C, 15, a[50]), d = n(d, e, f, c, s, 21, a[51]), c = n(c, d, e, f, A, 6, a[ 52]), f = n(f, c, d, e, q, 10, a[53]), e = n(e, f, c, d, y, 15, a[54]), d = n(d, e, f, c, w, 21, a[55]), c = n(c, d, e, f, v, 6, a[56]), f = n(f, c, d, e, D, 10, a[57]), e = n(e, f, c, d, t, 15, a[58]), d = n(d, e, f, c, B, 21, une[59]), c = n(c, ré, e, f, r, 6, une[60]), f = n(f, c, ré, e, z, 10, une[61] ), e = n(e, f, c, d, j, 15, a[62]), d = n(d, e, f, c, x, 21, a[63]); b[0] = b[0] c | 0 ; b[1] = b[1] ré | 0 ; b[2] = b[2] e | 0 ; b[3] = b[3] f | 0
}, _doFinalize : function () { var a = this._data, k = a.words, b = 8 * this._nDataBytes, h = 8 * a.sigBytes ; k[h>>> 5] |= 128 ≪≪ 24 heures % 32 ; var l = s.étage(b / 4294967296); k[(h 64 >>> 9 << 4) 15] = (l << 8 | l >>> 24) & 16711935 | (l << 24 | l >>> 8) & 4278255360 ; k[(h 64 >>> 9 << 4) 14] = (b << 8 | b >>> 24) & 16711935 | (b << 24 | b >>> 8) & 4278255360 ; a.sigBytes = 4 * (k.longueur 1); this._process(); a = this._hash; k = a.mots ; pour (b = 0 ; 4 > b; b ) h = k[b], k[b] = (h << 8 | h >>> 24) & 16711935 | (h << 24 | h >>> 8) & 4278255360 ; return a }, clone : function () { var a = t.clone.call(this); a._hash = this._hash.clone(); renvoyer un }
}); r.MD5 = t._createHelper(q); r.HmacMD5 = t._createHmacHelper(q)
})(Mathématiques);
retourner CryptoJS.MD5(words).toString();
>
// sha1
, sha1 : fonction (mots) { //# sha1 哈希算法
var CryptoJS = fonction (e, m) { var p = {}, j = p.lib = {}, l = fonction () { }, f = j.Base = { étendre : fonction (a) { l.prototype = ceci; var c = nouveau l; a && c.mixIn(a); c.hasOwnProperty("init") || (c.init = function () { c.$super.init.apply(this, arguments) }); c.init.prototype = c; c.$super = ceci ; return c }, create: function () { var a = this.extend(); a.init.apply(a, arguments); return a }, init: function () { }, mixIn: function (a) { for (var c in a) a.hasOwnProperty(c) && (this[c] = a[c]); a.hasOwnProperty("toString") && (this.toString = a.toString) }, clone : function () { return this.init.prototype.extend(this) } }, n = j.WordArray = f.extend( { init : function (a, c) { a = this.words = a || []; this.sigBytes = c != m c : 4 * a.length }, toString : function (a) { return (a || h).stringify(this) }, concat: function (a) { var c = this.words, q = a.words, d = this.sigBytes; (d % 4) pour (var b = 0; b < a; b ) c[d b >>> 2] |= (q[b >>> 2] >>> 24 - 8 * (b % 4) & 255) << 24 - 8 * ((d b) % 4) sinon si (65535 < q.length) pour (b = 0; b < a; b = 4) c[d b >>> 2] = q[b >> 2]; sinon c.push.apply(c, q); : function () { var a = this.words, c = this.sigBytes; a[c >> 2] &= 4294967295 << e.ceil(c / 4) }, clone : function () { var a = f.clone.call(this); a.words = this.words.slice(0); return a }, random : function (a); ) { pour (var c = [], b = 0; b &Lt ; un; b = 4) c.push(4294967296 * e.random() | 0); return new n.init(c, a) } }), b = p.enc = {}, h = b.Hex = { stringify: function (a) { var c = a.words; a = a.sigBytes ; pour (var b = [], d = 0; d < a; d ) { var f = c[d >>> 2] >>> 24 - 8 * (d % 4) & 255 ; b.push((f >>> 4).toString(16)); b.push((f & 15).toString(16)) } return b.join("") }, analyser : function (a) { for (var c = a.length, b = [], d = 0 ; d &Lt ; c = 2) b[d > ;> ; 3] |= parseInt(a.substr(d, 2), 16) << 24 - 4 * (d% 8); return new n.init(b, c / 2) } }, g = b.Latin1 = { stringify: function (a) { var c = a.words; a = a.sigBytes ; pour (var b = [], d = 0; d < a; d ) b.push(String.fromCharCode(c[d >>> 2] >>> 24 - 8 * (d % 4) et 255)); return b.join("") }, analysez : function (a) { for (var c = a.length, b = [], d = 0; d < c; d ) b[d >>> ; 2] |= (a.charCodeAt(d) & 255) << 24 - 8 * (d% 4); return new n.init(b, c) } }, r = b.Utf8 = { stringify: function (a) { try { return decodeURIComponent(escape(g.stringify(a))) } catch (c) { throw Erreur ("Données UTF-8 mal formées"); } }, analyser : function (a) { return g.parse(unescape(encodeURIComponent(a))) } }, k = j.BufferedBlockAlgorithm = f.extend({ reset: function () { this._data = new n. init; this._nDataBytes = 0 }, _append : function (a) { "string" == typeof a && (a = r.parse(a)); this._data.concat(a); sigBytes }, _process : function (a) { var c = this._data, b = c.words, d = c.sigBytes, f = this.blockSize, h = d / (4 * f), h = a ? .ceil(h) : e.max((h | 0) - this._minBufferSize, 0); a = h * f; g = 0; g < g = f) this._doProcessBlock(b, g); g = b.splice(0, a); }, clone : function () { var a = f.clone.call(this); a._data = this._data.clone(); return a }, _minBufferSize : 0 }); j.Hasher = k.extend({ cfg : f.extend(), init : function (a) { this.cfg = this.cfg.extend(a); this.reset() }, reset : function () { k.reset.call(this); this._doReset() }, mise à jour : function (a) { this._append(a); this._process(); return this }, finalize : function (a) { a && this ._append(a); return this._doFinalize() }, blockSize : 16, _createHelper : function (a) { return function (c, b) { return (new a.init(b)).finalize(c) } } , _createHmacHelper : function (a) { return function (b, f) { return (new s.HMAC.init(a, f)).finalize(b) } } }); var s = p.algo = {}; return p }(Math);
(function () { var e = CryptoJS, m = e.lib, p = m.WordArray, j = m.Hasher, l = [], m = e.algo.SHA1 = j.extend({ _doReset : function ( ) { this._hash = new p.init([1732584193, 4023233417, 2562383102, 271733878, 3285377520]) }, _doProcessBlock : function (f, n) { for (var b = this._hash.words, h = b[0 ], g = b[1], e = b[2], k = b[3], j = b[4], a = 0 ; a a ) { si (16 > ; a) l [une] = f[n une] | 0; sinon { var c = l[une - 3] ^ l[une - 8] ^ l[une - 14] ^ l[une - 16]; ≪≪ 1 | c >> 31 } c = (h << 5 | h >> 27) j l[a]; & e | ~g & k) 1518500249) : 40 > ) : c ((g ^ e ^ k) - 899497514 ); j = k = e = g << [0] = b[0] h | 0; b[1] = b[1] g | ; b[4] = b[4] j | 0 }, _doFinalize : function () { var f = this._data, e = f.words, b = 8 * this._nDataBytes, h = 8 * f.sigBytes; e[h >>> 5] |= 128 ≪≪ 24 heures % 32 ; e[(h 64 >>> 9 << 4) 14] = Math.floor(b / 4294967296); e[(h 64 >>> 9 ≪≪ 4) 15] = b; f.sigBytes = 4 * e.longueur ; this._process(); renvoie this._hash }, clone : function () { var e = j.clone.call(this); e._hash = this._hash.clone(); retourner e } }); e.SHA1 = j._createHelper(m); e.HmacSHA1 = j._createHmacHelper(m) })();
return CryptoJS.SHA1(words).toString();
>
// time33 哈希
, time33 : function (mots) { //# time33 哈希算法
mots = mots || '';
//哈希time33算法
pour (var i = 0, len = mots.longueur, hash = 5381; i < len; i) {
hash = (hash << 5) mots.charAt(i).charCodeAt();
};
retourner le hachage & 0x7fffffff;
>
>