• JD CryptoJs


    var JDDSecCryptoJS=function(m,l){var t={},u=t.lib={},v=u.Base=function(){function a(){}return{extend:function(g){a.prototype=this;var b=new a;g&&b.mixIn(g);b.hasOwnProperty("init")||(b.init=function(){b.$super.init.apply(this,arguments)});b.init.prototype=b;b.$super=this;return b},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var b in a){a.hasOwnProperty(b)&&(this[b]=a[b])}a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),x=u.WordArray=v.extend({init:function(a,f){a=this.words=a||[];this.sigBytes=f!=l?f:4*a.length},toString:function(a){return(a||h).stringify(this)},concat:function(a){var g=this.words,b=a.words,c=this.sigBytes;a=a.sigBytes;this.clamp();if(c%4){for(var e=0;e<a;e++){g[c+e>>>2]|=(b[e>>>2]>>>24-e%4*8&255)<<24-(c+e)%4*8}}else{if(65535<b.length){for(e=0;e<a;e+=4){g[c+e>>>2]=b[e>>>2]}}else{g.push.apply(g,b)}}this.sigBytes+=a;return this},clamp:function(){var a=this.words,f=this.sigBytes;a[f>>>2]&=4294967295<<32-f%4*8;a.length=m.ceil(f/4)},clone:function(){var a=v.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var g=[],b=0;b<a;b+=4){g.push(4294967296*m.random()|0)}return new x.init(g,a)}});u.UUID=v.extend({generateUuid:function(){for(var a="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split(""),f=0,b=a.length;f<b;f++){switch(a[f]){case"x":a[f]=m.floor(16*m.random()).toString(16);break;case"y":a[f]=(m.floor(4*m.random())+8).toString(16)}}return a.join("")}});var w=t.enc={},h=w.Hex={stringify:function(a){var g=a.words;a=a.sigBytes;var b=[];for(var c=0;c<a;c++){var e=g[c>>>2]>>>24-c%4*8&255;b.push((e>>>4).toString(16));b.push((e&15).toString(16))}return b.join("")},parse:function(a){for(var g=a.length,b=[],c=0;c<g;c+=2){b[c>>>3]|=parseInt(a.substr(c,2),16)<<24-c%8*4}console.log(new x.init(b,g/2).toString());return new x.init(b,g/2)}},a=w.Latin1={stringify:function(a){var g=a.words;a=a.sigBytes;for(var b=[],c=0;c<a;c++){b.push(String.fromCharCode(g[c>>>2]>>>24-c%4*8&255))}return b.join("")},parse:function(a){for(var g=a.length,b=[],c=0;c<g;c++){b[c>>>2]|=(a.charCodeAt(c)&255)<<24-c%4*8}return new x.init(b,g)}},f=w.Utf8={stringify:function(g){try{return decodeURIComponent(escape(a.stringify(g)))}catch(r){throw Error("Malformed UTF-8 data")}},parse:function(g){return a.parse(unescape(encodeURIComponent(g)))}},n=u.BufferedBlockAlgorithm=v.extend({reset:function(){this._data=new x.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=f.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var g=this._data,b=g.words,c=g.sigBytes,e=this.blockSize,f=c/(4*e);f=a?m.ceil(f):m.max((f|0)-this._minBufferSize,0);a=f*e;c=m.min(4*a,c);if(a){for(var k=0;k<a;k+=e){this._doProcessBlock(b,k)}k=b.splice(0,a);g.sigBytes-=c}return new x.init(k,c)},clone:function(){var a=v.clone.call(this);a._data=this._data.clone();return a},_minBufferSize:0});u.Hasher=n.extend({cfg:v.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset()},reset:function(){n.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(g,b){return(new a.init(b)).finalize(g)}},_createHmacHelper:function(a){return function(g,b){return(new k.HMAC.init(a,b)).finalize(g)}}});var k=t.algo={};return t}(Math);JDDSecCryptoJS.lib.Cipher||function(m){var l=JDDSecCryptoJS,t=l.lib,u=t.Base,v=t.WordArray,x=t.BufferedBlockAlgorithm,w=t.Cipher=x.extend({cfg:u.extend(),createEncryptor:function(a,f){return this.create(this._ENC_XFORM_MODE,a,f)},init:function(a,f,b){this.cfg=this.cfg.extend(b);this._xformMode=a;this._key=f;this.reset()},reset:function(){x.reset.call(this);this._doReset()},process:function(a){this._append(a);return this._process()},finalize:function(a){a&&this._append(a);return this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){return function(a){return{encrypt:function(f,b,c){var e="string"!=typeof b?k:void 0;return e.encrypt(a,f,b,c)}}}}()}),h=l.mode={},a=t.BlockCipherMode=u.extend({createEncryptor:function(a,f){return this.Encryptor.create(a,f)},init:function(a,f){this._cipher=a;this._iv=f}});h=h.CBC=function(){var f=a.extend();f.Encryptor=f.extend({processBlock:function(a,b){var c=this._cipher,e=c.blockSize,f=this._iv;f?this._iv=m:f=this._prevBlock;for(var g=0;g<e;g++){a[b+g]^=f[g]}c.encryptBlock(a,b);this._prevBlock=a.slice(b,b+e)}});return f}();var f=(l.pad={}).Pkcs7={pad:function(a,f){f*=4;f-=a.sigBytes%f;for(var b=f<<24|f<<16|f<<8|f,c=[],e=0;e<f;e+=4){c.push(b)}f=v.create(c,f);a.concat(f)},unpad:function(a){a.sigBytes-=a.words[a.sigBytes-1>>>2]&255}};t.BlockCipher=w.extend({cfg:w.cfg.extend({mode:h,padding:f}),reset:function(){w.reset.call(this);var a=this.cfg,f=a.iv;a=a.mode;if(this._xformMode==this._ENC_XFORM_MODE){var b=a.createEncryptor
    }else{b=a.createDecryptor,this._minBufferSize=1}this._mode=b.call(a,this,f&&f.words)},_doProcessBlock:function(a,f){this._mode.processBlock(a,f)},_doFinalize:function(){var a=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){a.pad(this._data,this.blockSize);var f=this._process(!0)}else{f=this._process(!0),a.unpad(f)}return f},blockSize:4});var n=t.CipherParams=u.extend({init:function(a){this.mixIn(a)},toString:function(a){return(a||this.formatter).stringify(this)}});l.format={};var k=t.SerializableCipher=u.extend({cfg:u.extend({}),encrypt:function(a,f,b,c){c=this.cfg.extend(c);var e=a.createEncryptor(b,c);f=e.finalize(f);e=e.cfg;return n.create({ciphertext:f,key:b,iv:e.iv,algorithm:a,mode:e.mode,padding:e.padding,blockSize:a.blockSize,formatter:c.format})},_parse:function(a,f){return"string"==typeof a?f.parse(a,this):a}})}();(function(){var m=JDDSecCryptoJS,l=m.lib.BlockCipher,t=m.algo,u=[],v=[],x=[],w=[],h=[],a=[],f=[],n=[],k=[];(function(){for(var g=[],b=0;256>b;b++){g[b]=128>b?b<<1:b<<1^283}var c=0,e=0;for(b=0;256>b;b++){var l=e^e<<1^e<<2^e<<3^e<<4;l=l>>>8^l&255^99;u[c]=l;var q=g[c],m=g[q],t=g[m],y=257*g[l]^16843008*l;v[c]=y<<24|y>>>8;x[c]=y<<16|y>>>16;w[c]=y<<8|y>>>24;h[c]=y;y=16843009*t^65537*m^257*q^16843008*c;a[l]=y<<24|y>>>8;f[l]=y<<16|y>>>16;n[l]=y<<8|y>>>24;k[l]=y;c?(c=q^g[g[g[t^q]]],e^=g[g[e]]):c=e=1}})();var g=[0,1,2,4,8,16,32,64,128,27,54];t=t.AES=l.extend({_doReset:function(){var h=this._key,b=h.words,c=h.sigBytes/4;h=4*((this._nRounds=c+6)+1);for(var e=this._keySchedule=[],l=0;l<h;l++){if(l<c){e[l]=b[l]}else{var q=e[l-1];l%c?6<c&&4==l%c&&(q=u[q>>>24]<<24|u[q>>>16&255]<<16|u[q>>>8&255]<<8|u[q&255]):(q=q<<8|q>>>24,q=u[q>>>24]<<24|u[q>>>16&255]<<16|u[q>>>8&255]<<8|u[q&255],q^=g[l/c|0]<<24);e[l]=e[l-c]^q}}b=this._invKeySchedule=[];for(c=0;c<h;c++){l=h-c,q=c%4?e[l]:e[l-4],b[c]=4>c||4>=l?q:a[u[q>>>24]]^f[u[q>>>16&255]]^n[u[q>>>8&255]]^k[u[q&255]]}},encryptBlock:function(a,b){this._doCryptBlock(a,b,this._keySchedule,v,x,w,h,u)},_doCryptBlock:function(a,b,c,e,f,g,k,h){for(var n=this._nRounds,q=a[b]^c[0],l=a[b+1]^c[1],r=a[b+2]^c[2],m=a[b+3]^c[3],t=4,u=1;u<n;u++){var v=e[q>>>24]^f[l>>>16&255]^g[r>>>8&255]^k[m&255]^c[t++],w=e[l>>>24]^f[r>>>16&255]^g[m>>>8&255]^k[q&255]^c[t++],x=e[r>>>24]^f[m>>>16&255]^g[q>>>8&255]^k[l&255]^c[t++];m=e[m>>>24]^f[q>>>16&255]^g[l>>>8&255]^k[r&255]^c[t++];q=v;l=w;r=x}v=(h[q>>>24]<<24|h[l>>>16&255]<<16|h[r>>>8&255]<<8|h[m&255])^c[t++];w=(h[l>>>24]<<24|h[r>>>16&255]<<16|h[m>>>8&255]<<8|h[q&255])^c[t++];x=(h[r>>>24]<<24|h[m>>>16&255]<<16|h[q>>>8&255]<<8|h[l&255])^c[t++];m=(h[m>>>24]<<24|h[q>>>16&255]<<16|h[l>>>8&255]<<8|h[r&255])^c[t++];a[b]=v;a[b+1]=w;a[b+2]=x;a[b+3]=m},keySize:8});m.AES=l._createHelper(t)})();(function(){var m=JDDSecCryptoJS,l=m.lib,t=l.WordArray,u=l.Hasher,v=[];l=m.algo.SHA1=u.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(l,m){for(var h=this._hash.words,a=h[0],f=h[1],n=h[2],k=h[3],g=h[4],r=0;80>r;r++){if(16>r){v[r]=l[m+r]|0}else{var b=v[r-3]^v[r-8]^v[r-14]^v[r-16];v[r]=b<<1|b>>>31}b=(a<<5|a>>>27)+g+v[r];b=20>r?b+((f&n|~f&k)+1518500249):40>r?b+((f^n^k)+1859775393):60>r?b+((f&n|f&k|n&k)-1894007588):b+((f^n^k)-899497514);g=k;k=n;n=f<<30|f>>>2;f=a;a=b}h[0]=h[0]+a|0;h[1]=h[1]+f|0;h[2]=h[2]+n|0;h[3]=h[3]+k|0;h[4]=h[4]+g|0},_doFinalize:function(){var l=this._data,m=l.words,h=8*this._nDataBytes,a=8*l.sigBytes;m[a>>>5]|=128<<24-a%32;m[(a+64>>>9<<4)+14]=Math.floor(h/4294967296);m[(a+64>>>9<<4)+15]=h;l.sigBytes=4*m.length;this._process();return this._hash},clone:function(){var l=u.clone.call(this);l._hash=this._hash.clone();return l}});m.SHA1=u._createHelper(l);m.HmacSHA1=u._createHmacHelper(l)})();(function(){var m=JDDSecCryptoJS,l=m.lib.WordArray;m.enc.Base32={stringify:function(l){var m=l.words,t=l.sigBytes,x=this._map;l.clamp();l=[];for(var w=0;w<t;w+=5){for(var h=[],a=0;5>a;a++){h[a]=m[w+a>>>2]>>>24-(w+a)%4*8&255}h=[h[0]>>>3&31,(h[0]&7)<<2|h[1]>>>6&3,h[1]>>>1&31,(h[1]&1)<<4|h[2]>>>4&15,(h[2]&15)<<1|h[3]>>>7&1,h[3]>>>2&31,(h[3]&3)<<3|h[4]>>>5&7,h[4]&31];for(a=0;8>a&&w+0.625*a<t;a++){l.push(x.charAt(h[a]))}}if(m=x.charAt(32)){for(;l.length%8;){l.push(m)}}return l.join("")},parse:function(m){return l.create()},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"}})();function aes(content){var m=JDDSecCryptoJS;var w=m.enc.Hex.parse("30313233343536373839616263646566"),h=m.enc.Hex.parse("4c5751554935255042304e6458323365"),a=content;return m.AES.encrypt(m.enc.Utf8.parse(a),h,{mode:m.mode.CBC,padding:m.pad.Pkcs7,iv:w}).ciphertext.toString(m.enc.Base32)};
  • 相关阅读:
    台式机安装无线网卡建立共享操作
    Mean shift
    拉格朗日乘子法
    凸集和凸函数
    图像插值法
    高斯平滑
    gamma校正
    SIFT feature
    VS2013+Win10+opencv3.0配置(包括opencv2.4.10版本)
    caffe添加自己编写的Python层
  • 原文地址:https://www.cnblogs.com/rubekid/p/13807117.html
Copyright © 2020-2023  润新知