Last active
February 6, 2019 12:21
-
-
Save erhaem/7737ac391bb0ea974badfc973d0aa15f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| 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(c,t){var e={},r=e.lib={},i=function(){},n=r.Base={extend:function(t){i.prototype=this;var e=new i;return t&&e.mixIn(t),e.hasOwnProperty("init")||(e.init=function(){e.$super.init.apply(this,arguments)}),(e.init.prototype=e).$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},a=r.WordArray=n.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||s).stringify(this)},concat:function(t){var e=this.words,r=t.words,i=this.sigBytes;if(t=t.sigBytes,this.clamp(),i%4)for(var n=0;n<t;n++)e[i+n>>>2]|=(r[n>>>2]>>>24-n%4*8&255)<<24-(i+n)%4*8;else if(65535<r.length)for(n=0;n<t;n+=4)e[i+n>>>2]=r[n>>>2];else e.push.apply(e,r);return this.sigBytes+=t,this},clamp:function(){var t=this.words,e=this.sigBytes;t[e>>>2]&=4294967295<<32-e%4*8,t.length=c.ceil(e/4)},clone:function(){var t=n.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],r=0;r<t;r+=4)e.push(4294967296*c.random()|0);return new a.init(e,t)}}),o=e.enc={},s=o.Hex={stringify:function(t){var e=t.words;t=t.sigBytes;for(var r=[],i=0;i<t;i++){var n=e[i>>>2]>>>24-i%4*8&255;r.push((n>>>4).toString(16)),r.push((15&n).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,r=[],i=0;i<e;i+=2)r[i>>>3]|=parseInt(t.substr(i,2),16)<<24-i%8*4;return new a.init(r,e/2)}},f=o.Latin1={stringify:function(t){var e=t.words;t=t.sigBytes;for(var r=[],i=0;i<t;i++)r.push(String.fromCharCode(e[i>>>2]>>>24-i%4*8&255));return r.join("")},parse:function(t){for(var e=t.length,r=[],i=0;i<e;i++)r[i>>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;return new a.init(r,e)}},h=o.Utf8={stringify:function(t){try{return decodeURIComponent(escape(f.stringify(t)))}catch(t){throw Error("Malformed UTF-8 data")}},parse:function(t){return f.parse(unescape(encodeURIComponent(t)))}},u=r.BufferedBlockAlgorithm=n.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=h.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(t){var e=this._data,r=e.words,i=e.sigBytes,n=this.blockSize,o=i/(4*n);if(t=(o=t?c.ceil(o):c.max((0|o)-this._minBufferSize,0))*n,i=c.min(4*t,i),t){for(var s=0;s<t;s+=n)this._doProcessBlock(r,s);s=r.splice(0,t),e.sigBytes-=i}return new a.init(s,i)},clone:function(){var t=n.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});r.Hasher=u.extend({cfg:n.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){u.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(r){return function(t,e){return new r.init(e).finalize(t)}},_createHmacHelper:function(r){return function(t,e){return new p.HMAC.init(r,e).finalize(t)}}});var p=e.algo={};return e}(Math);!function(){var t=CryptoJS,a=t.lib.WordArray;t.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,i=this._map;t.clamp(),t=[];for(var n=0;n<r;n+=3)for(var o=(e[n>>>2]>>>24-n%4*8&255)<<16|(e[n+1>>>2]>>>24-(n+1)%4*8&255)<<8|e[n+2>>>2]>>>24-(n+2)%4*8&255,s=0;s<4&&n+.75*s<r;s++)t.push(i.charAt(o>>>6*(3-s)&63));if(e=i.charAt(64))for(;t.length%4;)t.push(e);return t.join("")},parse:function(t){var e=t.length,r=this._map;(i=r.charAt(64))&&(-1!=(i=t.indexOf(i))&&(e=i));for(var i=[],n=0,o=0;o<e;o++)if(o%4){var s=r.indexOf(t.charAt(o-1))<<o%4*2,c=r.indexOf(t.charAt(o))>>>6-o%4*2;i[n>>>2]|=(s|c)<<24-n%4*8,n++}return a.create(i,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(o){function m(t,e,r,i,n,o,s){return((t=t+(e&r|~e&i)+n+s)<<o|t>>>32-o)+e}function z(t,e,r,i,n,o,s){return((t=t+(e&i|r&~i)+n+s)<<o|t>>>32-o)+e}function C(t,e,r,i,n,o,s){return((t=t+(e^r^i)+n+s)<<o|t>>>32-o)+e}function w(t,e,r,i,n,o,s){return((t=t+(r^(e|~i))+n+s)<<o|t>>>32-o)+e}for(var t=CryptoJS,e=(i=t.lib).WordArray,r=i.Hasher,i=t.algo,D=[],n=0;n<64;n++)D[n]=4294967296*o.abs(o.sin(n+1))|0;i=i.MD5=r.extend({_doReset:function(){this._hash=new e.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var r=0;r<16;r++){var i=t[s=e+r];t[s]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}r=this._hash.words;var n,o,s=t[e+0],c=(i=t[e+1],t[e+2]),a=t[e+3],f=t[e+4],h=t[e+5],u=t[e+6],p=t[e+7],d=t[e+8],l=t[e+9],y=t[e+10],_=t[e+11],v=t[e+12],g=t[e+13],B=t[e+14],x=t[e+15],S=r[0],k=w(k=w(k=w(k=w(k=C(k=C(k=C(k=C(k=z(k=z(k=z(k=z(k=m(k=m(k=m(k=m(k=r[1],o=m(o=r[2],n=m(n=r[3],S=m(S,k,o,n,s,7,D[0]),k,o,i,12,D[1]),S,k,c,17,D[2]),n,S,a,22,D[3]),o=m(o,n=m(n,S=m(S,k,o,n,f,7,D[4]),k,o,h,12,D[5]),S,k,u,17,D[6]),n,S,p,22,D[7]),o=m(o,n=m(n,S=m(S,k,o,n,d,7,D[8]),k,o,l,12,D[9]),S,k,y,17,D[10]),n,S,_,22,D[11]),o=m(o,n=m(n,S=m(S,k,o,n,v,7,D[12]),k,o,g,12,D[13]),S,k,B,17,D[14]),n,S,x,22,D[15]),o=z(o,n=z(n,S=z(S,k,o,n,i,5,D[16]),k,o,u,9,D[17]),S,k,_,14,D[18]),n,S,s,20,D[19]),o=z(o,n=z(n,S=z(S,k,o,n,h,5,D[20]),k,o,y,9,D[21]),S,k,x,14,D[22]),n,S,f,20,D[23]),o=z(o,n=z(n,S=z(S,k,o,n,l,5,D[24]),k,o,B,9,D[25]),S,k,a,14,D[26]),n,S,d,20,D[27]),o=z(o,n=z(n,S=z(S,k,o,n,g,5,D[28]),k,o,c,9,D[29]),S,k,p,14,D[30]),n,S,v,20,D[31]),o=C(o,n=C(n,S=C(S,k,o,n,h,4,D[32]),k,o,d,11,D[33]),S,k,_,16,D[34]),n,S,B,23,D[35]),o=C(o,n=C(n,S=C(S,k,o,n,i,4,D[36]),k,o,f,11,D[37]),S,k,p,16,D[38]),n,S,y,23,D[39]),o=C(o,n=C(n,S=C(S,k,o,n,g,4,D[40]),k,o,s,11,D[41]),S,k,a,16,D[42]),n,S,u,23,D[43]),o=C(o,n=C(n,S=C(S,k,o,n,l,4,D[44]),k,o,v,11,D[45]),S,k,x,16,D[46]),n,S,c,23,D[47]),o=w(o,n=w(n,S=w(S,k,o,n,s,6,D[48]),k,o,p,10,D[49]),S,k,B,15,D[50]),n,S,h,21,D[51]),o=w(o,n=w(n,S=w(S,k,o,n,v,6,D[52]),k,o,a,10,D[53]),S,k,y,15,D[54]),n,S,i,21,D[55]),o=w(o,n=w(n,S=w(S,k,o,n,d,6,D[56]),k,o,x,10,D[57]),S,k,u,15,D[58]),n,S,g,21,D[59]),o=w(o,n=w(n,S=w(S,k,o,n,f,6,D[60]),k,o,_,10,D[61]),S,k,c,15,D[62]),n,S,l,21,D[63]);r[0]=r[0]+S|0,r[1]=r[1]+k|0,r[2]=r[2]+o|0,r[3]=r[3]+n|0},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;e[i>>>5]|=128<<24-i%32;var n=o.floor(r/4294967296);for(e[15+(i+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(e.length+1),this._process(),e=(t=this._hash).words,r=0;r<4;r++)i=e[r],e[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8);return t},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}}),t.MD5=r._createHelper(i),t.HmacMD5=r._createHmacHelper(i)}(Math),function(){var t,e=CryptoJS,r=(t=e.lib).Base,f=t.WordArray,i=(t=e.algo).EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:t.MD5,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var r=(s=this.cfg).hasher.create(),i=f.create(),n=i.words,o=s.keySize,s=s.iterations;n.length<o;){c&&r.update(c);var c=r.update(t).finalize(e);r.reset();for(var a=1;a<s;a++)c=r.finalize(c),r.reset();i.concat(c)}return i.sigBytes=4*o,i}});e.EvpKDF=function(t,e,r){return i.create(r).compute(t,e)}}(),CryptoJS.lib.Cipher||function(t){var e=(d=CryptoJS).lib,r=e.Base,s=e.WordArray,i=e.BufferedBlockAlgorithm,n=d.enc.Base64,o=d.algo.EvpKDF,c=e.Cipher=i.extend({cfg:r.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,r){this.cfg=this.cfg.extend(r),this._xformMode=t,this._key=e,this.reset()},reset:function(){i.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(i){return{encrypt:function(t,e,r){return("string"==typeof e?l:p).encrypt(i,t,e,r)},decrypt:function(t,e,r){return("string"==typeof e?l:p).decrypt(i,t,e,r)}}}});e.StreamCipher=c.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var a=d.mode={},f=function(t,e,r){var i=this._iv;i?this._iv=void 0:i=this._prevBlock;for(var n=0;n<r;n++)t[e+n]^=i[n]},h=(e.BlockCipherMode=r.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}})).extend();h.Encryptor=h.extend({processBlock:function(t,e){var r=this._cipher,i=r.blockSize;f.call(this,t,e,i),r.encryptBlock(t,e),this._prevBlock=t.slice(e,e+i)}}),h.Decryptor=h.extend({processBlock:function(t,e){var r=this._cipher,i=r.blockSize,n=t.slice(e,e+i);r.decryptBlock(t,e),f.call(this,t,e,i),this._prevBlock=n}}),a=a.CBC=h,h=(d.pad={}).Pkcs7={pad:function(t,e){for(var r,i=(r=(r=4*e)-t.sigBytes%r)<<24|r<<16|r<<8|r,n=[],o=0;o<r;o+=4)n.push(i);r=s.create(n,r),t.concat(r)},unpad:function(t){t.sigBytes-=255&t.words[t.sigBytes-1>>>2]}},e.BlockCipher=c.extend({cfg:c.cfg.extend({mode:a,padding:h}),reset:function(){c.reset.call(this);var t=(e=this.cfg).iv,e=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var r=e.createEncryptor;else r=e.createDecryptor,this._minBufferSize=1;this._mode=r.call(e,this,t&&t.words)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){t.pad(this._data,this.blockSize);var e=this._process(!0)}else e=this._process(!0),t.unpad(e);return e},blockSize:4});var u=e.CipherParams=r.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),p=(a=(d.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext;return((t=t.salt)?s.create([1398893684,1701076831]).concat(t).concat(e):e).toString(n)},parse:function(t){var e=(t=n.parse(t)).words;if(1398893684==e[0]&&1701076831==e[1]){var r=s.create(e.slice(2,4));e.splice(0,4),t.sigBytes-=16}return u.create({ciphertext:t,salt:r})}},e.SerializableCipher=r.extend({cfg:r.extend({format:a}),encrypt:function(t,e,r,i){i=this.cfg.extend(i);var n=t.createEncryptor(r,i);return e=n.finalize(e),n=n.cfg,u.create({ciphertext:e,key:r,iv:n.iv,algorithm:t,mode:n.mode,padding:n.padding,blockSize:t.blockSize,formatter:i.format})},decrypt:function(t,e,r,i){return i=this.cfg.extend(i),e=this._parse(e,i.format),t.createDecryptor(r,i).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}})),d=(d.kdf={}).OpenSSL={execute:function(t,e,r,i){return i||(i=s.random(8)),t=o.create({keySize:e+r}).compute(t,i),r=s.create(t.words.slice(e),4*r),t.sigBytes=4*e,u.create({key:t,iv:r,salt:i})}},l=e.PasswordBasedCipher=p.extend({cfg:p.cfg.extend({kdf:d}),encrypt:function(t,e,r,i){return r=(i=this.cfg.extend(i)).kdf.execute(r,t.keySize,t.ivSize),i.iv=r.iv,(t=p.encrypt.call(this,t,e,r.key,i)).mixIn(r),t},decrypt:function(t,e,r,i){return i=this.cfg.extend(i),e=this._parse(e,i.format),r=i.kdf.execute(r,t.keySize,t.ivSize,e.salt),i.iv=r.iv,p.decrypt.call(this,t,e,r.key,i)}})}(),function(){for(var t=CryptoJS,e=t.lib.BlockCipher,r=t.algo,s=[],i=[],n=[],o=[],c=[],a=[],f=[],h=[],u=[],p=[],d=[],l=0;l<256;l++)d[l]=l<128?l<<1:l<<1^283;var y=0,_=0;for(l=0;l<256;l++){var v=(v=_^_<<1^_<<2^_<<3^_<<4)>>>8^255&v^99;s[y]=v;var g=d[i[v]=y],B=d[g],x=d[B],S=257*d[v]^16843008*v;n[y]=S<<24|S>>>8,o[y]=S<<16|S>>>16,c[y]=S<<8|S>>>24,a[y]=S,S=16843009*x^65537*B^257*g^16843008*y,f[v]=S<<24|S>>>8,h[v]=S<<16|S>>>16,u[v]=S<<8|S>>>24,p[v]=S,y?(y=g^d[d[d[x^g]]],_^=d[d[_]]):y=_=1}var k=[0,1,2,4,8,16,32,64,128,27,54];r=r.AES=e.extend({_doReset:function(){for(var t=(r=this._key).words,e=r.sigBytes/4,r=4*((this._nRounds=e+6)+1),i=this._keySchedule=[],n=0;n<r;n++)if(n<e)i[n]=t[n];else{var o=i[n-1];n%e?6<e&&4==n%e&&(o=s[o>>>24]<<24|s[o>>>16&255]<<16|s[o>>>8&255]<<8|s[255&o]):(o=s[(o=o<<8|o>>>24)>>>24]<<24|s[o>>>16&255]<<16|s[o>>>8&255]<<8|s[255&o],o^=k[n/e|0]<<24),i[n]=i[n-e]^o}for(t=this._invKeySchedule=[],e=0;e<r;e++)n=r-e,o=e%4?i[n]:i[n-4],t[e]=e<4||n<=4?o:f[s[o>>>24]]^h[s[o>>>16&255]]^u[s[o>>>8&255]]^p[s[255&o]]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,n,o,c,a,s)},decryptBlock:function(t,e){var r=t[e+1];t[e+1]=t[e+3],t[e+3]=r,this._doCryptBlock(t,e,this._invKeySchedule,f,h,u,p,i),r=t[e+1],t[e+1]=t[e+3],t[e+3]=r},_doCryptBlock:function(t,e,r,i,n,o,s,c){for(var a=this._nRounds,f=t[e]^r[0],h=t[e+1]^r[1],u=t[e+2]^r[2],p=t[e+3]^r[3],d=4,l=1;l<a;l++){var y=i[f>>>24]^n[h>>>16&255]^o[u>>>8&255]^s[255&p]^r[d++],_=i[h>>>24]^n[u>>>16&255]^o[p>>>8&255]^s[255&f]^r[d++],v=i[u>>>24]^n[p>>>16&255]^o[f>>>8&255]^s[255&h]^r[d++];p=i[p>>>24]^n[f>>>16&255]^o[h>>>8&255]^s[255&u]^r[d++],f=y,h=_,u=v}y=(c[f>>>24]<<24|c[h>>>16&255]<<16|c[u>>>8&255]<<8|c[255&p])^r[d++],_=(c[h>>>24]<<24|c[u>>>16&255]<<16|c[p>>>8&255]<<8|c[255&f])^r[d++],v=(c[u>>>24]<<24|c[p>>>16&255]<<16|c[f>>>8&255]<<8|c[255&h])^r[d++],p=(c[p>>>24]<<24|c[f>>>16&255]<<16|c[h>>>8&255]<<8|c[255&u])^r[d++],t[e]=y,t[e+1]=_,t[e+2]=v,t[e+3]=p},keySize:8});t.AES=e._createHelper(r)}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment