2 lines
14 KiB
JavaScript
2 lines
14 KiB
JavaScript
(function(u,o){typeof exports=="object"?module.exports=exports=o():typeof define=="function"&&define.amd?define([],o):u.CryptoJS=o()})(this,function(){var u=u||function(o,S){var k=Object.create||function(){function r(){}return function(c){var h;return r.prototype=c,h=new r,r.prototype=null,h}}(),M={},g=M.lib={},C=g.Base=function(){return{extend:function(r){var c=k(this);return r&&c.mixIn(r),c.hasOwnProperty("init")&&this.init!==c.init||(c.init=function(){c.$super.init.apply(this,arguments)}),c.init.prototype=c,c.$super=this,c},create:function(){var r=this.extend();return r.init.apply(r,arguments),r},init:function(){},mixIn:function(r){for(var c in r)r.hasOwnProperty(c)&&(this[c]=r[c]);r.hasOwnProperty("toString")&&(this.toString=r.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),v=g.WordArray=C.extend({init:function(r,c){r=this.words=r||[],c!=S?this.sigBytes=c:this.sigBytes=4*r.length},toString:function(r){return(r||z).stringify(this)},concat:function(r){var c=this.words,h=r.words,n=this.sigBytes,f=r.sigBytes;if(this.clamp(),n%4)for(var s=0;s<f;s++){var y=h[s>>>2]>>>24-s%4*8&255;c[n+s>>>2]|=y<<24-(n+s)%4*8}else for(var s=0;s<f;s+=4)c[n+s>>>2]=h[s>>>2];return this.sigBytes+=f,this},clamp:function(){var r=this.words,c=this.sigBytes;r[c>>>2]&=4294967295<<32-c%4*8,r.length=o.ceil(c/4)},clone:function(){var r=C.clone.call(this);return r.words=this.words.slice(0),r},random:function(r){for(var c,h=[],n=function(y){var y=y,x=987654321,w=4294967295;return function(){x=36969*(65535&x)+(x>>16)&w,y=18e3*(65535&y)+(y>>16)&w;var _=(x<<16)+y&w;return _/=4294967296,_+=.5,_*(o.random()>.5?1:-1)}},f=0;f<r;f+=4){var s=n(4294967296*(c||o.random()));c=987654071*s(),h.push(4294967296*s()|0)}return new v.init(h,r)}}),d=M.enc={},z=d.Hex={stringify:function(r){for(var c=r.words,h=r.sigBytes,n=[],f=0;f<h;f++){var s=c[f>>>2]>>>24-f%4*8&255;n.push((s>>>4).toString(16)),n.push((15&s).toString(16))}return n.join("")},parse:function(r){for(var c=r.length,h=[],n=0;n<c;n+=2)h[n>>>3]|=parseInt(r.substr(n,2),16)<<24-n%8*4;return new v.init(h,c/2)}},m=d.Latin1={stringify:function(r){for(var c=r.words,h=r.sigBytes,n=[],f=0;f<h;f++){var s=c[f>>>2]>>>24-f%4*8&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(r){for(var c=r.length,h=[],n=0;n<c;n++)h[n>>>2]|=(255&r.charCodeAt(n))<<24-n%4*8;return new v.init(h,c)}},p=d.Utf8={stringify:function(r){try{return decodeURIComponent(escape(m.stringify(r)))}catch(c){throw new Error("Malformed UTF-8 data")}},parse:function(r){return m.parse(unescape(encodeURIComponent(r)))}},b=g.BufferedBlockAlgorithm=C.extend({reset:function(){this._data=new v.init,this._nDataBytes=0},_append:function(r){typeof r=="string"&&(r=p.parse(r)),this._data.concat(r),this._nDataBytes+=r.sigBytes},_process:function(r){var c=this._data,h=c.words,n=c.sigBytes,f=this.blockSize,s=4*f,y=n/s;y=r?o.ceil(y):o.max((0|y)-this._minBufferSize,0);var x=y*f,w=o.min(4*x,n);if(x){for(var _=0;_<x;_+=f)this._doProcessBlock(h,_);var e=h.splice(0,x);c.sigBytes-=w}return new v.init(e,w)},clone:function(){var r=C.clone.call(this);return r._data=this._data.clone(),r},_minBufferSize:0}),D=(g.Hasher=b.extend({cfg:C.extend(),init:function(r){this.cfg=this.cfg.extend(r),this.reset()},reset:function(){b.reset.call(this),this._doReset()},update:function(r){return this._append(r),this._process(),this},finalize:function(r){r&&this._append(r);var c=this._doFinalize();return c},blockSize:16,_createHelper:function(r){return function(c,h){return new r.init(h).finalize(c)}},_createHmacHelper:function(r){return function(c,h){return new D.HMAC.init(r,h).finalize(c)}}}),M.algo={});return M}(Math);return u}),function(u,o,S){typeof exports=="object"?module.exports=exports=o(require("./core.min"),require("./sha1.min"),require("./hmac.min")):typeof define=="function"&&define.amd?define(["./core.min","./sha1.min","./hmac.min"],o):o(u.CryptoJS)}(this,function(u){return function(){var o=u,S=o.lib,k=S.Base,M=S.WordArray,g=o.algo,C=g.MD5,v=g.EvpKDF=k.extend({cfg:k.extend({keySize:4,hasher:C,iterations:1}),init:function(d){this.cfg=this.cfg.extend(d)},compute:function(d,z){for(var m=this.cfg,p=m.hasher.create(),b=M.create(),D=b.words,r=m.keySize,c=m.iterations;D.length<r;){h&&p.update(h);var h=p.update(d).finalize(z);p.reset();for(var n=1;n<c;n++)h=p.finalize(h),p.reset();b.concat(h)}return b.sigBytes=4*r,b}});o.EvpKDF=function(d,z,m){return v.create(m).compute(d,z)}}(),u.EvpKDF}),function(u,o){typeof exports=="object"?module.exports=exports=o(require("./core.min")):typeof define=="function"&&define.amd?define(["./core.min"],o):o(u.CryptoJS)}(this,function(u){return function(){function o(C,v,d){for(var z=[],m=0,p=0;p<v;p++)if(p%4){var b=d[C.charCodeAt(p-1)]<<p%4*2,D=d[C.charCodeAt(p)]>>>6-p%4*2;z[m>>>2]|=(b|D)<<24-m%4*8,m++}return M.create(z,m)}var S=u,k=S.lib,M=k.WordArray,g=S.enc;g.Base64={stringify:function(C){var v=C.words,d=C.sigBytes,z=this._map;C.clamp();for(var m=[],p=0;p<d;p+=3)for(var b=v[p>>>2]>>>24-p%4*8&255,D=v[p+1>>>2]>>>24-(p+1)%4*8&255,r=v[p+2>>>2]>>>24-(p+2)%4*8&255,c=b<<16|D<<8|r,h=0;h<4&&p+.75*h<d;h++)m.push(z.charAt(c>>>6*(3-h)&63));var n=z.charAt(64);if(n)for(;m.length%4;)m.push(n);return m.join("")},parse:function(C){var v=C.length,d=this._map,z=this._reverseMap;if(!z){z=this._reverseMap=[];for(var m=0;m<d.length;m++)z[d.charCodeAt(m)]=m}var p=d.charAt(64);if(p){var b=C.indexOf(p);b!==-1&&(v=b)}return o(C,v,z)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),u.enc.Base64}),function(u,o,S){typeof exports=="object"?module.exports=exports=o(require("./core.min"),require("./evpkdf.min")):typeof define=="function"&&define.amd?define(["./core.min","./evpkdf.min"],o):o(u.CryptoJS)}(this,function(u){u.lib.Cipher||function(o){var S=u,k=S.lib,M=k.Base,g=k.WordArray,C=k.BufferedBlockAlgorithm,v=S.enc,d=(v.Utf8,v.Base64),z=S.algo,m=z.EvpKDF,p=k.Cipher=C.extend({cfg:M.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,a){this.cfg=this.cfg.extend(a),this._xformMode=e,this._key=t,this.reset()},reset:function(){C.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){e&&this._append(e);var t=this._doFinalize();return t},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(t){return typeof t=="string"?_:y}return function(t){return{encrypt:function(a,i,l){return e(i).encrypt(t,a,i,l)},decrypt:function(a,i,l){return e(i).decrypt(t,a,i,l)}}}}()}),b=(k.StreamCipher=p.extend({_doFinalize:function(){var e=this._process(!0);return e},blockSize:1}),S.mode={}),D=k.BlockCipherMode=M.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),r=b.CBC=function(){function e(a,i,l){var B=this._iv;if(B){var E=B;this._iv=o}else var E=this._prevBlock;for(var O=0;O<l;O++)a[i+O]^=E[O]}var t=D.extend();return t.Encryptor=t.extend({processBlock:function(a,i){var l=this._cipher,B=l.blockSize;e.call(this,a,i,B),l.encryptBlock(a,i),this._prevBlock=a.slice(i,i+B)}}),t.Decryptor=t.extend({processBlock:function(a,i){var l=this._cipher,B=l.blockSize,E=a.slice(i,i+B);l.decryptBlock(a,i),e.call(this,a,i,B),this._prevBlock=E}}),t}(),c=S.pad={},h=c.Pkcs7={pad:function(e,t){for(var a=4*t,i=a-e.sigBytes%a,l=i<<24|i<<16|i<<8|i,B=[],E=0;E<i;E+=4)B.push(l);var O=g.create(B,i);e.concat(O)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},n=(k.BlockCipher=p.extend({cfg:p.cfg.extend({mode:r,padding:h}),reset:function(){p.reset.call(this);var e=this.cfg,t=e.iv,a=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var i=a.createEncryptor;else{var i=a.createDecryptor;this._minBufferSize=1}this._mode&&this._mode.__creator==i?this._mode.init(this,t&&t.words):(this._mode=i.call(a,this,t&&t.words),this._mode.__creator=i)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else{var t=this._process(!0);e.unpad(t)}return t},blockSize:4}),k.CipherParams=M.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}})),f=S.format={},s=f.OpenSSL={stringify:function(e){var t=e.ciphertext,a=e.salt;if(a)var i=g.create([1398893684,1701076831]).concat(a).concat(t);else var i=t;return i.toString(d)},parse:function(e){var t=d.parse(e),a=t.words;if(a[0]==1398893684&&a[1]==1701076831){var i=g.create(a.slice(2,4));a.splice(0,4),t.sigBytes-=16}return n.create({ciphertext:t,salt:i})}},y=k.SerializableCipher=M.extend({cfg:M.extend({format:s}),encrypt:function(e,t,a,i){i=this.cfg.extend(i);var l=e.createEncryptor(a,i),B=l.finalize(t),E=l.cfg;return n.create({ciphertext:B,key:a,iv:E.iv,algorithm:e,mode:E.mode,padding:E.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,a,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var l=e.createDecryptor(a,i).finalize(t.ciphertext);return l},_parse:function(e,t){return typeof e=="string"?t.parse(e,this):e}}),x=S.kdf={},w=x.OpenSSL={execute:function(e,t,a,i){i||(i=g.random(8));var l=m.create({keySize:t+a}).compute(e,i),B=g.create(l.words.slice(t),4*a);return l.sigBytes=4*t,n.create({key:l,iv:B,salt:i})}},_=k.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:w}),encrypt:function(e,t,a,i){i=this.cfg.extend(i);var l=i.kdf.execute(a,e.keySize,e.ivSize);i.iv=l.iv;var B=y.encrypt.call(this,e,t,l.key,i);return B.mixIn(l),B},decrypt:function(e,t,a,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var l=i.kdf.execute(a,e.keySize,e.ivSize,t.salt);i.iv=l.iv;var B=y.decrypt.call(this,e,t,l.key,i);return B}})}()}),function(u,o){typeof exports=="object"?module.exports=exports=o(require("./core.min")):typeof define=="function"&&define.amd?define(["./core.min"],o):o(u.CryptoJS)}(this,function(u){(function(){var o=u,S=o.lib,k=S.Base,M=o.enc,g=M.Utf8,C=o.algo;C.HMAC=k.extend({init:function(v,d){v=this._hasher=new v.init,typeof d=="string"&&(d=g.parse(d));var z=v.blockSize,m=4*z;d.sigBytes>m&&(d=v.finalize(d)),d.clamp();for(var p=this._oKey=d.clone(),b=this._iKey=d.clone(),D=p.words,r=b.words,c=0;c<z;c++)D[c]^=1549556828,r[c]^=909522486;p.sigBytes=b.sigBytes=m,this.reset()},reset:function(){var v=this._hasher;v.reset(),v.update(this._iKey)},update:function(v){return this._hasher.update(v),this},finalize:function(v){var d=this._hasher,z=d.finalize(v);d.reset();var m=d.finalize(this._oKey.clone().concat(z));return m}})})()}),function(u,o,S){typeof exports=="object"?module.exports=exports=o(require("./core.min"),require("./cipher-core.min")):typeof define=="function"&&define.amd?define(["./core.min","./cipher-core.min"],o):o(u.CryptoJS)}(this,function(u){return u.mode.ECB=function(){var o=u.lib.BlockCipherMode.extend();return o.Encryptor=o.extend({processBlock:function(S,k){this._cipher.encryptBlock(S,k)}}),o.Decryptor=o.extend({processBlock:function(S,k){this._cipher.decryptBlock(S,k)}}),o}(),u.mode.ECB}),function(u,o,S){typeof exports=="object"?module.exports=exports=o(require("./core.min"),require("./cipher-core.min")):typeof define=="function"&&define.amd?define(["./core.min","./cipher-core.min"],o):o(u.CryptoJS)}(this,function(u){return u.pad.Pkcs7}),function(u,o,S){typeof exports=="object"?module.exports=exports=o(require("./core.min"),require("./enc-base64.min"),require("./md5.min"),require("./evpkdf.min"),require("./cipher-core.min")):typeof define=="function"&&define.amd?define(["./core.min","./enc-base64.min","./md5.min","./evpkdf.min","./cipher-core.min"],o):o(u.CryptoJS)}(this,function(u){return function(){var o=u,S=o.lib,k=S.BlockCipher,M=o.algo,g=[],C=[],v=[],d=[],z=[],m=[],p=[],b=[],D=[],r=[];(function(){for(var n=[],f=0;f<256;f++)f<128?n[f]=f<<1:n[f]=f<<1^283;for(var s=0,y=0,f=0;f<256;f++){var x=y^y<<1^y<<2^y<<3^y<<4;x=x>>>8^255&x^99,g[s]=x,C[x]=s;var w=n[s],_=n[w],e=n[_],t=257*n[x]^16843008*x;v[s]=t<<24|t>>>8,d[s]=t<<16|t>>>16,z[s]=t<<8|t>>>24,m[s]=t;var t=16843009*e^65537*_^257*w^16843008*s;p[x]=t<<24|t>>>8,b[x]=t<<16|t>>>16,D[x]=t<<8|t>>>24,r[x]=t,s?(s=w^n[n[n[e^w]]],y^=n[n[y]]):s=y=1}})();var c=[0,1,2,4,8,16,32,64,128,27,54],h=M.AES=k.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var n=this._keyPriorReset=this._key,f=n.words,s=n.sigBytes/4,y=this._nRounds=s+6,x=4*(y+1),w=this._keySchedule=[],_=0;_<x;_++)if(_<s)w[_]=f[_];else{var e=w[_-1];_%s?s>6&&_%s==4&&(e=g[e>>>24]<<24|g[e>>>16&255]<<16|g[e>>>8&255]<<8|g[255&e]):(e=e<<8|e>>>24,e=g[e>>>24]<<24|g[e>>>16&255]<<16|g[e>>>8&255]<<8|g[255&e],e^=c[_/s|0]<<24),w[_]=w[_-s]^e}for(var t=this._invKeySchedule=[],a=0;a<x;a++){var _=x-a;if(a%4)var e=w[_];else var e=w[_-4];a<4||_<=4?t[a]=e:t[a]=p[g[e>>>24]]^b[g[e>>>16&255]]^D[g[e>>>8&255]]^r[g[255&e]]}}},encryptBlock:function(n,f){this._doCryptBlock(n,f,this._keySchedule,v,d,z,m,g)},decryptBlock:function(n,f){var s=n[f+1];n[f+1]=n[f+3],n[f+3]=s,this._doCryptBlock(n,f,this._invKeySchedule,p,b,D,r,C);var s=n[f+1];n[f+1]=n[f+3],n[f+3]=s},_doCryptBlock:function(n,f,s,y,x,w,_,e){for(var t=this._nRounds,a=n[f]^s[0],i=n[f+1]^s[1],l=n[f+2]^s[2],B=n[f+3]^s[3],E=4,O=1;O<t;O++){var A=y[a>>>24]^x[i>>>16&255]^w[l>>>8&255]^_[255&B]^s[E++],q=y[i>>>24]^x[l>>>16&255]^w[B>>>8&255]^_[255&a]^s[E++],R=y[l>>>24]^x[B>>>16&255]^w[a>>>8&255]^_[255&i]^s[E++],F=y[B>>>24]^x[a>>>16&255]^w[i>>>8&255]^_[255&l]^s[E++];a=A,i=q,l=R,B=F}var A=(e[a>>>24]<<24|e[i>>>16&255]<<16|e[l>>>8&255]<<8|e[255&B])^s[E++],q=(e[i>>>24]<<24|e[l>>>16&255]<<16|e[B>>>8&255]<<8|e[255&a])^s[E++],R=(e[l>>>24]<<24|e[B>>>16&255]<<16|e[a>>>8&255]<<8|e[255&i])^s[E++],F=(e[B>>>24]<<24|e[a>>>16&255]<<16|e[i>>>8&255]<<8|e[255&l])^s[E++];n[f]=A,n[f+1]=q,n[f+2]=R,n[f+3]=F},keySize:8});o.AES=k._createHelper(h)}(),u.AES}),function(u,o){typeof exports=="object"?module.exports=exports=o(require("./core.min")):typeof define=="function"&&define.amd?define(["./core.min"],o):o(u.CryptoJS)}(this,function(u){return u.enc.Utf8});
|