28 lines
9.3 KiB
JavaScript
28 lines
9.3 KiB
JavaScript
|
/*
|
||
|
CryptoJS v3.1.2
|
||
|
code.google.com/p/crypto-js
|
||
|
(c) 2009-2013 by Jeff Mott. All rights reserved.
|
||
|
code.google.com/p/crypto-js/wiki/License
|
||
|
*/
|
||
|
var CryptoJS=CryptoJS||function(a,d){var c={},b=c.lib={},f=function(){},l=b.Base={extend:function(a){f.prototype=this;var g=new f;a&&g.mixIn(a);g.hasOwnProperty("init")||(g.init=function(){g.$super.init.apply(this,arguments)});g.init.prototype=g;g.$super=this;return g},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var g in a)a.hasOwnProperty(g)&&(this[g]=a[g]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},
|
||
|
u=b.WordArray=l.extend({init:function(a,g){a=this.words=a||[];this.sigBytes=g!=d?g:4*a.length},toString:function(a){return(a||m).stringify(this)},concat:function(a){var g=this.words,c=a.words,e=this.sigBytes;a=a.sigBytes;this.clamp();if(e%4)for(var b=0;b<a;b++)g[e+b>>>2]|=(c[b>>>2]>>>24-8*(b%4)&255)<<24-8*((e+b)%4);else if(65535<c.length)for(b=0;b<a;b+=4)g[e+b>>>2]=c[b>>>2];else g.push.apply(g,c);this.sigBytes+=a;return this},clamp:function(){var C=this.words,g=this.sigBytes;C[g>>>2]&=4294967295<<
|
||
|
32-8*(g%4);C.length=a.ceil(g/4)},clone:function(){var a=l.clone.call(this);a.words=this.words.slice(0);return a},random:function(C){for(var g=[],b=0;b<C;b+=4)g.push(4294967296*a.random()|0);return new u.init(g,C)}}),k=c.enc={},m=k.Hex={stringify:function(a){var g=a.words;a=a.sigBytes;for(var b=[],e=0;e<a;e++){var c=g[e>>>2]>>>24-8*(e%4)&255;b.push((c>>>4).toString(16));b.push((c&15).toString(16))}return b.join("")},parse:function(a){for(var b=a.length,c=[],e=0;e<b;e+=2)c[e>>>3]|=parseInt(a.substr(e,
|
||
|
2),16)<<24-4*(e%8);return new u.init(c,b/2)}},x=k.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var c=[],e=0;e<a;e++)c.push(String.fromCharCode(b[e>>>2]>>>24-8*(e%4)&255));return c.join("")},parse:function(a){for(var b=a.length,c=[],e=0;e<b;e++)c[e>>>2]|=(a.charCodeAt(e)&255)<<24-8*(e%4);return new u.init(c,b)}},y=k.Utf8={stringify:function(a){try{return decodeURIComponent(escape(x.stringify(a)))}catch(b){throw Error("Malformed UTF-8 data");}},parse:function(a){return x.parse(unescape(encodeURIComponent(a)))}},
|
||
|
$=b.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new u.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=y.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(b){var c=this._data,l=c.words,e=c.sigBytes,d=this.blockSize,f=e/(4*d),f=b?a.ceil(f):a.max((f|0)-this._minBufferSize,0);b=f*d;e=a.min(4*b,e);if(b){for(var k=0;k<b;k+=d)this._doProcessBlock(l,k);k=l.splice(0,b);c.sigBytes-=e}return new u.init(k,e)},clone:function(){var a=l.clone.call(this);
|
||
|
a._data=this._data.clone();return a},_minBufferSize:0});b.Hasher=$.extend({cfg:l.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset()},reset:function(){$.reset.call(this);this._doReset()},update: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(b,c){return(new a.init(c)).finalize(b)}},_createHmacHelper:function(a){return function(b,c){return(new ia.HMAC.init(a,
|
||
|
c)).finalize(b)}}});var ia=c.algo={};return c}(Math);
|
||
|
(function(a){var d=CryptoJS,c=d.lib,b=c.Base,f=c.WordArray,d=d.x64={};d.Word=b.extend({init:function(a,b){this.high=a;this.low=b}});d.WordArray=b.extend({init:function(b,c){b=this.words=b||[];this.sigBytes=c!=a?c:8*b.length},toX32:function(){for(var a=this.words,b=a.length,c=[],d=0;d<b;d++){var x=a[d];c.push(x.high);c.push(x.low)}return f.create(c,this.sigBytes)},clone:function(){for(var a=b.clone.call(this),c=a.words=this.words.slice(0),d=c.length,f=0;f<d;f++)c[f]=c[f].clone();return a}})})();
|
||
|
(function(){function a(){return f.create.apply(f,arguments)}for(var d=CryptoJS,c=d.lib.Hasher,b=d.x64,f=b.Word,l=b.WordArray,b=d.algo,u=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),
|
||
|
a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,
|
||
|
2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),
|
||
|
a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,
|
||
|
3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],k=[],m=0;80>m;m++)k[m]=a();b=b.SHA512=c.extend({_doReset:function(){this._hash=new l.init([new f.init(1779033703,4089235720),new f.init(3144134277,2227873595),new f.init(1013904242,4271175723),new f.init(2773480762,1595750129),new f.init(1359893119,2917565137),new f.init(2600822924,725511199),new f.init(528734635,4215389547),new f.init(1541459225,327033209)])},_doProcessBlock:function(a,b){for(var c=this._hash.words,
|
||
|
d=c[0],f=c[1],g=c[2],l=c[3],e=c[4],m=c[5],L=c[6],c=c[7],Z=d.high,M=d.low,aa=f.high,N=f.low,ba=g.high,O=g.low,ca=l.high,P=l.low,da=e.high,Q=e.low,ea=m.high,R=m.low,fa=L.high,S=L.low,ga=c.high,T=c.low,r=Z,n=M,F=aa,D=N,G=ba,E=O,W=ca,H=P,s=da,p=Q,U=ea,I=R,V=fa,J=S,X=ga,K=T,t=0;80>t;t++){var z=k[t];if(16>t)var q=z.high=a[b+2*t]|0,h=z.low=a[b+2*t+1]|0;else{var q=k[t-15],h=q.high,v=q.low,q=(h>>>1|v<<31)^(h>>>8|v<<24)^h>>>7,v=(v>>>1|h<<31)^(v>>>8|h<<24)^(v>>>7|h<<25),B=k[t-2],h=B.high,j=B.low,B=(h>>>19|j<<
|
||
|
13)^(h<<3|j>>>29)^h>>>6,j=(j>>>19|h<<13)^(j<<3|h>>>29)^(j>>>6|h<<26),h=k[t-7],Y=h.high,A=k[t-16],w=A.high,A=A.low,h=v+h.low,q=q+Y+(h>>>0<v>>>0?1:0),h=h+j,q=q+B+(h>>>0<j>>>0?1:0),h=h+A,q=q+w+(h>>>0<A>>>0?1:0);z.high=q;z.low=h}var Y=s&U^~s&V,A=p&I^~p&J,z=r&F^r&G^F&G,ja=n&D^n&E^D&E,v=(r>>>28|n<<4)^(r<<30|n>>>2)^(r<<25|n>>>7),B=(n>>>28|r<<4)^(n<<30|r>>>2)^(n<<25|r>>>7),j=u[t],ka=j.high,ha=j.low,j=K+((p>>>14|s<<18)^(p>>>18|s<<14)^(p<<23|s>>>9)),w=X+((s>>>14|p<<18)^(s>>>18|p<<14)^(s<<23|p>>>9))+(j>>>0<
|
||
|
K>>>0?1:0),j=j+A,w=w+Y+(j>>>0<A>>>0?1:0),j=j+ha,w=w+ka+(j>>>0<ha>>>0?1:0),j=j+h,w=w+q+(j>>>0<h>>>0?1:0),h=B+ja,z=v+z+(h>>>0<B>>>0?1:0),X=V,K=J,V=U,J=I,U=s,I=p,p=H+j|0,s=W+w+(p>>>0<H>>>0?1:0)|0,W=G,H=E,G=F,E=D,F=r,D=n,n=j+h|0,r=w+z+(n>>>0<j>>>0?1:0)|0}M=d.low=M+n;d.high=Z+r+(M>>>0<n>>>0?1:0);N=f.low=N+D;f.high=aa+F+(N>>>0<D>>>0?1:0);O=g.low=O+E;g.high=ba+G+(O>>>0<E>>>0?1:0);P=l.low=P+H;l.high=ca+W+(P>>>0<H>>>0?1:0);Q=e.low=Q+p;e.high=da+s+(Q>>>0<p>>>0?1:0);R=m.low=R+I;m.high=ea+U+(R>>>0<I>>>0?1:0);
|
||
|
S=L.low=S+J;L.high=fa+V+(S>>>0<J>>>0?1:0);T=c.low=T+K;c.high=ga+X+(T>>>0<K>>>0?1:0)},_doFinalize:function(){var a=this._data,c=a.words,b=8*this._nDataBytes,d=8*a.sigBytes;c[d>>>5]|=128<<24-d%32;c[(d+128>>>10<<5)+30]=Math.floor(b/4294967296);c[(d+128>>>10<<5)+31]=b;a.sigBytes=4*c.length;this._process();return this._hash.toX32()},clone:function(){var a=c.clone.call(this);a._hash=this._hash.clone();return a},blockSize:32});d.SHA512=c._createHelper(b);d.HmacSHA512=c._createHmacHelper(b)})();
|
||
|
(function(){var a=CryptoJS,d=a.x64,c=d.Word,b=d.WordArray,d=a.algo,f=d.SHA512,d=d.SHA384=f.extend({_doReset:function(){this._hash=new b.init([new c.init(3418070365,3238371032),new c.init(1654270250,914150663),new c.init(2438529370,812702999),new c.init(355462360,4144912697),new c.init(1731405415,4290775857),new c.init(2394180231,1750603025),new c.init(3675008525,1694076839),new c.init(1203062813,3204075428)])},_doFinalize:function(){var a=f._doFinalize.call(this);a.sigBytes-=16;return a}});a.SHA384=
|
||
|
f._createHelper(d);a.HmacSHA384=f._createHmacHelper(d)})();
|
||
|
(function(){var a=CryptoJS,d=a.enc.Utf8;a.algo.HMAC=a.lib.Base.extend({init:function(a,b){a=this._hasher=new a.init;"string"==typeof b&&(b=d.parse(b));var f=a.blockSize,l=4*f;b.sigBytes>l&&(b=a.finalize(b));b.clamp();for(var u=this._oKey=b.clone(),k=this._iKey=b.clone(),m=u.words,x=k.words,y=0;y<f;y++)m[y]^=1549556828,x[y]^=909522486;u.sigBytes=k.sigBytes=l;this.reset()},reset:function(){var a=this._hasher;a.reset();a.update(this._iKey)},update:function(a){this._hasher.update(a);return this},finalize:function(a){var b=
|
||
|
this._hasher;a=b.finalize(a);b.reset();return b.finalize(this._oKey.clone().concat(a))}})})();
|