mirror of
https://github.com/moparisthebest/mailiverse
synced 2024-11-18 15:05:02 -05:00
20 lines
5.5 KiB
JavaScript
Executable File
20 lines
5.5 KiB
JavaScript
Executable File
/*
|
|
CryptoJS v3.1
|
|
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(j,k){var c={},e=c.lib={},p=function(){},m=e.Base={extend:function(a){p.prototype=this;var d=new p;a&&d.mixIn(a);d.hasOwnProperty("init")||(d.init=function(){d.$super.init.apply(this,arguments)});d.init.prototype=d;d.$super=this;return d},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var d in a)a.hasOwnProperty(d)&&(this[d]=a[d]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},
|
|
r=e.WordArray=m.extend({init:function(a,d){a=this.words=a||[];this.sigBytes=d!=k?d:4*a.length},toString:function(a){return(a||l).stringify(this)},concat:function(a){var d=this.words,f=a.words,b=this.sigBytes;a=a.sigBytes;this.clamp();if(b%4)for(var g=0;g<a;g++)d[b+g>>>2]|=(f[g>>>2]>>>24-8*(g%4)&255)<<24-8*((b+g)%4);else if(65535<f.length)for(g=0;g<a;g+=4)d[b+g>>>2]=f[g>>>2];else d.push.apply(d,f);this.sigBytes+=a;return this},clamp:function(){var a=this.words,d=this.sigBytes;a[d>>>2]&=4294967295<<
|
|
32-8*(d%4);a.length=j.ceil(d/4)},clone:function(){var a=m.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var d=[],f=0;f<a;f+=4)d.push(4294967296*j.random()|0);return new r.init(d,a)}}),s=c.enc={},l=s.Hex={stringify:function(a){var d=a.words;a=a.sigBytes;for(var f=[],b=0;b<a;b++){var g=d[b>>>2]>>>24-8*(b%4)&255;f.push((g>>>4).toString(16));f.push((g&15).toString(16))}return f.join("")},parse:function(a){for(var d=a.length,f=[],b=0;b<d;b+=2)f[b>>>3]|=parseInt(a.substr(b,
|
|
2),16)<<24-4*(b%8);return new r.init(f,d/2)}},n=s.Latin1={stringify:function(a){var d=a.words;a=a.sigBytes;for(var f=[],b=0;b<a;b++)f.push(String.fromCharCode(d[b>>>2]>>>24-8*(b%4)&255));return f.join("")},parse:function(a){for(var d=a.length,f=[],b=0;b<d;b++)f[b>>>2]|=(a.charCodeAt(b)&255)<<24-8*(b%4);return new r.init(f,d)}},h=s.Utf8={stringify:function(a){try{return decodeURIComponent(escape(n.stringify(a)))}catch(d){throw Error("Malformed UTF-8 data");}},parse:function(a){return n.parse(unescape(encodeURIComponent(a)))}},
|
|
u=e.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new r.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=h.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var d=this._data,f=d.words,b=d.sigBytes,g=this.blockSize,c=b/(4*g),c=a?j.ceil(c):j.max((c|0)-this._minBufferSize,0);a=c*g;b=j.min(4*a,b);if(a){for(var e=0;e<a;e+=g)this._doProcessBlock(f,e);e=f.splice(0,a);d.sigBytes-=b}return new r.init(e,b)},clone:function(){var a=m.clone.call(this);
|
|
a._data=this._data.clone();return a},_minBufferSize:0});e.Hasher=u.extend({cfg:m.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset()},reset:function(){u.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(d,f){return(new a.init(f)).finalize(d)}},_createHmacHelper:function(a){return function(d,f){return(new t.HMAC.init(a,
|
|
f)).finalize(d)}}});var t=c.algo={};return c}(Math);
|
|
(function(j){for(var k=CryptoJS,c=k.lib,e=c.WordArray,p=c.Hasher,c=k.algo,m=[],r=[],s=function(a){return 4294967296*(a-(a|0))|0},l=2,n=0;64>n;){var h;a:{h=l;for(var u=j.sqrt(h),t=2;t<=u;t++)if(!(h%t)){h=!1;break a}h=!0}h&&(8>n&&(m[n]=s(j.pow(l,0.5))),r[n]=s(j.pow(l,1/3)),n++);l++}var a=[],c=c.SHA256=p.extend({_doReset:function(){this._hash=new e.init(m.slice(0))},_doProcessBlock:function(d,f){for(var b=this._hash.words,g=b[0],c=b[1],e=b[2],j=b[3],h=b[4],p=b[5],m=b[6],n=b[7],q=0;64>q;q++){if(16>q)a[q]=
|
|
d[f+q]|0;else{var k=a[q-15],l=a[q-2];a[q]=((k<<25|k>>>7)^(k<<14|k>>>18)^k>>>3)+a[q-7]+((l<<15|l>>>17)^(l<<13|l>>>19)^l>>>10)+a[q-16]}k=n+((h<<26|h>>>6)^(h<<21|h>>>11)^(h<<7|h>>>25))+(h&p^~h&m)+r[q]+a[q];l=((g<<30|g>>>2)^(g<<19|g>>>13)^(g<<10|g>>>22))+(g&c^g&e^c&e);n=m;m=p;p=h;h=j+k|0;j=e;e=c;c=g;g=k+l|0}b[0]=b[0]+g|0;b[1]=b[1]+c|0;b[2]=b[2]+e|0;b[3]=b[3]+j|0;b[4]=b[4]+h|0;b[5]=b[5]+p|0;b[6]=b[6]+m|0;b[7]=b[7]+n|0},_doFinalize:function(){var a=this._data,c=a.words,b=8*this._nDataBytes,e=8*a.sigBytes;
|
|
c[e>>>5]|=128<<24-e%32;c[(e+64>>>9<<4)+14]=j.floor(b/4294967296);c[(e+64>>>9<<4)+15]=b;a.sigBytes=4*c.length;this._process();return this._hash},clone:function(){var a=p.clone.call(this);a._hash=this._hash.clone();return a}});k.SHA256=p._createHelper(c);k.HmacSHA256=p._createHmacHelper(c)})(Math);
|
|
(function(){var j=CryptoJS,k=j.lib.WordArray,c=j.algo,e=c.SHA256,c=c.SHA224=e.extend({_doReset:function(){this._hash=new k.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var c=e._doFinalize.call(this);c.sigBytes-=4;return c}});j.SHA224=e._createHelper(c);j.HmacSHA224=e._createHmacHelper(c)})();
|
|
(function(){var j=CryptoJS,k=j.enc.Utf8;j.algo.HMAC=j.lib.Base.extend({init:function(c,e){c=this._hasher=new c.init;"string"==typeof e&&(e=k.parse(e));var j=c.blockSize,m=4*j;e.sigBytes>m&&(e=c.finalize(e));e.clamp();for(var r=this._oKey=e.clone(),s=this._iKey=e.clone(),l=r.words,n=s.words,h=0;h<j;h++)l[h]^=1549556828,n[h]^=909522486;r.sigBytes=s.sigBytes=m;this.reset()},reset:function(){var c=this._hasher;c.reset();c.update(this._iKey)},update:function(c){this._hasher.update(c);return this},finalize:function(c){var e=
|
|
this._hasher;c=e.finalize(c);e.reset();return e.finalize(this._oKey.clone().concat(c))}})})();
|