当前位置 : 主页 > 网络安全 > 测试自动化 >

Postman接口自动化测试实例用到的完整的SM2前端加密算法代码

来源:互联网 收集:自由互联 发布时间:2021-06-19
var __g__ = {};!function(t,e){"object"==typeof exports?module.exports=exports=e():"function"==typeof definedefine.amd?define([],e):t.KeyouCryptography=e()}(__g__,function(){function t(e,i,r){if(!(this instanceof t))return new t(e,i,r);null!
var __g__ = {};
!function(t,e){"object"==typeof exports?module.exports=exports=e():"function"==typeof define&&define.amd?define([],e):t.KeyouCryptography=e()}(__g__,function(){function t(e,i,r){if(!(this instanceof t))return new t(e,i,r);null!=e&&("number"==typeof e?this.fromNumber(e,i,r):null==i&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,i))}function e(t){return k.charAt(t)}function i(t,e){var i=U[t.charCodeAt(e)];return null==i?-1:i}function r(e){var i=new t;return i.fromInt(e),i}function n(t){var e,i=1;return 0!=(e=t>>>16)&&(t=e,i+=16),0!=(e=t>>8)&&(t=e,i+=8),0!=(e=t>>4)&&(t=e,i+=4),0!=(e=t>>2)&&(t=e,i+=2),0!=(e=t>>1)&&(t=e,i+=1),i}function s(t){this.m=t}function o(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function h(t,e){return t&e}function a(t,e){return t|e}function u(t,e){return t^e}function F(t,e){return t&~e}function c(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function f(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function l(){}function p(t){return t}function g(e){this.r2=new t,this.q3=new t,t.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function d(){this.i=0,this.j=0,this.S=new Array}function y(){return new d}function m(t){N[P++]^=255&t,N[P++]^=t>>8&255,N[P++]^=t>>16&255,N[P++]^=t>>24&255,P>=O&&(P-=O)}function B(){m((new Date).getTime())}function A(){if(null==M){for(B(),(M=y()).init(N),P=0;P<N.length;++P)N[P]=0;P=0}return M.next()}function S(){}function E(t,e){this.x=e,this.q=t}function w(e,i,r,n){this.curve=e,this.x=i,this.y=r,this.z=null==n?t.ONE:n,this.zinv=null}function D(t,e,i){this.q=t,this.a=this.fromBigInteger(e),this.b=this.fromBigInteger(i),this.infinity=new w(this,null,null)}function x(){this.BYTE_LENGTH=64,this.xBuf=new Array,this.xBufOff=0,this.byteCount=0,this.DIGEST_LENGTH=32,this.v0=[1937774191,1226093241,388252375,3666478592,2842636476,372324522,3817729613,2969243214],this.v0=[1937774191,1226093241,388252375,-628488704,-1452330820,372324522,-477237683,-1325724082],this.v=new Array(8),this.v_=new Array(8),this.X0=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.X=new Array(68),this.xOff=0,this.T_00_15=2043430169,this.T_16_63=2055708042,arguments.length>0?this.InitDigest(arguments[0]):this.Init()}var C=C||function(t){var e={};return e.util={},e.algorithm={},e}();C.util.Checker={name:"Checker",checkOnlyPrintChar:function(t){return/^[\u0020-\u007E]+$/.test(t)},checkHasChinese:function(t){return/.*[\u2E80-\u9FFF]+.*$/.test(t)},checkArgument:function(t,e){if(!t)throw new TypeError("Illegal Argument:"+e)},checkExist:function(t,e){if(void 0===typeof t||null===t)throw new TypeError("object is undefined or object is null. "+e);return t},checkNotEmpty:function(t,e){if(void 0===typeof t||null===t)throw new TypeError("object is empty."+e);if(void 0!==typeof t.length&&0===t.length)throw new TypeError("object is empty."+e);return t},checkState:function(t,e){if(!t)throw new Error("Illegal State:"+e)}},function(){var t=C.util,e=t.Checker;t.Hex={name:"Hex",stringify:function(t){for(var e=[],i=t.length,r=0;r<i;r++){var n=t[r];e.push((n>>>4).toString(16)),e.push((15&n).toString(16))}return e.join("").toUpperCase()},parse:function(t){var i=[];e.checkArgument(void 0!=t&&t.length%2==0,"illegal Hex string:"+t);var r=new RegExp("[A-Fa-f0-9]+$","g");e.checkArgument(t.match(r),"illegal Hex string:"+t);for(var n=t.length/2,s=0;s<n;s++)i[s]=parseInt(t.substr(2*s,2),16);return i}}}(),C.util.UTF8={stringify:function(t){for(var e,i=t,r="",n=0;n<i.length;)(e=i[n])<192?n+=1:e<224?(e=(31&i[n])<<6|63&i[n+1],n+=2):e<240?(e=(15&i[n])<<12|(63&i[n+1])<<6|63&i[n+2],n+=3):e<248&&(e=(7&i[n])<<18|(63&i[n+1])<<12|(63&i[n+2])<<6|63&i[n+3],n+=4),r+=String.fromCharCode(e);return r},parse:function(t){for(var e,i=new Array,r=0;r<t.length;r++)(e=t.charCodeAt(r))<128?i.push(e):e<2048?(i.push(e>>>6&31|192),i.push(63&e|128)):e<65536?(i.push(e>>>12&15|224),i.push(e>>>6&63|128),i.push(63&e|128)):e<2097152&&(i.push(e>>>18&7|240),i.push(e>>>12&63|128),i.push(e>>>6&63|128),i.push(63&e|128));return i}},function(){var t=C.util,e=C.util.Checker;t.Helper=function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=function(t){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t)};return{getRandom:function(t){e.checkArgument(t>0,"the random of size must be more than zero.");for(var i,r=new Array(t),n=0;n<t;n++)i=987654071*function(t){var t=t,e=987654321,i=4294967295;return function(){var r=((e=36969*(65535&e)+(e>>16)&i)<<16)+(t=18e3*(65535&t)+(t>>16)&i)&i;return r/=4294967296,(r+=.5)*(Math.random()>.5?1:-1)}}(4294967296*(i||Math.random()))(),r[n]=255&i;return r},array2ascstr:function(t){for(var i="",r=0,n=t.length;r<n;r++)e.checkArgument(t[r]>=32&&t[r]<=126,"contains Non-printable ASCII Character in Array"),i+=String.fromCharCode(t[r]);return i},ascstr2array:function(t){if(0===t.length)return[];e.checkArgument(e.checkOnlyPrintChar(t),"only support printable ASCII character.");for(var i=new Array(t.length),r=0,n=t.length;r<n;r++)i[r]=t.charCodeAt(r);return i},hex2b64:function(e){var i,r,n="";for(i=0;i+3<=e.length;i+=3)r=parseInt(e.substring(i,i+3),16),n+=t.charAt(r>>6)+t.charAt(63&r);for(i+1==e.length?(r=parseInt(e.substring(i,i+1),16),n+=t.charAt(r<<2)):i+2==e.length&&(r=parseInt(e.substring(i,i+2),16),n+=t.charAt(r>>2)+t.charAt((3&r)<<4));(3&n.length)>0;)n+="=";return n},b64tohex:function(e){var r,n,s="",o=0;for(r=0;r<e.length&&"="!=e.charAt(r);++r)v=t.indexOf(e.charAt(r)),v<0||(0==o?(s+=i(v>>2),n=3&v,o=1):1==o?(s+=i(n<<2|v>>4),n=15&v,o=2):2==o?(s+=i(n),s+=i(v>>2),n=3&v,o=3):(s+=i(n<<2|v>>4),s+=i(15&v),o=0));return 1==o&&(s+=i(n<<2)),s}}}()}(),C.util.DataPadding={encodeWithNone:function(t,e){return t},decodeWithNone:function(t){return t},encodeWithPKCS5:function(t,e){for(var i=e-t.length%e,r=new Array(t.length+i),n=0;n<t.length;n++)r[n]=t[n];for(n=t.length;n<i+t.length;n++)r[n]=i;return r},decodeWithPKCS5:function(t){var e=t[t.length-1];return t.slice(0,t.length-e)},encodeWith0x00:function(t,e){for(var i=e-t.length%e,r=new Array(t.length+i),n=0;n<t.length;n++)r[n]=t[n];for(n=t.length;n<i+t.length;n++)r[n]=0;return r},decodeWith0x00:function(t){for(var e=0,i=t.length-1;i>=0;i--)if(0!=t[i]){e=i+1;break}return t.slice(0,e)},encodeWith0x80:function(t,e){for(var i=e-t.length%e,r=new Array(t.length+i),n=0;n<t.length;n++)r[n]=t[n];r[t.length]=128;for(n=t.length+1;n<i+t.length;n++)r[n]=0;return r},decodeWith0x80:function(t){for(var e=0,i=t.length-1;i>=0;i--)if(0!=t[i]&&128!=t[i]){e=i+1;break}return t.slice(0,e)},encodeWithLV0:function(t,e){},decodeWithLV0:function(t){}};var b=b||function(t,e){var i={},r=i.lib={},n=r.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var i=new t;return e&&i.mixIn(e),i.hasOwnProperty("init")||(i.init=function(){i.$super.init.apply(this,arguments)}),i.init.prototype=i,i.$super=this,i},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)}}}(),s=r.WordArray=n.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=void 0!=e?e:4*t.length},toString:function(t){return(t||h).stringify(this)},concat:function(t){var e=this.words,i=t.words,r=this.sigBytes,n=t.sigBytes;if(this.clamp(),r%4)for(o=0;o<n;o++){var s=i[o>>>2]>>>24-o%4*8&255;e[r+o>>>2]|=s<<24-(r+o)%4*8}else if(i.length>65535)for(var o=0;o<n;o+=4)e[r+o>>>2]=i[o>>>2];else e.push.apply(e,i);return this.sigBytes+=n,this},clamp:function(){var e=this.words,i=this.sigBytes;e[i>>>2]&=4294967295<<32-i%4*8,e.length=t.ceil(i/4)},clone:function(){var t=n.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var i=[],r=0;r<e;r+=4)i.push(4294967296*t.random()|0);return new s.init(i,e)}}),o=i.enc={},h=o.Hex={stringify:function(t){for(var e=t.words,i=t.sigBytes,r=[],n=0;n<i;n++){var s=e[n>>>2]>>>24-n%4*8&255;r.push((s>>>4).toString(16)),r.push((15&s).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,i=[],r=0;r<e;r+=2)i[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new s.init(i,e/2)}},a=o.Latin1={stringify:function(t){for(var e=t.words,i=t.sigBytes,r=[],n=0;n<i;n++){var s=e[n>>>2]>>>24-n%4*8&255;r.push(String.fromCharCode(s))}return r.join("")},parse:function(t){for(var e=t.length,i=[],r=0;r<e;r++)i[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new s.init(i,e)}},u=o.Utf8={stringify:function(t){try{return decodeURIComponent(escape(a.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return a.parse(unescape(encodeURIComponent(t)))}},F=r.BufferedBlockAlgorithm=n.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=u.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var i=this._data,r=i.words,n=i.sigBytes,o=this.blockSize,h=n/(4*o),a=(h=e?t.ceil(h):t.max((0|h)-this._minBufferSize,0))*o,u=t.min(4*a,n);if(a){for(var F=0;F<a;F+=o)this._doProcessBlock(r,F);var c=r.splice(0,a);i.sigBytes-=u}return new s.init(c,u)},clone:function(){var t=n.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),c=(r.Hasher=F.extend({cfg:n.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){F.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(t){return function(e,i){return new t.init(i).finalize(e)}},_createHmacHelper:function(t){return function(e,i){return new c.HMAC.init(t,i).finalize(e)}}}),i.algo={});return i}(Math);b.lib.Cipher||function(t){var e=b,i=e.lib,r=i.Base,n=i.WordArray,s=i.BufferedBlockAlgorithm,o=e.enc,h=(o.Utf8,o.Base64),a=e.algo.EvpKDF,u=i.Cipher=s.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,i){this.cfg=this.cfg.extend(i),this._xformMode=t,this._key=e,this.reset()},reset:function(){s.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(){function t(t){return"string"==typeof t?y:d}return function(e){return{encrypt:function(i,r,n){return t(r).encrypt(e,i,r,n)},decrypt:function(i,r,n){return t(r).decrypt(e,i,r,n)}}}}()}),F=(i.StreamCipher=u.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),e.mode={}),c=i.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}}),f=F.CBC=function(){function e(e,i,r){var n=this._iv;if(n){s=n;this._iv=t}else var s=this._prevBlock;for(var o=0;o<r;o++)e[i+o]^=s[o]}var i=c.extend();return i.Encryptor=i.extend({processBlock:function(t,i){var r=this._cipher,n=r.blockSize;e.call(this,t,i,n),r.encryptBlock(t,i),this._prevBlock=t.slice(i,i+n)}}),i.Decryptor=i.extend({processBlock:function(t,i){var r=this._cipher,n=r.blockSize,s=t.slice(i,i+n);r.decryptBlock(t,i),e.call(this,t,i,n),this._prevBlock=s}}),i}(),l=(e.pad={}).Pkcs7={pad:function(t,e){for(var i=4*e,r=i-t.sigBytes%i,s=r<<24|r<<16|r<<8|r,o=[],h=0;h<r;h+=4)o.push(s);var a=n.create(o,r);t.concat(a)},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},p=(i.BlockCipher=u.extend({cfg:u.cfg.extend({mode:f,padding:l}),reset:function(){u.reset.call(this);var t=this.cfg,e=t.iv,i=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)r=i.createEncryptor;else{var r=i.createDecryptor;this._minBufferSize=1}this._mode=r.call(i,this,e&&e.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);e=this._process(!0)}else{var e=this._process(!0);t.unpad(e)}return e},blockSize:4}),i.CipherParams=r.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}})),g=(e.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,i=t.salt;if(i)r=n.create([1398893684,1701076831]).concat(i).concat(e);else var r=e;return r.toString(h)},parse:function(t){var e=h.parse(t),i=e.words;if(1398893684==i[0]&&1701076831==i[1]){var r=n.create(i.slice(2,4));i.splice(0,4),e.sigBytes-=16}return p.create({ciphertext:e,salt:r})}},d=i.SerializableCipher=r.extend({cfg:r.extend({format:g}),encrypt:function(t,e,i,r){r=this.cfg.extend(r);var n=t.createEncryptor(i,r),s=n.finalize(e),o=n.cfg;return p.create({ciphertext:s,key:i,iv:o.iv,algorithm:t,mode:o.mode,padding:o.padding,blockSize:t.blockSize,formatter:r.format})},decrypt:function(t,e,i,r){return r=this.cfg.extend(r),e=this._parse(e,r.format),t.createDecryptor(i,r).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),v=(e.kdf={}).OpenSSL={execute:function(t,e,i,r){r||(r=n.random(8));var s=a.create({keySize:e+i}).compute(t,r),o=n.create(s.words.slice(e),4*i);return s.sigBytes=4*e,p.create({key:s,iv:o,salt:r})}},y=i.PasswordBasedCipher=d.extend({cfg:d.cfg.extend({kdf:v}),encrypt:function(t,e,i,r){var n=(r=this.cfg.extend(r)).kdf.execute(i,t.keySize,t.ivSize);r.iv=n.iv;var s=d.encrypt.call(this,t,e,n.key,r);return s.mixIn(n),s},decrypt:function(t,e,i,r){r=this.cfg.extend(r),e=this._parse(e,r.format);var n=r.kdf.execute(i,t.keySize,t.ivSize,e.salt);return r.iv=n.iv,d.decrypt.call(this,t,e,n.key,r)}})}(),function(){function t(t,e){var i=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=i,this._lBlock^=i<<t}function e(t,e){var i=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=i,this._rBlock^=i<<t}var i=b,r=i.lib,n=r.WordArray,s=r.BlockCipher,o=i.algo,h=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],F=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],f=o.DES=s.extend({_doReset:function(){for(var t=this._key.words,e=[],i=0;i<56;i++){var r=h[i]-1;e[i]=t[r>>>5]>>>31-r%32&1}for(var n=this._subKeys=[],s=0;s<16;s++){for(var o=n[s]=[],F=u[s],i=0;i<24;i++)o[i/6|0]|=e[(a[i]-1+F)%28]<<31-i%6,o[4+(i/6|0)]|=e[28+(a[i+24]-1+F)%28]<<31-i%6;o[0]=o[0]<<1|o[0]>>>31;for(i=1;i<7;i++)o[i]=o[i]>>>4*(i-1)+3;o[7]=o[7]<<5|o[7]>>>27}for(var c=this._invSubKeys=[],i=0;i<16;i++)c[i]=n[15-i]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(i,r,n){this._lBlock=i[r],this._rBlock=i[r+1],t.call(this,4,252645135),t.call(this,16,65535),e.call(this,2,858993459),e.call(this,8,16711935),t.call(this,1,1431655765);for(var s=0;s<16;s++){for(var o=n[s],h=this._lBlock,a=this._rBlock,u=0,f=0;f<8;f++)u|=F[f][((a^o[f])&c[f])>>>0];this._lBlock=a,this._rBlock=h^u}var l=this._lBlock;this._lBlock=this._rBlock,this._rBlock=l,t.call(this,1,1431655765),e.call(this,8,16711935),e.call(this,2,858993459),t.call(this,16,65535),t.call(this,4,252645135),i[r]=this._lBlock,i[r+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});i.DES=s._createHelper(f);var l=o.TripleDES=s.extend({_doReset:function(){var t=this._key.words;this._des1=f.createEncryptor(n.create(t.slice(0,2))),this._des2=f.createEncryptor(n.create(t.slice(2,4))),this._des3=f.createEncryptor(n.create(t.slice(4,6)))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2});i.TripleDES=s._createHelper(l)}(),function(){var t=b,e=t.lib.WordArray;t.enc.Base64={stringify:function(t){var e=t.words,i=t.sigBytes,r=this._map;t.clamp();for(var n=[],s=0;s<i;s+=3)for(var o=(e[s>>>2]>>>24-s%4*8&255)<<16|(e[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|e[s+2>>>2]>>>24-(s+2)%4*8&255,h=0;h<4&&s+.75*h<i;h++)n.push(r.charAt(o>>>6*(3-h)&63));var a=r.charAt(64);if(a)for(;n.length%4;)n.push(a);return n.join("")},parse:function(t){var i=t.length,r=this._map,n=r.charAt(64);if(n){var s=t.indexOf(n);-1!=s&&(i=s)}for(var o=[],h=0,a=0;a<i;a++)if(a%4){var u=r.indexOf(t.charAt(a-1))<<a%4*2,F=r.indexOf(t.charAt(a))>>>6-a%4*2;o[h>>>2]|=(u|F)<<24-h%4*8,h++}return e.create(o,h)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}();var R=t.prototype;t.prototype.am=function(t,e,i,r,n,s){for(;--s>=0;){var o=e*this[t++]+i[r]+n;n=Math.floor(o/67108864),i[r++]=67108863&o}return n},t.prototype.DB=26,t.prototype.DM=67108863;var T=t.prototype.DV=1<<26;t.prototype.FV=Math.pow(2,52),t.prototype.F1=26,t.prototype.F2=0;var I,H,k="0123456789abcdefghijklmnopqrstuvwxyz",U=new Array;for(I="0".charCodeAt(0),H=0;H<=9;++H)U[I++]=H;for(I="a".charCodeAt(0),H=10;H<36;++H)U[I++]=H;for(I="A".charCodeAt(0),H=10;H<36;++H)U[I++]=H;s.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},s.prototype.revert=function(t){return t},s.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},s.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},s.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},o.prototype.convert=function(e){var i=new t;return e.abs().dlShiftTo(this.m.t,i),i.divRemTo(this.m,null,i),e.s<0&&i.compareTo(t.ZERO)>0&&this.m.subTo(i,i),i},o.prototype.revert=function(e){var i=new t;return e.copyTo(i),this.reduce(i),i},o.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var i=32767&t[e],r=i*this.mpl+((i*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[i=e+this.m.t]+=this.m.am(0,r,t,e,0,this.m.t);t[i]>=t.DV;)t[i]-=t.DV,t[++i]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},o.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},o.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},R.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},R.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+T:this.t=0},R.fromString=function(e,r){var n,s=this;if(16==r)n=4;else if(8==r)n=3;else if(256==r)n=8;else if(2==r)n=1;else if(32==r)n=5;else{if(4!=r)return void s.fromRadix(e,r);n=2}s.t=0,s.s=0;for(var o=e.length,h=!1,a=0;--o>=0;){var u=8==n?255&e[o]:i(e,o);u<0?"-"==e.charAt(o)&&(h=!0):(h=!1,0==a?s[s.t++]=u:a+n>s.DB?(s[s.t-1]|=(u&(1<<s.DB-a)-1)<<a,s[s.t++]=u>>s.DB-a):s[s.t-1]|=u<<a,(a+=n)>=s.DB&&(a-=s.DB))}8==n&&0!=(128&e[0])&&(s.s=-1,a>0&&(s[s.t-1]|=(1<<s.DB-a)-1<<a)),s.clamp(),h&&t.ZERO.subTo(s,s)},R.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},R.dlShiftTo=function(t,e){var i;for(i=this.t-1;i>=0;--i)e[i+t]=this[i];for(i=t-1;i>=0;--i)e[i]=0;e.t=this.t+t,e.s=this.s},R.drShiftTo=function(t,e){for(var i=t;i<this.t;++i)e[i-t]=this[i];e.t=Math.max(this.t-t,0),e.s=this.s},R.lShiftTo=function(t,e){var i,r=this,n=t%r.DB,s=r.DB-n,o=(1<<s)-1,h=Math.floor(t/r.DB),a=r.s<<n&r.DM;for(i=r.t-1;i>=0;--i)e[i+h+1]=r[i]>>s|a,a=(r[i]&o)<<n;for(i=h-1;i>=0;--i)e[i]=0;e[h]=a,e.t=r.t+h+1,e.s=r.s,e.clamp()},R.rShiftTo=function(t,e){var i=this;e.s=i.s;var r=Math.floor(t/i.DB);if(r>=i.t)e.t=0;else{var n=t%i.DB,s=i.DB-n,o=(1<<n)-1;e[0]=i[r]>>n;for(var h=r+1;h<i.t;++h)e[h-r-1]|=(i[h]&o)<<s,e[h-r]=i[h]>>n;n>0&&(e[i.t-r-1]|=(i.s&o)<<s),e.t=i.t-r,e.clamp()}},R.subTo=function(t,e){for(var i=this,r=0,n=0,s=Math.min(t.t,i.t);r<s;)n+=i[r]-t[r],e[r++]=n&i.DM,n>>=i.DB;if(t.t<i.t){for(n-=t.s;r<i.t;)n+=i[r],e[r++]=n&i.DM,n>>=i.DB;n+=i.s}else{for(n+=i.s;r<t.t;)n-=t[r],e[r++]=n&i.DM,n>>=i.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[r++]=i.DV+n:n>0&&(e[r++]=n),e.t=r,e.clamp()},R.multiplyTo=function(e,i){var r=this.abs(),n=e.abs(),s=r.t;for(i.t=s+n.t;--s>=0;)i[s]=0;for(s=0;s<n.t;++s)i[s+r.t]=r.am(0,n[s],i,s,0,r.t);i.s=0,i.clamp(),this.s!=e.s&&t.ZERO.subTo(i,i)},R.squareTo=function(t){for(var e=this.abs(),i=t.t=2*e.t;--i>=0;)t[i]=0;for(i=0;i<e.t-1;++i){var r=e.am(i,e[i],t,2*i,0,1);(t[i+e.t]+=e.am(i+1,2*e[i],t,2*i+1,r,e.t-i-1))>=e.DV&&(t[i+e.t]-=e.DV,t[i+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(i,e[i],t,2*i,0,1)),t.s=0,t.clamp()},R.divRemTo=function(e,i,r){var s=this,o=e.abs();if(!(o.t<=0)){var h=s.abs();if(h.t<o.t)return null!=i&&i.fromInt(0),void(null!=r&&s.copyTo(r));null==r&&(r=new t);var a=new t,u=s.s,F=e.s,c=s.DB-n(o[o.t-1]);c>0?(o.lShiftTo(c,a),h.lShiftTo(c,r)):(o.copyTo(a),h.copyTo(r));var f=a.t,l=a[f-1];if(0!=l){var p=l*(1<<s.F1)+(f>1?a[f-2]>>s.F2:0),g=s.FV/p,d=(1<<s.F1)/p,v=1<<s.F2,y=r.t,m=y-f,B=null==i?new t:i;for(a.dlShiftTo(m,B),r.compareTo(B)>=0&&(r[r.t++]=1,r.subTo(B,r)),t.ONE.dlShiftTo(f,B),B.subTo(a,a);a.t<f;)a[a.t++]=0;for(;--m>=0;){var A=r[--y]==l?s.DM:Math.floor(r[y]*g+(r[y-1]+v)*d);if((r[y]+=a.am(0,A,r,m,0,f))<A)for(a.dlShiftTo(m,B),r.subTo(B,r);r[y]<--A;)r.subTo(B,r)}null!=i&&(r.drShiftTo(f,i),u!=F&&t.ZERO.subTo(i,i)),r.t=f,r.clamp(),c>0&&r.rShiftTo(c,r),u<0&&t.ZERO.subTo(r,r)}}},R.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return e=e*(2-(15&t)*e)&15,e=e*(2-(255&t)*e)&255,e=e*(2-((65535&t)*e&65535))&65535,(e=e*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},R.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},R.exp=function(e,i){if(e>4294967295||e<1)return t.ONE;var r=new t,s=new t,o=i.convert(this),h=n(e)-1;for(o.copyTo(r);--h>=0;)if(i.sqrTo(r,s),(e&1<<h)>0)i.mulTo(s,o,r);else{var a=r;r=s,s=a}return i.revert(r)},R.toString=function(t){var i=this;if(i.s<0)return"-"+i.negate().toString(t);var r;if(16==t)r=4;else if(8==t)r=3;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return i.toRadix(t);r=2}var n,s=(1<<r)-1,o=!1,h="",a=i.t,u=i.DB-a*i.DB%r;if(a-- >0)for(u<i.DB&&(n=i[a]>>u)>0&&(o=!0,h=e(n));a>=0;)u<r?(n=(i[a]&(1<<u)-1)<<r-u,n|=i[--a]>>(u+=i.DB-r)):(n=i[a]>>(u-=r)&s,u<=0&&(u+=i.DB,--a)),n>0&&(o=!0),o&&(h+=e(n));return o?h:"0"},R.negate=function(){var e=new t;return t.ZERO.subTo(this,e),e},R.abs=function(){return this.s<0?this.negate():this},R.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var i=this.t;if(0!=(e=i-t.t))return this.s<0?-e:e;for(;--i>=0;)if(0!=(e=this[i]-t[i]))return e;return 0},R.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+n(this[this.t-1]^this.s&this.DM)},R.byteLength=function(){return this.bitLength()>>3},R.mod=function(e){var i=new t;return this.abs().divRemTo(e,null,i),this.s<0&&i.compareTo(t.ZERO)>0&&e.subTo(i,i),i},R.modPowInt=function(t,e){var i;return i=t<256||e.isEven()?new s(e):new o(e),this.exp(t,i)},t.ZERO=r(0),t.ONE=r(1),l.prototype.convert=p,l.prototype.revert=p,l.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i)},l.prototype.sqrTo=function(t,e){t.squareTo(e)},g.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var i=new t;return e.copyTo(i),this.reduce(i),i},g.prototype.revert=function(t){return t},g.prototype.reduce=function(t){var e=this;for(t.drShiftTo(e.m.t-1,e.r2),t.t>e.m.t+1&&(t.t=e.m.t+1,t.clamp()),e.mu.multiplyUpperTo(e.r2,e.m.t+1,e.q3),e.m.multiplyLowerTo(e.q3,e.m.t+1,e.r2);t.compareTo(e.r2)<0;)t.dAddOffset(1,e.m.t+1);for(t.subTo(e.r2,t);t.compareTo(e.m)>=0;)t.subTo(e.m,t)},g.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},g.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var K=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],_=(1<<26)/K[K.length-1];R.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},R.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var i=this.chunkSize(e),n=Math.pow(e,i),s=r(n),o=new t,h=new t,a="";for(this.divRemTo(s,o,h);o.signum()>0;)a=(n+h.intValue()).toString(e).substr(1)+a,o.divRemTo(s,o,h);return h.intValue().toString(e)+a},R.fromRadix=function(e,r){var n=this;n.fromInt(0),null==r&&(r=10);for(var s=n.chunkSize(r),o=Math.pow(r,s),h=!1,a=0,u=0,F=0;F<e.length;++F){var c=i(e,F);c<0?"-"==e.charAt(F)&&0==n.signum()&&(h=!0):(u=r*u+c,++a>=s&&(n.dMultiply(o),n.dAddOffset(u,0),a=0,u=0))}a>0&&(n.dMultiply(Math.pow(r,a)),n.dAddOffset(u,0)),h&&t.ZERO.subTo(n,n)},R.fromNumber=function(e,i,r){var n=this;if("number"==typeof i)if(e<2)n.fromInt(1);else for(n.fromNumber(e,r),n.testBit(e-1)||n.bitwiseTo(t.ONE.shiftLeft(e-1),a,n),n.isEven()&&n.dAddOffset(1,0);!n.isProbablePrime(i);)n.dAddOffset(2,0),n.bitLength()>e&&n.subTo(t.ONE.shiftLeft(e-1),n);else{var s=new Array,o=7&e;s.length=1+(e>>3),i.nextBytes(s),o>0?s[0]&=(1<<o)-1:s[0]=0,n.fromString(s,256)}},R.bitwiseTo=function(t,e,i){var r,n,s=this,o=Math.min(t.t,s.t);for(r=0;r<o;++r)i[r]=e(s[r],t[r]);if(t.t<s.t){for(n=t.s&s.DM,r=o;r<s.t;++r)i[r]=e(s[r],n);i.t=s.t}else{for(n=s.s&s.DM,r=o;r<t.t;++r)i[r]=e(n,t[r]);i.t=t.t}i.s=e(s.s,t.s),i.clamp()},R.changeBit=function(e,i){var r=t.ONE.shiftLeft(e);return this.bitwiseTo(r,i,r),r},R.addTo=function(t,e){for(var i=this,r=0,n=0,s=Math.min(t.t,i.t);r<s;)n+=i[r]+t[r],e[r++]=n&i.DM,n>>=i.DB;if(t.t<i.t){for(n+=t.s;r<i.t;)n+=i[r],e[r++]=n&i.DM,n>>=i.DB;n+=i.s}else{for(n+=i.s;r<t.t;)n+=t[r],e[r++]=n&i.DM,n>>=i.DB;n+=t.s}e.s=n<0?-1:0,n>0?e[r++]=n:n<-1&&(e[r++]=i.DV+n),e.t=r,e.clamp()},R.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},R.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},R.multiplyLowerTo=function(t,e,i){var r=Math.min(this.t+t.t,e);for(i.s=0,i.t=r;r>0;)i[--r]=0;var n;for(n=i.t-this.t;r<n;++r)i[r+this.t]=this.am(0,t[r],i,r,0,this.t);for(n=Math.min(t.t,e);r<n;++r)this.am(0,t[r],i,r,0,e-r);i.clamp()},R.multiplyUpperTo=function(t,e,i){--e;var r=i.t=this.t+t.t-e;for(i.s=0;--r>=0;)i[r]=0;for(r=Math.max(e-this.t,0);r<t.t;++r)i[this.t+r-e]=this.am(e-r,t[r],i,0,0,this.t+r-e);i.clamp(),i.drShiftTo(1,i)},R.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,i=this.s<0?t-1:0;if(this.t>0)if(0==e)i=this[0]%t;else for(var r=this.t-1;r>=0;--r)i=(e*i+this[r])%t;return i},R.millerRabin=function(e){var i=this.subtract(t.ONE),r=i.getLowestSetBit();if(r<=0)return!1;var n=i.shiftRight(r);(e=e+1>>1)>K.length&&(e=K.length);for(var s=new t(null),o=[],h=0;h<e;++h){for(;u=K[Math.floor(Math.random()*K.length)],-1!=o.indexOf(u););o.push(u),s.fromInt(u);var a=s.modPow(n,this);if(0!=a.compareTo(t.ONE)&&0!=a.compareTo(i)){for(var u=1;u++<r&&0!=a.compareTo(i);)if(0==(a=a.modPowInt(2,this)).compareTo(t.ONE))return!1;if(0!=a.compareTo(i))return!1}}return!0},R.clone=function(){var e=new t;return this.copyTo(e),e},R.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},R.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},R.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},R.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},R.toByteArray=function(){var t=this,e=t.t,i=new Array;i[0]=t.s;var r,n=t.DB-e*t.DB%8,s=0;if(e-- >0)for(n<t.DB&&(r=t[e]>>n)!=(t.s&t.DM)>>n&&(i[s++]=r|t.s<<t.DB-n);e>=0;)n<8?(r=(t[e]&(1<<n)-1)<<8-n,r|=t[--e]>>(n+=t.DB-8)):(r=t[e]>>(n-=8)&255,n<=0&&(n+=t.DB,--e)),0!=(128&r)&&(r|=-256),0===s&&(128&t.s)!=(128&r)&&++s,(s>0||r!=t.s)&&(i[s++]=r);return i},R.equals=function(t){return 0==this.compareTo(t)},R.min=function(t){return this.compareTo(t)<0?this:t},R.max=function(t){return this.compareTo(t)>0?this:t},R.and=function(e){var i=new t;return this.bitwiseTo(e,h,i),i},R.or=function(e){var i=new t;return this.bitwiseTo(e,a,i),i},R.xor=function(e){var i=new t;return this.bitwiseTo(e,u,i),i},R.andNot=function(e){var i=new t;return this.bitwiseTo(e,F,i),i},R.not=function(){for(var e=new t,i=0;i<this.t;++i)e[i]=this.DM&~this[i];return e.t=this.t,e.s=~this.s,e},R.shiftLeft=function(e){var i=new t;return e<0?this.rShiftTo(-e,i):this.lShiftTo(e,i),i},R.shiftRight=function(e){var i=new t;return e<0?this.lShiftTo(-e,i):this.rShiftTo(e,i),i},R.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+c(this[t]);return this.s<0?this.t*this.DB:-1},R.bitCount=function(){for(var t=0,e=this.s&this.DM,i=0;i<this.t;++i)t+=f(this[i]^e);return t},R.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:0!=(this[e]&1<<t%this.DB)},R.setBit=function(t){return this.changeBit(t,a)},R.clearBit=function(t){return this.changeBit(t,F)},R.flipBit=function(t){return this.changeBit(t,u)},R.add=function(e){var i=new t;return this.addTo(e,i),i},R.subtract=function(e){var i=new t;return this.subTo(e,i),i},R.multiply=function(e){var i=new t;return this.multiplyTo(e,i),i},R.divide=function(e){var i=new t;return this.divRemTo(e,i,null),i},R.remainder=function(e){var i=new t;return this.divRemTo(e,null,i),i},R.divideAndRemainder=function(e){var i=new t,r=new t;return this.divRemTo(e,i,r),new Array(i,r)},R.modPow=function(e,i){var h,a,u=e.bitLength(),F=r(1);if(u<=0)return F;h=u<18?1:u<48?3:u<144?4:u<768?5:6,a=u<8?new s(i):i.isEven()?new g(i):new o(i);var c=new Array,f=3,l=h-1,p=(1<<h)-1;if(c[1]=a.convert(this),h>1){var d=new t;for(a.sqrTo(c[1],d);f<=p;)c[f]=new t,a.mulTo(d,c[f-2],c[f]),f+=2}var v,y,m=e.t-1,B=!0,A=new t;for(u=n(e[m])-1;m>=0;){for(u>=l?v=e[m]>>u-l&p:(v=(e[m]&(1<<u+1)-1)<<l-u,m>0&&(v|=e[m-1]>>this.DB+u-l)),f=h;0==(1&v);)v>>=1,--f;if((u-=f)<0&&(u+=this.DB,--m),B)c[v].copyTo(F),B=!1;else{for(;f>1;)a.sqrTo(F,A),a.sqrTo(A,F),f-=2;f>0?a.sqrTo(F,A):(y=F,F=A,A=y),a.mulTo(A,c[v],F)}for(;m>=0&&0==(e[m]&1<<u);)a.sqrTo(F,A),y=F,F=A,A=y,--u<0&&(u=this.DB-1,--m)}return a.revert(F)},R.modInverse=function(e){var i=e.isEven();if(0===this.signum())throw new Error("division by zero");if(this.isEven()&&i||0==e.signum())return t.ZERO;for(var n=e.clone(),s=this.clone(),o=r(1),h=r(0),a=r(0),u=r(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),i?(o.isEven()&&h.isEven()||(o.addTo(this,o),h.subTo(e,h)),o.rShiftTo(1,o)):h.isEven()||h.subTo(e,h),h.rShiftTo(1,h);for(;s.isEven();)s.rShiftTo(1,s),i?(a.isEven()&&u.isEven()||(a.addTo(this,a),u.subTo(e,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);n.compareTo(s)>=0?(n.subTo(s,n),i&&o.subTo(a,o),h.subTo(u,h)):(s.subTo(n,s),i&&a.subTo(o,a),u.subTo(h,u))}if(0!=s.compareTo(t.ONE))return t.ZERO;for(;u.compareTo(e)>=0;)u.subTo(e,u);for(;u.signum()<0;)u.addTo(e,u);return u},R.pow=function(t){return this.exp(t,new l)},R.gcd=function(t){var e=this.s<0?this.negate():this.clone(),i=t.s<0?t.negate():t.clone();if(e.compareTo(i)<0){var r=e;e=i,i=r}var n=e.getLowestSetBit(),s=i.getLowestSetBit();if(s<0)return e;for(n<s&&(s=n),s>0&&(e.rShiftTo(s,e),i.rShiftTo(s,i));e.signum()>0;)(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),(n=i.getLowestSetBit())>0&&i.rShiftTo(n,i),e.compareTo(i)>=0?(e.subTo(i,e),e.rShiftTo(1,e)):(i.subTo(e,i),i.rShiftTo(1,i));return s>0&&i.lShiftTo(s,i),i},R.isProbablePrime=function(t){var e,i=this.abs();if(1==i.t&&i[0]<=K[K.length-1]){for(e=0;e<K.length;++e)if(i[0]==K[e])return!0;return!1}if(i.isEven())return!1;for(e=1;e<K.length;){for(var r=K[e],n=e+1;n<K.length&&r<_;)r*=K[n++];for(r=i.modInt(r);e<n;)if(r%K[e++]==0)return!1}return i.millerRabin(t)},R.square=function(){var e=new t;return this.squareTo(e),e},d.prototype.init=function(t){var e,i,r;for(e=0;e<256;++e)this.S[e]=e;for(i=0,e=0;e<256;++e)i=i+this.S[e]+t[e%t.length]&255,r=this.S[e],this.S[e]=this.S[i],this.S[i]=r;this.i=0,this.j=0},d.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]};var M,N,P,O=256;if(null==N){N=new Array(32),P=0;var q;for(q=0;q<32;++q)N[P++]=255&Math.random(10);for(;P<O;)q=Math.floor(65536*Math.random()),N[P++]=q>>>8,N[P++]=255&q;P=0,B()}return S.prototype.nextBytes=function(t){var e;for(e=0;e<t.length;++e)t[e]=A()},"undefined"!=typeof KJUR&&KJUR||(KJUR={}),void 0!==KJUR.crypto&&KJUR.crypto||(KJUR.crypto={}),KJUR.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",sm3:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:"CryptoJS.algo.MD5",sha1:"CryptoJS.algo.SHA1",sha224:"CryptoJS.algo.SHA224",sha256:"CryptoJS.algo.SHA256",sha384:"CryptoJS.algo.SHA384",sha512:"CryptoJS.algo.SHA512",ripemd160:"CryptoJS.algo.RIPEMD160",sm3:"CryptoJS.algo.SM3"},this.getDigestInfoHex=function(t,e){if(void 0===this.DIGESTINFOHEAD[e])throw"alg not supported in Util.DIGESTINFOHEAD: "+e;return this.DIGESTINFOHEAD[e]+t},this.getPaddedDigestInfoHex=function(t,e,i){var r=this.getDigestInfoHex(t,e),n=i/4;if(r.length+22>n)throw"key is too short for SigAlg: keylen="+i+","+e;for(var s="00"+r,o="",h=n-"0001".length-s.length,a=0;a<h;a+=2)o+="ff";return"0001"+o+s},this.hashString=function(t,e){return new KJUR.crypto.MessageDigest({alg:e}).digestString(t)},this.hashHex=function(t,e){return new KJUR.crypto.MessageDigest({alg:e}).digestHex(t)},this.sha1=function(t){return new KJUR.crypto.MessageDigest({alg:"sha1",prov:"cryptojs"}).digestString(t)},this.sha256=function(t){return new KJUR.crypto.MessageDigest({alg:"sha256",prov:"cryptojs"}).digestString(t)},this.sha256Hex=function(t){return new KJUR.crypto.MessageDigest({alg:"sha256",prov:"cryptojs"}).digestHex(t)},this.sha512=function(t){return new KJUR.crypto.MessageDigest({alg:"sha512",prov:"cryptojs"}).digestString(t)},this.sha512Hex=function(t){return new KJUR.crypto.MessageDigest({alg:"sha512",prov:"cryptojs"}).digestHex(t)},this.md5=function(t){return new KJUR.crypto.MessageDigest({alg:"md5",prov:"cryptojs"}).digestString(t)},this.ripemd160=function(t){return new KJUR.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"}).digestString(t)},this.getCryptoJSMDByName=function(t){}},KJUR.crypto.MessageDigest=function(t){this.setAlgAndProvider=function(t,e){if(null!=t&&void 0===e&&(e=KJUR.crypto.Util.DEFAULTPROVIDER[t]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:sm3:".indexOf(t)&&"cryptojs"==e){try{this.md=KJUR.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[t].create()}catch(e){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=b.enc.Hex.parse(t);this.md.update(e)},this.digest=function(){return this.md.finalize().toString(b.enc.Hex)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}if(-1!=":sha256:".indexOf(t)&&"sjcl"==e){try{this.md=new sjcl.hash.sha256}catch(e){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=sjcl.codec.hex.toBits(t);this.md.update(e)},this.digest=function(){var t=this.md.finalize();return sjcl.codec.hex.fromBits(t)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}},this.updateString=function(t){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(t){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(t){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==t&&void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=KJUR.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},KJUR.crypto.Mac=function(t){this.setAlgAndProvider=function(t,e){if(null==t&&(t="hmacsha1"),"hmac"!=(t=t.toLowerCase()).substr(0,4))throw"setAlgAndProvider unsupported HMAC alg: "+t;void 0===e&&(e=KJUR.crypto.Util.DEFAULTPROVIDER[t]),this.algProv=t+"/"+e;var i=t.substr(4);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(i)&&"cryptojs"==e){try{var r=KJUR.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[i];this.mac=b.algo.HMAC.create(r,this.pass)}catch(t){throw"setAlgAndProvider hash alg set fail hashAlg="+i+"/"+t}this.updateString=function(t){this.mac.update(t)},this.updateHex=function(t){var e=b.enc.Hex.parse(t);this.mac.update(e)},this.doFinal=function(){return this.mac.finalize().toString(b.enc.Hex)},this.doFinalString=function(t){return this.updateString(t),this.doFinal()},this.doFinalHex=function(t){return this.updateHex(t),this.doFinal()}}},this.updateString=function(t){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv},this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv},this.doFinalString=function(t){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(t){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},void 0!==t&&(void 0!==t.pass&&(this.pass=t.pass),void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=KJUR.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},KJUR.crypto.Signature=function(e){var i=null;if(this._setAlgNames=function(){this.algName.match(/^(.+)with(.+)$/)&&(this.mdAlgName=RegExp.$1.toLowerCase(),this.pubkeyAlgName=RegExp.$2.toLowerCase())},this._zeroPaddingOfSignature=function(t,e){for(var i="",r=e/4-t.length,n=0;n<r;n++)i+="0";return i+t},this.setAlgAndProvider=function(e,i){if(this._setAlgNames(),"cryptojs/jsrsa"!=i)throw"provider not supported: "+i;if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:sm3:".indexOf(this.mdAlgName)){try{this.md=new KJUR.crypto.MessageDigest({alg:this.mdAlgName})}catch(t){throw"setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+t}this.init=function(t,e){var i=null;try{i=void 0===e?KEYUTIL.getKey(t):KEYUTIL.getKey(t,e)}catch(t){throw"init failed:"+t}if(!0===i.isPrivate)this.prvKey=i,this.state="SIGN";else{if(!0!==i.isPublic)throw"init failed.:"+i;this.pubKey=i,this.state="VERIFY"}},this.initSign=function(t){"string"==typeof t.ecprvhex&&"string"==typeof t.eccurvename?(this.ecprvhex=t.ecprvhex,this.eccurvename=t.eccurvename):this.prvKey=t,this.state="SIGN"},this.initVerifyByPublicKey=function(t){"string"==typeof t.ecpubhex&&"string"==typeof t.eccurvename?(this.ecpubhex=t.ecpubhex,this.eccurvename=t.eccurvename):t instanceof KJUR.crypto.ECDSA?this.pubKey=t:t instanceof RSAKey&&(this.pubKey=t),this.state="VERIFY"},this.initVerifyByCertificatePEM=function(t){var e=new X509;e.readCertPEM(t),this.pubKey=e.subjectPublicKeyRSA,this.state="VERIFY"},this.updateString=function(t){this.md.updateString(t)},this.updateHex=function(t){this.md.updateHex(t)},this.sign=function(){if("sm2"!=this.eccurvename&&(this.sHashHex=this.md.digest()),void 0!==this.ecprvhex&&void 0!==this.eccurvename)if("sm2"==this.eccurvename){var e=(F=new KJUR.crypto.SM3withSM2({curve:this.eccurvename})).ecparams.G,i=e.multiply(new t(this.ecprvhex,16)),r=i.getX().toBigInteger().toRadix(16)+i.getY().toBigInteger().toRadix(16),n=new x,s=(new x).GetZ(e,r),o=n.GetWords(n.GetHex(s).toString()),h=b.enc.Utf8.stringify(this.md.md._data);h=b.enc.Utf8.parse(h).toString(),h=n.GetWords(h);var a=new Array(n.GetDigestSize());n.BlockUpdate(o,0,o.length),n.BlockUpdate(h,0,h.length),n.DoFinal(a,0);var u=n.GetHex(a).toString();this.sHashHex=u,this.hSign=F.signHex(this.sHashHex,this.ecprvhex)}else{var F=new KJUR.crypto.ECDSA({curve:this.eccurvename});this.hSign=F.signHex(this.sHashHex,this.ecprvhex)}else if("rsaandmgf1"==this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if("rsa"==this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof KJUR.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof KJUR.crypto.DSA))throw"Signature: unsupported public key alg: "+this.pubkeyAlgName;this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}return this.hSign},this.signString=function(t){this.updateString(t),this.sign()},this.signHex=function(t){this.updateHex(t),this.sign()},this.verify=function(t){if("sm2"!=this.eccurvename&&(this.sHashHex=this.md.digest()),void 0!==this.ecpubhex&&void 0!==this.eccurvename){if("sm2"==this.eccurvename){var e=(u=new KJUR.crypto.SM3withSM2({curve:this.eccurvename})).ecparams.G,i=this.ecpubhex.substr(2,128),r=new x,n=(new x).GetZ(e,i),s=r.GetWords(r.GetHex(n).toString()),o=b.enc.Utf8.stringify(this.md.md._data);o=b.enc.Utf8.parse(o).toString(),o=r.GetWords(o);var h=new Array(r.GetDigestSize());r.BlockUpdate(s,0,s.length),r.BlockUpdate(o,0,o.length),r.DoFinal(h,0);var a=r.GetHex(h).toString();return this.sHashHex=a,u.verifyHex(this.sHashHex,t,this.ecpubhex)}var u=new KJUR.crypto.ECDSA({curve:this.eccurvename});return u.verifyHex(this.sHashHex,t,this.ecpubhex)}if("rsaandmgf1"==this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,t,this.mdAlgName,this.pssSaltLen);if("rsa"==this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(this.pubKey instanceof KJUR.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(this.pubKey instanceof KJUR.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(t,e){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.initVerifyByPublicKey=function(t){throw"initVerifyByPublicKey(rsaPubKeyy) not supported for this alg:prov="+this.algProvName},this.initVerifyByCertificatePEM=function(t){throw"initVerifyByCertificatePEM(certPEM) not supported for this alg:prov="+this.algProvName},this.initSign=function(t){throw"initSign(prvKey) not supported for this alg:prov="+this.algProvName},this.updateString=function(t){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.sign=function(){throw"sign() not supported for this alg:prov="+this.algProvName},this.signString=function(t){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(t){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(t){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=e,void 0!==e&&(void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov?this.provName=KJUR.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=e.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==e.psssaltlen&&(this.pssSaltLen=e.psssaltlen),void 0!==e.prvkeypem)){if(void 0!==e.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{(i=new RSAKey).readPrivateKeyFromPEMString(e.prvkeypem),this.initSign(i)}catch(t){throw"fatal error to load pem private key: "+t}}},KJUR.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040023":"secp521r1","2b81040022":"secp384r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}},E.prototype.equals=function(t){return t==this||this.q.equals(t.q)&&this.x.equals(t.x)},E.prototype.toBigInteger=function(){return this.x},E.prototype.negate=function(){return new E(this.q,this.x.negate().mod(this.q))},E.prototype.add=function(t){return new E(this.q,this.x.add(t.toBigInteger()).mod(this.q))},E.prototype.subtract=function(t){return new E(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))},E.prototype.multiply=function(t){return new E(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))},E.prototype.square=function(){return new E(this.q,this.x.square().mod(this.q))},E.prototype.divide=function(t){return new E(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))},w.prototype.getX=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))},w.prototype.getY=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))},w.prototype.equals=function(e){if(e==this)return!0;if(this.isInfinity())return e.isInfinity();if(e.isInfinity())return this.isInfinity();return!!e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q).equals(t.ZERO)&&e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q).equals(t.ZERO)},w.prototype.isInfinity=function(){return null==this.x&&null==this.y||this.z.equals(t.ZERO)&&!this.y.toBigInteger().equals(t.ZERO)},w.prototype.negate=function(){return new w(this.curve,this.x,this.y.negate(),this.z)},w.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var i=e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q),r=e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q);if(t.ZERO.equals(r))return t.ZERO.equals(i)?this.twice():this.curve.getInfinity();var n=new t("3"),s=this.x.toBigInteger(),o=this.y.toBigInteger(),h=(e.x.toBigInteger(),e.y.toBigInteger(),r.square()),a=h.multiply(r),u=s.multiply(h),F=i.square().multiply(this.z),c=F.subtract(u.shiftLeft(1)).multiply(e.z).subtract(a).multiply(r).mod(this.curve.q),f=u.multiply(n).multiply(i).subtract(o.multiply(a)).subtract(F.multiply(i)).multiply(e.z).add(i.multiply(a)).mod(this.curve.q),l=a.multiply(this.z).multiply(e.z).mod(this.curve.q);return new w(this.curve,this.curve.fromBigInteger(c),this.curve.fromBigInteger(f),l)},w.prototype.twice=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var e=new t("3"),i=this.x.toBigInteger(),r=this.y.toBigInteger(),n=r.multiply(this.z),s=n.multiply(r).mod(this.curve.q),o=this.curve.a.toBigInteger(),h=i.square().multiply(e);t.ZERO.equals(o)||(h=h.add(this.z.square().multiply(o)));var a=(h=h.mod(this.curve.q)).square().subtract(i.shiftLeft(3).multiply(s)).shiftLeft(1).multiply(n).mod(this.curve.q),u=h.multiply(e).multiply(i).subtract(s.shiftLeft(1)).shiftLeft(2).multiply(s).subtract(h.square().multiply(h)).mod(this.curve.q),F=n.square().multiply(n).shiftLeft(3).mod(this.curve.q);return new w(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(u),F)},w.prototype.multiply=function(e){if(this.isInfinity())return this;if(0==e.signum())return this.curve.getInfinity();var i,r=e,n=r.multiply(new t("3")),s=this.negate(),o=this;for(i=n.bitLength()-2;i>0;--i){o=o.twice();var h=n.testBit(i);h!=r.testBit(i)&&(o=o.add(h?this:s))}return o},w.prototype.multiplyTwo=function(t,e,i){var r;r=t.bitLength()>i.bitLength()?t.bitLength()-1:i.bitLength()-1;for(var n=this.curve.getInfinity(),s=this.add(e);r>=0;)n=n.twice(),t.testBit(r)?n=i.testBit(r)?n.add(s):n.add(this):i.testBit(r)&&(n=n.add(e)),--r;return n},D.prototype.getQ=function(){return this.q},D.prototype.getA=function(){return this.a},D.prototype.getB=function(){return this.b},D.prototype.equals=function(t){return t==this||this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)},D.prototype.getInfinity=function(){return this.infinity},D.prototype.fromBigInteger=function(t){return new E(this.q,t)},D.prototype.decodePointHex=function(e){switch(parseInt(e.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var i=(e.length-2)/2,r=e.substr(2,i),n=e.substr(i+2,i);return new w(this,this.fromBigInteger(new t(r,16)),this.fromBigInteger(new t(n,16)));default:return null}},E.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},w.prototype.getEncoded=function(t){var e=function(t,e){var i=t.toByteArrayUnsigned();if(e<i.length)i=i.slice(i.length-e);else for(;e>i.length;)i.unshift(0);return i},i=this.getX().toBigInteger(),r=this.getY().toBigInteger(),n=e(i,32);return t?r.isEven()?n.unshift(2):n.unshift(3):(n.unshift(4),n=n.concat(e(r,32))),n},w.decodeFrom=function(e,i){i[0];var r=i.length-1,n=i.slice(1,1+r/2),s=i.slice(1+r/2,1+r);n.unshift(0),s.unshift(0);var o=new t(n),h=new t(s);return new w(e,e.fromBigInteger(o),e.fromBigInteger(h))},w.decodeFromHex=function(e,i){i.substr(0,2);var r=i.length-2,n=i.substr(2,r/2),s=i.substr(2+r/2,r/2),o=new t(n,16),h=new t(s,16);return new w(e,e.fromBigInteger(o),e.fromBigInteger(h))},w.prototype.add2D=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;if(this.x.equals(t.x))return this.y.equals(t.y)?this.twice():this.curve.getInfinity();var e=t.x.subtract(this.x),i=t.y.subtract(this.y).divide(e),r=i.square().subtract(this.x).subtract(t.x),n=i.multiply(this.x.subtract(r)).subtract(this.y);return new w(this.curve,r,n)},w.prototype.twice2D=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var e=this.curve.fromBigInteger(t.valueOf(2)),i=this.curve.fromBigInteger(t.valueOf(3)),r=this.x.square().multiply(i).add(this.curve.a).divide(this.y.multiply(e)),n=r.square().subtract(this.x.multiply(e)),s=r.multiply(this.x.subtract(n)).subtract(this.y);return new w(this.curve,n,s)},w.prototype.multiply2D=function(e){if(this.isInfinity())return this;if(0==e.signum())return this.curve.getInfinity();var i,r=e,n=r.multiply(new t("3")),s=this.negate(),o=this;for(i=n.bitLength()-2;i>0;--i){o=o.twice();var h=n.testBit(i);h!=r.testBit(i)&&(o=o.add2D(h?this:s))}return o},w.prototype.isOnCurve=function(){var t=this.getX().toBigInteger(),e=this.getY().toBigInteger(),i=this.curve.getA().toBigInteger(),r=this.curve.getB().toBigInteger(),n=this.curve.getQ(),s=e.multiply(e).mod(n),o=t.multiply(t).multiply(t).add(i.multiply(t)).add(r).mod(n);return s.equals(o)},w.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"},w.prototype.validate=function(){var e=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var i=this.getX().toBigInteger(),r=this.getY().toBigInteger();if(i.compareTo(t.ONE)<0||i.compareTo(e.subtract(t.ONE))>0)throw new Error("x coordinate out of bounds");if(r.compareTo(t.ONE)<0||r.compareTo(e.subtract(t.ONE))>0)throw new Error("y coordinate out of bounds");if(!this.isOnCurve())throw new Error("Point is not on the curve.");if(this.multiply(e).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0},"undefined"!=typeof KJUR&&KJUR||(KJUR={}),void 0!==KJUR.crypto&&KJUR.crypto||(KJUR.crypto={}),KJUR.crypto.ECDSA=function(e){var i=new S;this.type="EC",this.getBigRandom=function(e){return new t(e.bitLength(),i).mod(e.subtract(t.ONE)).add(t.ONE)},this.setNamedCurve=function(t){this.ecparams=KJUR.crypto.ECParameterDB.getByName(t),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=t},this.setPrivateKeyHex=function(t){this.isPrivate=!0,this.prvKeyHex=t},this.setPublicKeyHex=function(t){this.isPublic=!0,this.pubKeyHex=t},this.generateKeyPairHex=function(){var t=this.ecparams.n,e=this.getBigRandom(t),i=this.ecparams.G.multiply(e),r=i.getX().toBigInteger(),n=i.getY().toBigInteger(),s=this.ecparams.keylen/4,o=("0000000000"+e.toString(16)).slice(-s),h="04"+("0000000000"+r.toString(16)).slice(-s)+("0000000000"+n.toString(16)).slice(-s);return this.setPrivateKeyHex(o),this.setPublicKeyHex(h),{ecprvhex:o,ecpubhex:h}},this.signWithMessageHash=function(t){return this.signHex(t,this.prvKeyHex)},this.signHex=function(e,i){var r=new t(i,16),n=this.ecparams.n,s=new t(e,16);do{var o=this.getBigRandom(n),h=this.ecparams.G.multiply(o).getX().toBigInteger().mod(n)}while(h.compareTo(t.ZERO)<=0);var a=o.modInverse(n).multiply(s.add(r.multiply(h))).mod(n);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(h,a)},this.sign=function(e,i){var r=i,n=this.ecparams.n,s=t.fromByteArrayUnsigned(e);do{var o=this.getBigRandom(n),h=this.ecparams.G.multiply(o).getX().toBigInteger().mod(n)}while(h.compareTo(t.ZERO)<=0);var a=o.modInverse(n).multiply(s.add(r.multiply(h))).mod(n);return this.serializeSig(h,a)},this.verifyWithMessageHash=function(t,e){return this.verifyHex(t,e,this.pubKeyHex)},this.verifyHex=function(e,i,r){var n,s,o=KJUR.crypto.ECDSA.parseSigHex(i);n=o.r,s=o.s;var h;h=w.decodeFromHex(this.ecparams.curve,r);var a=new t(e,16);return this.verifyRaw(a,n,s,h)},this.verify=function(e,i,r){var n,s;if(Bitcoin.Util.isArray(i)){var o=this.parseSig(i);n=o.r,s=o.s}else{if("object"!=typeof i||!i.r||!i.s)throw"Invalid value for signature";n=i.r,s=i.s}var h;if(r instanceof w)h=r;else{if(!Bitcoin.Util.isArray(r))throw"Invalid format for pubkey value, must be byte array or ECPointFp";h=w.decodeFrom(this.ecparams.curve,r)}var a=t.fromByteArrayUnsigned(e);return this.verifyRaw(a,n,s,h)},this.verifyRaw=function(e,i,r,n){var s=this.ecparams.n,o=this.ecparams.G;if(i.compareTo(t.ONE)<0||i.compareTo(s)>=0)return!1;if(r.compareTo(t.ONE)<0||r.compareTo(s)>=0)return!1;var h=r.modInverse(s),a=e.multiply(h).mod(s),u=i.multiply(h).mod(s);return o.multiply(a).add(n.multiply(u)).getX().toBigInteger().mod(s).equals(i)},this.serializeSig=function(t,e){var i=t.toByteArraySigned(),r=e.toByteArraySigned(),n=[];return n.push(2),n.push(i.length),(n=n.concat(i)).push(2),n.push(r.length),(n=n.concat(r)).unshift(n.length),n.unshift(48),n},this.parseSig=function(e){var i;if(48!=e[0])throw new Error("Signature not a valid DERSequence");if(i=2,2!=e[i])throw new Error("First element in signature must be a DERInteger");var r=e.slice(i+2,i+2+e[i+1]);if(i+=2+e[i+1],2!=e[i])throw new Error("Second element in signature must be a DERInteger");var n=e.slice(i+2,i+2+e[i+1]);return i+=2+e[i+1],{r:t.fromByteArrayUnsigned(r),s:t.fromByteArrayUnsigned(n)}},this.parseSigCompact=function(e){if(65!==e.length)throw"Signature has the wrong length";var i=e[0]-27;if(i<0||i>7)throw"Invalid signature type";var r=this.ecparams.n;return{r:t.fromByteArrayUnsigned(e.slice(1,33)).mod(r),s:t.fromByteArrayUnsigned(e.slice(33,65)).mod(r),i:i}},void 0!==e&&void 0!==e.curve&&(this.curveName=e.curve),void 0===this.curveName&&(this.curveName="secp256r1"),this.setNamedCurve(this.curveName),void 0!==e&&(void 0!==e.prv&&this.setPrivateKeyHex(e.prv),void 0!==e.pub&&this.setPublicKeyHex(e.pub))},KJUR.crypto.ECDSA.parseSigHex=function(e){var i=KJUR.crypto.ECDSA.parseSigHexInHexRS(e);return{r:new t(i.r,16),s:new t(i.s,16)}},KJUR.crypto.ECDSA.parseSigHexInHexRS=function(t){if("30"!=t.substr(0,2))throw"signature is not a ASN.1 sequence";var e=ASN1HEX.getPosArrayOfChildren_AtObj(t,0);if(2!=e.length)throw"number of signature ASN.1 sequence elements seem wrong";var i=e[0],r=e[1];if("02"!=t.substr(i,2))throw"1st item of sequene of signature is not ASN.1 integer";if("02"!=t.substr(r,2))throw"2nd item of sequene of signature is not ASN.1 integer";return{r:ASN1HEX.getHexOfV_AtObj(t,i),s:ASN1HEX.getHexOfV_AtObj(t,r)}},KJUR.crypto.ECDSA.asn1SigToConcatSig=function(t){var e=KJUR.crypto.ECDSA.parseSigHexInHexRS(t),i=e.r,r=e.s;if("00"==i.substr(0,2)&&i.length/2*8%128==8&&(i=i.substr(2)),"00"==r.substr(0,2)&&r.length/2*8%128==8&&(r=r.substr(2)),i.length/2*8%128!=0)throw"unknown ECDSA sig r length error";if(r.length/2*8%128!=0)throw"unknown ECDSA sig s length error";return i+r},KJUR.crypto.ECDSA.concatSigToASN1Sig=function(t){if(t.length/2*8%128!=0)throw"unknown ECDSA concatinated r-s sig  length error";var e=t.substr(0,t.length/2),i=t.substr(t.length/2);return KJUR.crypto.ECDSA.hexRSSigToASN1Sig(e,i)},KJUR.crypto.ECDSA.hexRSSigToASN1Sig=function(e,i){var r=new t(e,16),n=new t(i,16);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(r,n)},KJUR.crypto.ECDSA.biRSSigToASN1Sig=function(t,e){var i=new KJUR.asn1.DERInteger({bigint:t}),r=new KJUR.asn1.DERInteger({bigint:e});return new KJUR.asn1.DERSequence({array:[i,r]}).getEncodedHex()},function(){var t=b,e=t.lib,i=e.WordArray,r=e.Hasher,n=[],s=t.algo.SM3=r.extend({_doReset:function(){this._hash=new i.init([1937774191,1226093241,388252375,3666478592,2842636476,372324522,3817729613,2969243214])},_doProcessBlock:function(t,e){for(var i=this._hash.words,r=i[0],s=i[1],o=i[2],h=i[3],a=i[4],u=0;u<80;u++){if(u<16)n[u]=0|t[e+u];else{var F=n[u-3]^n[u-8]^n[u-14]^n[u-16];n[u]=F<<1|F>>>31}var c=(r<<5|r>>>27)+a+n[u];c+=u<20?1518500249+(s&o|~s&h):u<40?1859775393+(s^o^h):u<60?(s&o|s&h|o&h)-1894007588:(s^o^h)-899497514,a=h,h=o,o=s<<30|s>>>2,s=r,r=c}i[0]=i[0]+r|0,i[1]=i[1]+s|0,i[2]=i[2]+o|0,i[3]=i[3]+h|0,i[4]=i[4]+a|0},_doFinalize:function(){var t=this._data,e=t.words,i=8*this._nDataBytes,r=8*t.sigBytes;return e[r>>>5]|=128<<24-r%32,e[14+(r+64>>>9<<4)]=Math.floor(i/4294967296),e[15+(r+64>>>9<<4)]=i,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});t.SM3=r._createHelper(s),t.HmacSM3=r._createHmacHelper(s)}(),x.prototype={Init:function(){this.xBuf=new Array(4),this.Reset()},InitDigest:function(t){this.xBuf=new Array(t.xBuf.length),Array.Copy(t.xBuf,0,this.xBuf,0,t.xBuf.length),this.xBufOff=t.xBufOff,this.byteCount=t.byteCount,Array.Copy(t.X,0,this.X,0,t.X.length),this.xOff=t.xOff,Array.Copy(t.v,0,this.v,0,t.v.length)},GetDigestSize:function(){return this.DIGEST_LENGTH},Reset:function(){this.byteCount=0,this.xBufOff=0,Array.Clear(this.xBuf,0,this.xBuf.length),Array.Copy(this.v0,0,this.v,0,this.v0.length),this.xOff=0,Array.Copy(this.X0,0,this.X,0,this.X0.length)},GetByteLength:function(){return this.BYTE_LENGTH},ProcessBlock:function(){var t,e=this.X,i=new Array(64);for(t=16;t<68;t++)e[t]=this.P1(e[t-16]^e[t-9]^this.ROTATE(e[t-3],15))^this.ROTATE(e[t-13],7)^e[t-6];for(t=0;t<64;t++)i[t]=e[t]^e[t+4];var r=this.v,n=this.v_;Array.Copy(r,0,n,0,this.v0.length);var s,o,h,a,u;for(t=0;t<16;t++)u=this.ROTATE(n[0],12),s=Int32.parse(Int32.parse(u+n[4])+this.ROTATE(this.T_00_15,t)),o=(s=this.ROTATE(s,7))^u,h=Int32.parse(Int32.parse(this.FF_00_15(n[0],n[1],n[2])+n[3])+o)+i[t],a=Int32.parse(Int32.parse(this.GG_00_15(n[4],n[5],n[6])+n[7])+s)+e[t],n[3]=n[2],n[2]=this.ROTATE(n[1],9),n[1]=n[0],n[0]=h,n[7]=n[6],n[6]=this.ROTATE(n[5],19),n[5]=n[4],n[4]=this.P0(a);for(t=16;t<64;t++)u=this.ROTATE(n[0],12),s=Int32.parse(Int32.parse(u+n[4])+this.ROTATE(this.T_16_63,t)),o=(s=this.ROTATE(s,7))^u,h=Int32.parse(Int32.parse(this.FF_16_63(n[0],n[1],n[2])+n[3])+o)+i[t],a=Int32.parse(Int32.parse(this.GG_16_63(n[4],n[5],n[6])+n[7])+s)+e[t],n[3]=n[2],n[2]=this.ROTATE(n[1],9),n[1]=n[0],n[0]=h,n[7]=n[6],n[6]=this.ROTATE(n[5],19),n[5]=n[4],n[4]=this.P0(a);for(t=0;t<8;t++)r[t]^=Int32.parse(n[t]);this.xOff=0,Array.Copy(this.X0,0,this.X,0,this.X0.length)},ProcessWord:function(t,e){var i=t[e]<<24;i|=(255&t[++e])<<16,i|=(255&t[++e])<<8,i|=255&t[++e],this.X[this.xOff]=i,16==++this.xOff&&this.ProcessBlock()},ProcessLength:function(t){this.xOff>14&&this.ProcessBlock(),this.X[14]=this.URShiftLong(t,32),this.X[15]=4294967295&t},IntToBigEndian:function(t,e,i){e[i]=Int32.parseByte(this.URShift(t,24)),e[++i]=Int32.parseByte(this.URShift(t,16)),e[++i]=Int32.parseByte(this.URShift(t,8)),e[++i]=Int32.parseByte(t)},DoFinal:function(t,e){this.Finish();for(var i=0;i<8;i++)this.IntToBigEndian(this.v[i],t,e+4*i);this.Reset();var r=t.length;for(i=0;i<r;i++)t[i]&=255;return this.DIGEST_LENGTH},Update:function(t){this.xBuf[this.xBufOff++]=t,this.xBufOff==this.xBuf.length&&(this.ProcessWord(this.xBuf,0),this.xBufOff=0),this.byteCount++},BlockUpdate:function(t,e,i){for(;0!=this.xBufOff&&i>0;)this.Update(t[e]),e++,i--;for(;i>this.xBuf.length;)this.ProcessWord(t,e),e+=this.xBuf.length,i-=this.xBuf.length,this.byteCount+=this.xBuf.length;for(;i>0;)this.Update(t[e]),e++,i--},Finish:function(){var t=this.byteCount<<3;for(this.Update(128);0!=this.xBufOff;)this.Update(0);this.ProcessLength(t),this.ProcessBlock()},ROTATE:function(t,e){return t<<e|this.URShift(t,32-e)},P0:function(t){return t^this.ROTATE(t,9)^this.ROTATE(t,17)},P1:function(t){return t^this.ROTATE(t,15)^this.ROTATE(t,23)},FF_00_15:function(t,e,i){return t^e^i},FF_16_63:function(t,e,i){return t&e|t&i|e&i},GG_00_15:function(t,e,i){return t^e^i},GG_16_63:function(t,e,i){return t&e|~t&i},URShift:function(t,e){return(t>Int32.maxValue||t<Int32.minValue)&&(t=Int32.parse(t)),t>=0?t>>e:(t>>e)+(2<<~e)},URShiftLong:function(e,i){var r,n=new t;if(n.fromInt(e),n.signum()>=0)r=n.shiftRight(i).intValue();else{var s=new t;s.fromInt(2);var o=~i,h="";if(o<0){for(var a=64+o,u=0;u<a;u++)h+="0";var F=new t;F.fromInt(e>>i);var c=new t("10"+h,2);h=c.toRadix(10),r=c.add(F).toRadix(10)}else r=(e>>i)+(h=s.shiftLeft(~i).intValue())}return r},GetZ:function(t,e){var i=b.enc.Utf8.parse("1234567812345678"),r=4*i.words.length*8;this.Update(r>>8&255),this.Update(255&r);var n=this.GetWords(i.toString());this.BlockUpdate(n,0,n.length);var s=this.GetWords(t.curve.a.toBigInteger().toRadix(16)),o=this.GetWords(t.curve.b.toBigInteger().toRadix(16)),h=this.GetWords(t.getX().toBigInteger().toRadix(16)),a=this.GetWords(t.getY().toBigInteger().toRadix(16)),u=this.GetWords(e.substr(0,64)),F=this.GetWords(e.substr(64,64));this.BlockUpdate(s,0,s.length),this.BlockUpdate(o,0,o.length),this.BlockUpdate(h,0,h.length),this.BlockUpdate(a,0,a.length),this.BlockUpdate(u,0,u.length),this.BlockUpdate(F,0,F.length);var c=new Array(this.GetDigestSize());return this.DoFinal(c,0),c},GetWords:function(t){for(var e=[],i=t.length,r=0;r<i;r+=2)e[e.length]=parseInt(t.substr(r,2),16);return e},GetHex:function(t){for(var e=[],i=0,r=0;r<2*t.length;r+=2)e[r>>>3]|=parseInt(t[i])<<24-r%8*4,i++;return new b.lib.WordArray.init(e,t.length)}},Array.Clear=function(t,e,i){for(elm in t)t[elm]=null},Array.Copy=function(t,e,i,r,n){for(var s=t.slice(e,e+n),o=0;o<s.length;o++)i[r]=s[o],r++},this.Int32={minValue:-parseInt("10000000000000000000000000000000",2),maxValue:parseInt("01111111111111111111111111111111",2),parse:function(t){if(t<this.minValue){for(var e=(s=(n=new Number(-t)).toString(2)).substr(s.length-31,31),i="",r=0;r<e.length;r++)i+="0"==(o=e.substr(r,1))?"1":"0";return(h=parseInt(i,2))+1}if(t>this.maxValue){for(var n=Number(t),s=n.toString(2),e=s.substr(s.length-31,31),i="",r=0;r<e.length;r++){var o=e.substr(r,1);i+="0"==o?"1":"0"}var h=parseInt(i,2);return-(h+1)}return t},parseByte:function(t){if(t<0){for(var e=(s=(n=new Number(-t)).toString(2)).substr(s.length-8,8),i="",r=0;r<e.length;r++)i+="0"==e.substr(r,1)?"1":"0";return parseInt(i,2)+1}if(t>255){var n=Number(t),s=n.toString(2);return parseInt(s.substr(s.length-8,8),2)}return t}},"undefined"!=typeof KJUR&&KJUR||(KJUR={}),void 0!==KJUR.crypto&&KJUR.crypto||(KJUR.crypto={}),KJUR.crypto.SM3withSM2=function(e){var i=new S;this.type="SM2",this.getBigRandom=function(e){return new t(e.bitLength(),i).mod(e.subtract(t.ONE)).add(t.ONE)},this.setNamedCurve=function(t){this.ecparams=KJUR.crypto.ECParameterDB.getByName(t),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=t},this.setPrivateKeyHex=function(t){this.isPrivate=!0,this.prvKeyHex=t},this.setPublicKeyHex=function(t){this.isPublic=!0,this.pubKeyHex=t},this.generateKeyPairHex=function(){var t=this.ecparams.n,e=this.getBigRandom(t),i=this.ecparams.G.multiply(e),r=i.getX().toBigInteger(),n=i.getY().toBigInteger(),s=this.ecparams.keylen/4,o=("0000000000"+e.toString(16)).slice(-s),h="04"+("0000000000"+r.toString(16)).slice(-s)+("0000000000"+n.toString(16)).slice(-s);return this.setPrivateKeyHex(o),this.setPublicKeyHex(h),{ecprvhex:o,ecpubhex:h}},this.signWithMessageHash=function(t){return this.signHex(t,this.prvKeyHex)},this.signHex=function(e,i){var r=new t(i,16),n=this.ecparams.n,s=new t(e,16),o=null,h=null,a=null,u=null,F=r;do{do{var c=this.generateKeyPairHex();o=new t(c.ecprvhex,16);var f=c.ecpubhex;h=w.decodeFromHex(this.ecparams.curve,f),a=(a=s.add(h.getX().toBigInteger())).mod(n)}while(a.equals(t.ZERO)||a.add(o).equals(n));var l=F.add(t.ONE);l=l.modInverse(n),u=a.multiply(F),u=o.subtract(u).mod(n),u=l.multiply(u).mod(n)}while(u.equals(t.ZERO));return KJUR.crypto.ECDSA.biRSSigToASN1Sig(a,u)},this.sign=function(e,i){var r=i,n=this.ecparams.n,s=t.fromByteArrayUnsigned(e);do{var o=this.getBigRandom(n),h=this.ecparams.G.multiply(o).getX().toBigInteger().mod(n)}while(h.compareTo(t.ZERO)<=0);var a=o.modInverse(n).multiply(s.add(r.multiply(h))).mod(n);return this.serializeSig(h,a)},this.verifyWithMessageHash=function(t,e){return this.verifyHex(t,e,this.pubKeyHex)},this.verifyHex=function(e,i,r){var n,s,o=KJUR.crypto.ECDSA.parseSigHex(i);n=o.r,s=o.s;var h;h=w.decodeFromHex(this.ecparams.curve,r);var a=new t(e,16);return this.verifyRaw(a,n,s,h)},this.verify=function(e,i,r){var n,s;if(Bitcoin.Util.isArray(i)){var o=this.parseSig(i);n=o.r,s=o.s}else{if("object"!=typeof i||!i.r||!i.s)throw"Invalid value for signature";n=i.r,s=i.s}var h;if(r instanceof w)h=r;else{if(!Bitcoin.Util.isArray(r))throw"Invalid format for pubkey value, must be byte array or ECPointFp";h=w.decodeFrom(this.ecparams.curve,r)}var a=t.fromByteArrayUnsigned(e);return this.verifyRaw(a,n,s,h)},this.verifyRaw=function(e,i,r,n){var s=this.ecparams.n,o=this.ecparams.G,h=i.add(r).mod(s);if(h.equals(t.ZERO))return!1;var a=o.multiply(r);a=a.add(n.multiply(h));var u=e.add(a.getX().toBigInteger()).mod(s);return i.equals(u)},this.serializeSig=function(t,e){var i=t.toByteArraySigned(),r=e.toByteArraySigned(),n=[];return n.push(2),n.push(i.length),(n=n.concat(i)).push(2),n.push(r.length),(n=n.concat(r)).unshift(n.length),n.unshift(48),n},this.parseSig=function(e){var i;if(48!=e[0])throw new Error("Signature not a valid DERSequence");if(i=2,2!=e[i])throw new Error("First element in signature must be a DERInteger");var r=e.slice(i+2,i+2+e[i+1]);if(i+=2+e[i+1],2!=e[i])throw new Error("Second element in signature must be a DERInteger");var n=e.slice(i+2,i+2+e[i+1]);return i+=2+e[i+1],{r:t.fromByteArrayUnsigned(r),s:t.fromByteArrayUnsigned(n)}},this.parseSigCompact=function(e){if(65!==e.length)throw"Signature has the wrong length";var i=e[0]-27;if(i<0||i>7)throw"Invalid signature type";var r=this.ecparams.n;return{r:t.fromByteArrayUnsigned(e.slice(1,33)).mod(r),s:t.fromByteArrayUnsigned(e.slice(33,65)).mod(r),i:i}},void 0!==e&&void 0!==e.curve&&(this.curveName=e.curve),void 0===this.curveName&&(this.curveName="sm2"),this.setNamedCurve(this.curveName),void 0!==e&&(void 0!==e.prv&&this.setPrivateKeyHex(e.prv),void 0!==e.pub&&this.setPublicKeyHex(e.pub))},"undefined"!=typeof KJUR&&KJUR||(KJUR={}),void 0!==KJUR.crypto&&KJUR.crypto||(KJUR.crypto={}),KJUR.crypto.ECParameterDB=new function(){function e(e){return new t(e,16)}var i={},r={};this.getByName=function(t){var e=t;if(void 0!==r[e]&&(e=r[t]),void 0!==i[e])return i[e];throw"unregistered EC curve name: "+e},this.regist=function(t,n,s,o,h,a,u,F,c,f,l,p){i[t]={};var g=e(s),d=e(o),v=e(h),y=e(a),m=e(u),B=new D(g,d,v),A=B.decodePointHex("04"+F+c);i[t].name=t,i[t].keylen=n,i[t].curve=B,i[t].G=A,i[t].n=y,i[t].h=m,i[t].oid=l,i[t].info=p;for(var S=0;S<f.length;S++)r[f[S]]=t}},KJUR.crypto.ECParameterDB.regist("secp128r1",128,"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC","E87579C11079F43DD824993C2CEE5ED3","FFFFFFFE0000000075A30D1B9038A115","1","161FF7528B899B2D0C28607CA52C5B86","CF5AC8395BAFEB13C02DA292DDED7A83",[],"","secp128r1 : SECG curve over a 128 bit prime field"),KJUR.crypto.ECParameterDB.regist("secp160k1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73","0","7","0100000000000000000001B8FA16DFAB9ACA16B6B3","1","3B4C382CE37AA192A4019E763036F4F5DD4D7EBB","938CF935318FDCED6BC28286531733C3F03C4FEE",[],"","secp160k1 : SECG curve over a 160 bit prime field"),KJUR.crypto.ECParameterDB.regist("secp160r1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC","1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45","0100000000000000000001F4C8F927AED3CA752257","1","4A96B5688EF573284664698968C38BB913CBFC82","23A628553168947D59DCC912042351377AC5FB32",[],"","secp160r1 : SECG curve over a 160 bit prime field"),KJUR.crypto.ECParameterDB.regist("secp192k1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37","0","3","FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D","1","DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D","9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D",[]),KJUR.crypto.ECParameterDB.regist("secp192r1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC","64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1","FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831","1","188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012","07192B95FFC8DA78631011ED6B24CDD573F977A11E794811",[]),KJUR.crypto.ECParameterDB.regist("secp224r1",224,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE","B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4","FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D","1","B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21","BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34",[]),KJUR.crypto.ECParameterDB.regist("secp256k1",256,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","0","7","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","1","79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8",[]),KJUR.crypto.ECParameterDB.regist("secp256r1",256,"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC","5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B","FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551","1","6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296","4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",["NIST P-256","P-256","prime256v1"]),KJUR.crypto.ECParameterDB.regist("secp384r1",384,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC","B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973","1","AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7","3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f",["NIST P-384","P-384"]),KJUR.crypto.ECParameterDB.regist("secp521r1",521,"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC","051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409","1","C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66","011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650",["NIST P-521","P-521"]),KJUR.crypto.ECParameterDB.regist("sm2",256,"FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF","FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC","28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93","FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123","1","32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7","BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0",["sm2","SM2"]),function(e){var i=function(t){this.ct=1,this.p2=null,this.sm3keybase=null,this.sm3c3=null,this.key=new Array(32),this.keyOff=0,this.cipherMode=void 0!==t?t:SM2CipherMode.C1C3C2};i.prototype={Reset:function(){this.sm3keybase=new x,this.sm3c3=new x;for(var t=this.p2.getX().toBigInteger().toRadix(16);t.length<64;)t="0"+t;for(var e=this.GetWords(t),i=this.p2.getY().toBigInteger().toRadix(16);i.length<64;)i="0"+i;var r=this.GetWords(i);this.sm3keybase.BlockUpdate(e,0,e.length),this.sm3c3.BlockUpdate(e,0,e.length),this.sm3keybase.BlockUpdate(r,0,r.length),this.ct=1,this.NextKey()},NextKey:function(){var t=new x(this.sm3keybase);t.Update(this.ct>>24&255),t.Update(this.ct>>16&255),t.Update(this.ct>>8&255),t.Update(255&this.ct),t.DoFinal(this.key,0),this.keyOff=0,this.ct++},KDF:function(t){for(var e=new Array(t),i=new x,r=new Array(32),n=1,s=t/32,o=t%32,h=this.p2.getX().toBigInteger().toRadix(16);h.length<64;)h="0"+h;for(var a=this.GetWords(h),u=this.p2.getY().toBigInteger().toRadix(16);u.length<64;)u="0"+u;for(var F=this.GetWords(u),c=0,f=0;f<s;f++)i.BlockUpdate(a,0,a.length),i.BlockUpdate(F,0,F.length),i.Update(n>>24&255),i.Update(n>>16&255),i.Update(n>>8&255),i.Update(255&n),i.DoFinal(e,c),c+=32,n++;0!=o&&(i.BlockUpdate(a,0,a.length),i.BlockUpdate(F,0,F.length),i.Update(n>>24&255),i.Update(n>>16&255),i.Update(n>>8&255),i.Update(255&n),i.DoFinal(r,0)),Array.Copy(r,0,e,c,o);for(f=0;f<e.length;f++)e[f]=255&e[f];return e},InitEncipher:function(e){var i=null,r=null,n=new KJUR.crypto.ECDSA({curve:"sm2"}),s=n.generateKeyPairHex();i=new t(s.ecprvhex,16);var o=s.ecpubhex;return r=w.decodeFromHex(n.ecparams.curve,o),this.p2=e.multiply(i),this.Reset(),r},EncryptBlock:function(t){this.sm3c3.BlockUpdate(t,0,t.length);for(var e=this.KDF(t.length),i=0;i<t.length;i++)t[i]^=e[i]},InitDecipher:function(t,e){this.p2=e.multiply(t);this.p2.getX().toBigInteger().toRadix(16),this.p2.getY().toBigInteger().toRadix(16);this.Reset()},DecryptBlock:function(t){var e=this.KDF(t.length),i=0;for(i=0;i<e.length;i++)e[i].toString(16);for(i=0;i<t.length;i++)t[i]^=e[i];this.sm3c3.BlockUpdate(t,0,t.length)},Dofinal:function(t){for(var e=this.p2.getY().toBigInteger().toRadix(16);e.length<64;)e="0"+e;var i=this.GetWords(e);this.sm3c3.BlockUpdate(i,0,i.length),this.sm3c3.DoFinal(t,0),this.Reset()},Encrypt:function(t,e){var i=new Array(e.length);Array.Copy(e,0,i,0,e.length);var r=this.InitEncipher(t);this.EncryptBlock(i);var n=new Array(32);this.Dofinal(n);for(var s=r.getX().toBigInteger().toRadix(16),o=r.getY().toBigInteger().toRadix(16);s.length<64;)s="0"+s;for(;o.length<64;)o="0"+o;var h=s+o,a=this.GetHex(i).toString();a.length%2!=0&&(a="0"+a);var u=this.GetHex(n).toString(),F=h+a+u;return this.cipherMode==SM2CipherMode.C1C3C2&&(F=h+u+a),F},GetWords:function(t){for(var e=[],i=t.length,r=0;r<i;r+=2)e[e.length]=parseInt(t.substr(r,2),16);return e},GetHex:function(t){for(var e=[],i=0,r=0;r<2*t.length;r+=2)e[r>>>3]|=parseInt(t[i])<<24-r%8*4,i++;return new b.lib.WordArray.init(e,t.length)},Decrypt:function(t,e){var i=e,r=i.substr(0,64),n=i.substr(0+r.length,64),s=i.substr(r.length+n.length,i.length-r.length-n.length-64),o=i.substr(i.length-64);this.cipherMode==SM2CipherMode.C1C3C2&&(o=i.substr(r.length+n.length,64),s=i.substr(r.length+n.length+64));var h=this.GetWords(s),a=this.CreatePoint(r,n);this.InitDecipher(t,a),this.DecryptBlock(h);var u=new Array(32);return this.Dofinal(u),this.GetHex(u).toString()==o?this.GetHex(h).toString():""},CreatePoint:function(t,e){var i=new KJUR.crypto.ECDSA({curve:"sm2"}),r=(i.ecparams.curve,"04"+t+e);return w.decodeFromHex(i.ecparams.curve,r)}},e.SM2Cipher=i}(this),this.SM2CipherMode={C1C2C3:"0",C1C3C2:"1"},function(){var e=C.algorithm,i=C.util.Hex,r=C.util.Checker;e.SM2={generate:function(){var t=new KJUR.crypto.ECDSA({curve:"SM2"}).generateKeyPairHex();return{publicKey:i.parse(t.ecpubhex.substring(2,130)),privateKey:i.parse(t.ecprvhex)}},encrypt:function(t,e){r.checkNotEmpty(t,"plaintext is empty."),r.checkNotEmpty(e,"publicKey is empty."),r.checkArgument(64==e.length,"illegal SM2 public key:"+i.stringify(e));var n=i.stringify(e),s=n.substr(0,64),o=n.substr(64),h=SM2CipherMode.C1C3C2,a=new SM2Cipher(h),u=a.CreatePoint(s,o),F=a.Encrypt(u,t);return i.parse(F)},decrypt:function(e,n){r.checkArgument(void 0!=e&&e.length>0,"illegal ciphertext:"+i.stringify(e)),r.checkArgument(void 0!=n&&32==n.length,"illegal SM2 public key:"+i.stringify(n));var s=i.stringify(e).toLowerCase(),o=SM2CipherMode.C1C3C2,h=new SM2Cipher(o),a=new t(i.stringify(n),16),u=h.Decrypt(a,s);return i.parse(u)},name:"SM2 algorithm",mode:"C1C3C2",testKeypair:{publicKey:"C5F171CC415C5C2759FE4668F51C0D7DA2CB85AE754F29135FED90D50C3B437D2EEA0F54163C3880C13618FF0F7CA67201DFF244016F09F19F7C1EC5D4033546",privateKey:"32803B68C49C9285F31577ACA17B7EE92E0828707F12FF8EE74442F75D68C5C8"},SM2_KEY_SIZE:32}}(),function(){var t=C.algorithm,e=C.util.Checker;t.SM3=function(){for(var t=new Array(0,0),i=new Array(0,0,0,0,0,0,0,0),r=new Array(64),n=0;n<64;n++)r[n]=0;var s=[128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o=[255,255,255,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,255,255,255,255,255,255,255,252,40,233,250,158,157,159,94,52,77,90,158,75,207,101,9,167,243,151,137,245,21,171,143,146,221,188,189,65,77,148,14,147,50,196,174,44,31,25,129,25,95,153,4,70,106,57,201,148,143,227,11,191,242,102,11,225,113,90,69,137,51,76,116,199,188,55,54,162,244,246,119,156,89,189,206,227,107,105,33,83,208,169,135,124,198,42,71,64,2,223,50,229,33,57,240,160],h=function(t){return t>>>0},a=function(t){return 4294967295-h(t)>>>0},u=function(t,e,i){return h(t^e^i)},F=function(t,e,i){return h(t&e|t&i|e&i)},c=function(t,e,i){return h(t^e^i)},f=function(t,e,i){return h(t&e|a(t)&i)},l=function(t,e){return h(h(t)<<e%32)},p=function(t,e){return h(l(t,e)|h(t)>>>32-e%32)},g=function(t){return h(h(t)^p(t,9)^p(t,17))},d=function(t){return h(h(t)^p(t,15)^p(t,23))},v=function(){t[0]=0,t[1]=0,i[0]=1937774191,i[1]=1226093241,i[2]=388252375,i[3]=3666478592,i[4]=2842636476,i[5]=372324522,i[6]=3817729613,i[7]=2969243214},y=function(t,e,i){var r=4278190080&t[e+i+0]<<24|16711680&t[e+i+1]<<16|65280&t[e+i+2]<<8|255&t[e+i+3];return h(r)},m=function(t,e,i){t>>>=0,e[i+0]=255&(4278190080&t)>>>24,e[i+1]=255&(16711680&t)>>>16,e[i+2]=255&(65280&t)>>>8,e[i+3]=255&t},B=function(t,e){for(var r,n,s,o,a,l,v,m,B,A,S,E,w,D,x,C,b=new Array(68),R=new Array(64),T=new Array(64),I=68;I>0;I--)b[I-1]=0;for(I=64;I>0;I--)R[I-1]=0;for(I=0;I<16;I++)T[I]=2043430169;for(I=16;I<64;I++)T[I]=2055708042;for(I=0;I<16;I++)b[I]=y(t,e,4*I);for(I=16;I<68;I++)w=(b[I-16]^b[I-9])>>>0,D=p(b[I-3],15),x=d((w^D)>>>0),C=(p(b[I-13],7)^b[I-6])>>>0,b[I]=(x^C)>>>0;for(I=0;I<64;I++)R[I]=(b[I]^b[I+4])>>>0;a=i[0]>>>0,l=i[1]>>>0,v=i[2]>>>0,m=i[3]>>>0,B=i[4]>>>0,A=i[5]>>>0,S=i[6]>>>0,E=i[7]>>>0;for(I=0;I<16;I++)n=(r=p(p(a,12)+B+p(T[I],I),7))^p(a,12)>>>0,s=u(a,l,v)+m+n+R[I],o=c(B,A,S)+E+r+b[I],m=h(v),v=p(l,9),l=h(a),a=h(s),E=h(S),S=p(A,19),A=h(B),B=g(o);for(I=16;I<64;I++)r=h(p(p(a,12)+B+p(T[I],I),7)),n=h(r^p(a,12)),s=h(F(a,l,v)+m+n+R[I]),o=h(f(B,A,S)+E+r+b[I]),m=h(v),v=p(l,9),l=h(a),a=h(s),E=h(S),S=p(A,19),A=h(B),B=g(o);i[0]=(a^i[0])>>>0,i[1]=(l^i[1])>>>0,i[2]=(v^i[2])>>>0,i[3]=(m^i[3])>>>0,i[4]=(B^i[4])>>>0,i[5]=(A^i[5])>>>0,i[6]=(S^i[6])>>>0,i[7]=(E^i[7])>>>0},A=function(t,e,i,r,n){for(var s=0;s<n;s++)t[e+s]=i[r+s]},S=function(e,i){if(void 0!==typeof e&&null!==e){var n=63&t[0],s=64-n;t[0]+=i,t[0],t[0]<i&&t[1]++;var o=0;for(0!==n&&i>=s&&(A(r,n,e,o,s),B(r,0),o+=s,i-=s,n=0);i>=64;)B(e,o),o+=64,i-=64;i>0&&A(r,n,e,o,i)}},E=function(){var e,r,n,o=new Array(32),a=new Array(8);r=h(t[0]>>>29|t[1]<<3),n=h(t[0]<<3),m(r,a,0),m(n,a,4),e=h(63&t[0]),S(s,e<56?56-e:120-e),S(a,8);for(var u=0;u<8;u++)m(i[u],o,4*u);return o};return{digest:function(t){return e.checkExist(t,"illegal input."),v(),S(t,t.length),E()},hmacWithPublicKey:function(t,e,i){var r=new Array(2+e.length+128+64),n=new Array(t.length+32);e.length;r[0]=e.length>>8&255,r[1]=255&e.length,A(r,2,e,0,e.length),A(r,2+e.length,o,0,o.length),A(r,2+e.length+o.length,i,0,i.length);var s=digest(r);return A(n,0,s,0,32),A(n,32,t,0,t.length),digest(n)},hmac:function(t,e){for(var i=new Array(64),r=new Array(64),n=0;n<64;n++)i[n]=54,r[n]=92;for(var n=0,s=t.length;n<s;n++)i[n]=(i[n]^t[n])>>>0,r[n]=(r[n]^t[n])>>>0;v(),S(i,i.length),S(e,e.length);var o=E();return v(),S(r,r.length),S(o,o.length),E()}}}()}(),function(){var t=C.algorithm,e=C.util.Checker;t.SM4=function(){function t(t,e){return t<<e|t>>>32-e}function i(e){return e^t(e,2)^t(e,10)^t(e,18)^t(e,24)}function r(e){return e^t(e,13)^t(e,23)}function n(t){return(255&f[t>>>24&255])<<24|(255&f[t>>>16&255])<<16|(255&f[t>>>8&255])<<8|255&f[255&t]}function s(t,e){return e?i(n(t)):r(n(t))}function o(t,e,i,r,n){return t^s(e^i^r^n,!0)}function h(t){for(var e=new Array(32),i=new Array(4),r=0;r<4;r++)i[r]=u(t,4*r);for(var n=new Array(4),r=0;r<4;r++)n[r]=i[r]^p[r];for(r=0;r<32;r+=4)e[r]=n[0]=n[0]^s(n[1]^n[2]^n[3]^l[r],!1),e[r+1]=n[1]=n[1]^s(n[2]^n[3]^n[0]^l[r+1],!1),e[r+2]=n[2]=n[2]^s(n[3]^n[0]^n[1]^l[r+2],!1),e[r+3]=n[3]=n[3]^s(n[0]^n[1]^n[2]^l[r+3],!1);return e}function a(t,e,i,r,n,s){for(var h=new Array(4),a=0;a<4;a++)h[a]=u(t,e+4*a);for(a=0;a<32;a+=4)s==c?(h[0]=o(h[0],h[1],h[2],h[3],n[a]),h[1]=o(h[1],h[2],h[3],h[0],n[a+1]),h[2]=o(h[2],h[3],h[0],h[1],n[a+2]),h[3]=o(h[3],h[0],h[1],h[2],n[a+3])):(h[0]=o(h[0],h[1],h[2],h[3],n[31-a]),h[1]=o(h[1],h[2],h[3],h[0],n[30-a]),h[2]=o(h[2],h[3],h[0],h[1],n[29-a]),h[3]=o(h[3],h[0],h[1],h[2],n[28-a]));for(a=0;a<4;a++)F(h[3-a],i,r+4*a)}function u(t,e){return(255&t[e])<<24|(255&t[e+1])<<16|(255&t[e+2])<<8|255&t[e+3]}function F(t,e,i){e[i]=(4278190080&t)>>>24,e[i+1]=(16711680&t)>>>16,e[i+2]=(65280&t)>>>8,e[i+3]=255&t}var c=0,f=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],l=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257],p=[2746333894,1453994832,1736282519,2993693404],g=function(t,e){for(var i=new Array(16),r=0;r<16;r++)i[r]=t[r]^e[r];return i},d=function(t,e,i,r,n){for(var s=0;s<n;s++)i[s+r]=t[s+e];return t};return{name:"SM4 algorithm",KEY_SIZE:16,encryptWithECB:function(t,i){e.checkArgument(void 0!==t&&t.length%16==0,"illegal plaintext:the length of plaintext must be the multiple of 16."),e.checkArgument(void 0!==i&&16===i.length,"illegal key:the length of sm4Key must be 16 bytes.");for(var r=h(i),n=t.length,s=new Array(n),o=0;o<n;)a(t,o,s,o,r,c),o+=16;return s},decryptWithECB:function(t,i){e.checkArgument(void 0!==t&&t.length%16==0,"illegal ciphertext:the length of ciphertext must be the multiple of 16."),e.checkArgument(void 0!==i&&16===i.length,"illegal key:the length of sm4Key must be 16 bytes.");for(var r=h(i),n=new Array(t.length),s=0;s<t.length;)a(t,s,n,s,r,1),s+=16;return n},encryptWithCBC:function(t,i,r){e.checkArgument(void 0!=typeof t&&t.length%16==0,"illegal plaintext:the length of plaintext must be the multiple of 16."),e.checkArgument(void 0!==i&&16===i.length,"illegal key:the length of sm4Key must be 16 bytes."),e.checkArgument(void 0!==r&&16===r.length,"illegal iv:the length of sm4 iv must be 16 bytes.");for(var n=h(i),s=new Array(t.length),o=0;o<t.length;o+=16){var u=t.slice(o,o+16),F=g(u,r),f=new Array(16);a(F,0,f,0,n,c),d(f,0,s,o,16),r=f}return s},decryptWithCBC:function(t,i,r){e.checkArgument(void 0!=typeof t&&t.length%16==0,"illegal plaintext:the length of plaintext must be the multiple of 16."),e.checkArgument(void 0!==i&&16===i.length,"illegal key:the length of sm4Key must be 16 bytes."),e.checkArgument(void 0!==r&&16===r.length,"illegal iv:the length of sm4 iv must be 16 bytes.");for(var n=h(i),s=new Array,o=0;o<t.length;o+=16){var u=t.slice(o,o+16),F=new Array(16);a(u,0,F,0,n,1);var c=g(F,r);r=t.slice(o,o+16),d(c,0,s,o,16)}return s}}}()}(),C});

var KeyouCryptography = __g__.KeyouCryptography; function encryptPwd(pwd, randomFactor) { let result = ‘‘; if (randomFactor.trim() !== ‘‘ && pwd.trim() !== ‘‘) { const SM2 = KeyouCryptography.algorithm.SM2; const Hex = KeyouCryptography.util.Hex; const encryptData = (pwd + randomFactor).toString().split(‘‘).map(i => `3${i}`).join(‘‘); const plaintext = Hex.parse(encryptData); // 密码+随机因子 密码在前 const _key = ‘C8A365F7365DC7F78C0E0B0A29BC0EDF39A6C8F52BD389464AF0CED6D0D9974D9BFB798EC2E6D57CDA19F7AA314E514CB0F80C0C2271C34125BA5D21E945F5CE‘; const publicKey = Hex.parse(_key); result = SM2.encrypt(plaintext, publicKey); result = KeyouCryptography.util.Hex.stringify(result); } return result; } var radomNum = postman.getGlobalVariable("respRadomNum"); var res = encryptPwd(‘123456‘,radomNum); postman.setEnvironmentVariable("pwdSM2", res); var currentTime = new Date(); function PrefixInteger(num, length) { return (Array(length).join(‘0‘) + num).slice(-length); } Date.prototype.toMyDateStr = function() { return this.getFullYear() + "-" + PrefixInteger((this.getMonth() + 1),2) + "-" + PrefixInteger(this.getDate(),2) + " " + PrefixInteger(this.getHours(),2) + ":" + PrefixInteger(this.getMinutes(),2) + ":" + PrefixInteger(this.getSeconds(),2); }; postman.setEnvironmentVariable("reqTime",currentTime.toMyDateStr());
网友评论