Advertisement
flalli

bitaddress.org commit f6c6bbe53df28c1bf51a6216f02ad1467b36c9

Jul 31st, 2014
1,225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Array.prototype.map||(Array.prototype.map=function(a,e){var b,c,f;if(null==this)throw new TypeError(" this is null or not defined");var d=Object(this),m=d.length>>>0;if("[object Function]"!={}.toString.call(a))throw new TypeError(a+" is not a function");e&&(b=e);c=Array(m);for(f=0;f<m;){var h;f in d&&(h=d[f],h=a.call(b,h,f,d),c[f]=h);f++}return c});
  2. "undefined"!=typeof Crypto&&Crypto.util||function(){var a=window.Crypto={},e=a.util={rotl:function(a,b){return a<<b|a>>>32-b},rotr:function(a,b){return a<<32-b|a>>>b},endian:function(a){if(a.constructor==Number)return e.rotl(a,8)&16711935|e.rotl(a,24)&4278255360;for(var b=0;b<a.length;b++)a[b]=e.endian(a[b]);return a},randomBytes:function(a){for(var b=[];0<a;a--)b.push(Math.floor(256*Math.random()));return b},bytesToWords:function(a){for(var b=[],d=0,e=0;d<a.length;d++,e+=8)b[e>>>5]|=(a[d]&255)<<
  3. 24-e%32;return b},wordsToBytes:function(a){for(var b=[],d=0;d<32*a.length;d+=8)b.push(a[d>>>5]>>>24-d%32&255);return b},bytesToHex:function(a){for(var b=[],d=0;d<a.length;d++)b.push((a[d]>>>4).toString(16)),b.push((a[d]&15).toString(16));return b.join("")},hexToBytes:function(a){for(var b=[],d=0;d<a.length;d+=2)b.push(parseInt(a.substr(d,2),16));return b},bytesToBase64:function(a){for(var b=[],d=0;d<a.length;d+=3)for(var e=a[d]<<16|a[d+1]<<8|a[d+2],h=0;4>h;h++)8*d+6*h<=8*a.length?b.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>>
  4. 6*(3-h)&63)):b.push("=");return b.join("")},base64ToBytes:function(a){a=a.replace(/[^A-Z0-9+\/]/ig,"");for(var b=[],d=0,e=0;d<a.length;e=++d%4)0!=e&&b.push(("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(d-1))&Math.pow(2,-2*e+8)-1)<<2*e|"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(d))>>>6-2*e);return b}},a=a.charenc={};a.UTF8={stringToBytes:function(a){return b.stringToBytes(unescape(encodeURIComponent(a)))},bytesToString:function(a){return decodeURIComponent(escape(b.bytesToString(a)))}};
  5. var b=a.Binary={stringToBytes:function(a){for(var b=[],d=0;d<a.length;d++)b.push(a.charCodeAt(d)&255);return b},bytesToString:function(a){for(var b=[],d=0;d<a.length;d++)b.push(String.fromCharCode(a[d]));return b.join("")}}}();
  6. (function(){var a=Crypto,e=a.util,b=a.charenc,c=b.UTF8,f=b.Binary,d=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,
  7. 2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],m=a.SHA256=function(a,b){var d=e.wordsToBytes(m._sha256(a));return b&&b.asBytes?d:b&&b.asString?f.bytesToString(d):e.bytesToHex(d)};m._sha256=function(a){a.constructor==String&&(a=c.stringToBytes(a));var b=e.bytesToWords(a),f=8*a.length;a=[1779033703,3144134277,
  8. 1013904242,2773480762,1359893119,2600822924,528734635,1541459225];var m=[],l,t,u,g,v,C,x,y,A,z,k;b[f>>5]|=128<<24-f%32;b[(f+64>>9<<4)+15]=f;for(y=0;y<b.length;y+=16){f=a[0];l=a[1];t=a[2];u=a[3];g=a[4];v=a[5];C=a[6];x=a[7];for(A=0;64>A;A++){16>A?m[A]=b[A+y]:(z=m[A-15],k=m[A-2],m[A]=((z<<25|z>>>7)^(z<<14|z>>>18)^z>>>3)+(m[A-7]>>>0)+((k<<15|k>>>17)^(k<<13|k>>>19)^k>>>10)+(m[A-16]>>>0));k=f&l^f&t^l&t;var n=(f<<30|f>>>2)^(f<<19|f>>>13)^(f<<10|f>>>22);z=(x>>>0)+((g<<26|g>>>6)^(g<<21|g>>>11)^(g<<7|g>>>25))+
  9. (g&v^~g&C)+d[A]+(m[A]>>>0);k=n+k;x=C;C=v;v=g;g=u+z>>>0;u=t;t=l;l=f;f=z+k>>>0}a[0]+=f;a[1]+=l;a[2]+=t;a[3]+=u;a[4]+=g;a[5]+=v;a[6]+=C;a[7]+=x}return a};m._blocksize=16;m._digestsize=32})();
  10. (function(){var a=Crypto,e=a.util,b=a.charenc,c=b.UTF8,f=b.Binary;a.PBKDF2=function(b,m,h,q){b.constructor==String&&(b=c.stringToBytes(b));m.constructor==String&&(m=c.stringToBytes(m));for(var r=q&&q.hasher||a.SHA1,s=q&&q.iterations||1,l=[],t=1;l.length<h;){var u;u=m.concat(e.wordsToBytes([t]));for(var g=u=a.HMAC(r,u,b,{asBytes:!0}),v=1;v<s;v++)for(var g=a.HMAC(r,g,b,{asBytes:!0}),C=0;C<u.length;C++)u[C]^=g[C];l=l.concat(u);t++}l.length=h;return q&&q.asBytes?l:q&&q.asString?f.bytesToString(l):e.bytesToHex(l)}})();
  11. (function(){var a=Crypto,e=a.util,b=a.charenc,c=b.UTF8,f=b.Binary;a.HMAC=function(a,b,h,q){b.constructor==String&&(b=c.stringToBytes(b));h.constructor==String&&(h=c.stringToBytes(h));h.length>4*a._blocksize&&(h=a(h,{asBytes:!0}));var r=h.slice(0);h=h.slice(0);for(var s=0;s<4*a._blocksize;s++)r[s]^=92,h[s]^=54;a=a(r.concat(a(h.concat(b),{asBytes:!0})),{asBytes:!0});return q&&q.asBytes?a:q&&q.asString?f.bytesToString(a):e.bytesToHex(a)}})();
  12. (function(){function a(a,b){for(var k=0,n=0;8>n;n++){b&1&&(k^=a);var w=a&128;a=a<<1&255;w&&(a^=27);b>>>=1}return k}for(var e=Crypto,b=e.util,c=e.charenc.UTF8,f=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,
  13. 208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,
  14. 206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],d=[],m=0;256>m;m++)d[f[m]]=m;for(var h=[],q=[],r=[],s=[],l=[],t=[],m=0;256>m;m++)h[m]=a(m,2),q[m]=a(m,3),r[m]=a(m,9),s[m]=a(m,11),l[m]=a(m,13),t[m]=a(m,14);var u=[0,1,2,4,8,16,32,64,128,27,54],g=[[],[],[],[]],v,C,x,y=e.AES={encrypt:function(a,d,k){k=k||{};var n=k.mode||new e.mode.OFB;n.fixOptions&&n.fixOptions(k);a=a.constructor==String?c.stringToBytes(a):a;var w=k.iv||b.randomBytes(4*y._blocksize);d=d.constructor==String?e.PBKDF2(d,
  15. w,32,{asBytes:!0}):d;y._init(d);n.encrypt(y,a,w);a=k.iv?a:w.concat(a);return k&&k.asBytes?a:b.bytesToBase64(a)},decrypt:function(a,d,k){k=k||{};var n=k.mode||new e.mode.OFB;n.fixOptions&&n.fixOptions(k);a=a.constructor==String?b.base64ToBytes(a):a;var w=k.iv||a.splice(0,4*y._blocksize);d=d.constructor==String?e.PBKDF2(d,w,32,{asBytes:!0}):d;y._init(d);n.decrypt(y,a,w);return k&&k.asBytes?a:c.bytesToString(a)},_blocksize:4,_encryptblock:function(a,b){for(var k=0;k<y._blocksize;k++)for(var n=0;4>n;n++)g[k][n]=
  16. a[b+4*n+k];for(k=0;4>k;k++)for(n=0;4>n;n++)g[k][n]^=x[n][k];for(var w=1;w<C;w++){for(k=0;4>k;k++)for(n=0;4>n;n++)g[k][n]=f[g[k][n]];g[1].push(g[1].shift());g[2].push(g[2].shift());g[2].push(g[2].shift());g[3].unshift(g[3].pop());for(n=0;4>n;n++){var k=g[0][n],d=g[1][n],c=g[2][n],e=g[3][n];g[0][n]=h[k]^q[d]^c^e;g[1][n]=k^h[d]^q[c]^e;g[2][n]=k^d^h[c]^q[e];g[3][n]=q[k]^d^c^h[e]}for(k=0;4>k;k++)for(n=0;4>n;n++)g[k][n]^=x[4*w+n][k]}for(k=0;4>k;k++)for(n=0;4>n;n++)g[k][n]=f[g[k][n]];g[1].push(g[1].shift());
  17. g[2].push(g[2].shift());g[2].push(g[2].shift());g[3].unshift(g[3].pop());for(k=0;4>k;k++)for(n=0;4>n;n++)g[k][n]^=x[4*C+n][k];for(k=0;k<y._blocksize;k++)for(n=0;4>n;n++)a[b+4*n+k]=g[k][n]},_decryptblock:function(a,b){for(var k=0;k<y._blocksize;k++)for(var n=0;4>n;n++)g[k][n]=a[b+4*n+k];for(k=0;4>k;k++)for(n=0;4>n;n++)g[k][n]^=x[4*C+n][k];for(var w=1;w<C;w++){g[1].unshift(g[1].pop());g[2].push(g[2].shift());g[2].push(g[2].shift());g[3].push(g[3].shift());for(k=0;4>k;k++)for(n=0;4>n;n++)g[k][n]=d[g[k][n]];
  18. for(k=0;4>k;k++)for(n=0;4>n;n++)g[k][n]^=x[4*(C-w)+n][k];for(n=0;4>n;n++){var k=g[0][n],c=g[1][n],e=g[2][n],f=g[3][n];g[0][n]=t[k]^s[c]^l[e]^r[f];g[1][n]=r[k]^t[c]^s[e]^l[f];g[2][n]=l[k]^r[c]^t[e]^s[f];g[3][n]=s[k]^l[c]^r[e]^t[f]}}g[1].unshift(g[1].pop());g[2].push(g[2].shift());g[2].push(g[2].shift());g[3].push(g[3].shift());for(k=0;4>k;k++)for(n=0;4>n;n++)g[k][n]=d[g[k][n]];for(k=0;4>k;k++)for(n=0;4>n;n++)g[k][n]^=x[n][k];for(k=0;k<y._blocksize;k++)for(n=0;4>n;n++)a[b+4*n+k]=g[k][n]},_init:function(a){v=
  19. a.length/4;C=v+6;y._keyexpansion(a)},_keyexpansion:function(a){x=[];for(var b=0;b<v;b++)x[b]=[a[4*b],a[4*b+1],a[4*b+2],a[4*b+3]];for(b=v;b<y._blocksize*(C+1);b++)a=[x[b-1][0],x[b-1][1],x[b-1][2],x[b-1][3]],0==b%v?(a.push(a.shift()),a[0]=f[a[0]],a[1]=f[a[1]],a[2]=f[a[2]],a[3]=f[a[3]],a[0]^=u[b/v]):6<v&&4==b%v&&(a[0]=f[a[0]],a[1]=f[a[1]],a[2]=f[a[2]],a[3]=f[a[3]]),x[b]=[x[b-v][0]^a[0],x[b-v][1]^a[1],x[b-v][2]^a[2],x[b-v][3]^a[3]]}}})();
  20. (function(a){function e(a,b){var c=4*a._blocksize;return c-b.length%c}var b=a.pad={},c=function(a,b,c,d){var e=b.pop();if(0==e)throw Error("Invalid zero-length padding specified for "+c+". Wrong cipher specification or key used?");if(e>4*a._blocksize)throw Error("Invalid padding length of "+e+" specified for "+c+". Wrong cipher specification or key used?");for(a=1;a<e;a++){var f=b.pop();if(void 0!=d&&d!=f)throw Error("Invalid padding byte of 0x"+f.toString(16)+" specified for "+c+". Wrong cipher specification or key used?");
  21. }};b.NoPadding={pad:function(a,b){},unpad:function(a,b){}};b.ZeroPadding={pad:function(a,b){var c=4*a._blocksize,d=b.length%c;if(0!=d)for(d=c-d;0<d;d--)b.push(0)},unpad:function(a,b){for(;0==b[b.length-1];)b.pop()}};b.iso7816={pad:function(a,b){var c=e(a,b);for(b.push(128);1<c;c--)b.push(0)},unpad:function(a,b){var c;for(c=4*a._blocksize;0<c;c--){var d=b.pop();if(128==d)return;if(0!=d)throw Error("ISO-7816 padding byte must be 0, not 0x"+d.toString(16)+". Wrong cipher specification or key used?");
  22. }throw Error("ISO-7816 padded beyond cipher block size. Wrong cipher specification or key used?");}};b.ansix923={pad:function(a,b){for(var c=e(a,b),d=1;d<c;d++)b.push(0);b.push(c)},unpad:function(a,b){c(a,b,"ANSI X.923",0)}};b.iso10126={pad:function(a,b){for(var c=e(a,b),d=1;d<c;d++)b.push(Math.floor(256*Math.random()));b.push(c)},unpad:function(a,b){c(a,b,"ISO 10126",void 0)}};b.pkcs7={pad:function(a,b){for(var c=e(a,b),d=0;d<c;d++)b.push(c)},unpad:function(a,b){c(a,b,"PKCS 7",b[b.length-1])}};a=
  23. a.mode={};var f=a.Mode=function(a){a&&(this._padding=a)};f.prototype={encrypt:function(a,b,c){this._padding.pad(a,b);this._doEncrypt(a,b,c)},decrypt:function(a,b,c){this._doDecrypt(a,b,c);this._padding.unpad(a,b)},_padding:b.iso7816};var d=(a.ECB=function(){f.apply(this,arguments)}).prototype=new f;d._doEncrypt=function(a,b,c){c=4*a._blocksize;for(var d=0;d<b.length;d+=c)a._encryptblock(b,d)};d._doDecrypt=function(a,b,c){c=4*a._blocksize;for(var d=0;d<b.length;d+=c)a._decryptblock(b,d)};d.fixOptions=
  24. function(a){a.iv=[]};d=(a.CBC=function(){f.apply(this,arguments)}).prototype=new f;d._doEncrypt=function(a,b,c){for(var d=4*a._blocksize,e=0;e<b.length;e+=d){if(0==e)for(var f=0;f<d;f++)b[f]^=c[f];else for(f=0;f<d;f++)b[e+f]^=b[e+f-d];a._encryptblock(b,e)}};d._doDecrypt=function(a,b,c){for(var d=4*a._blocksize,e=0;e<b.length;e+=d){var f=b.slice(e,e+d);a._decryptblock(b,e);for(var t=0;t<d;t++)b[e+t]^=c[t];c=f}};d=(a.CFB=function(){f.apply(this,arguments)}).prototype=new f;d._padding=b.NoPadding;d._doEncrypt=
  25. function(a,b,c){var d=4*a._blocksize;c=c.slice(0);for(var e=0;e<b.length;e++){var f=e%d;0==f&&a._encryptblock(c,0);b[e]^=c[f];c[f]=b[e]}};d._doDecrypt=function(a,b,c){var d=4*a._blocksize;c=c.slice(0);for(var e=0;e<b.length;e++){var f=e%d;0==f&&a._encryptblock(c,0);var t=b[e];b[e]^=c[f];c[f]=t}};d=(a.OFB=function(){f.apply(this,arguments)}).prototype=new f;d._padding=b.NoPadding;d._doEncrypt=function(a,b,c){var d=4*a._blocksize;c=c.slice(0);for(var e=0;e<b.length;e++)0==e%d&&a._encryptblock(c,0),
  26. b[e]^=c[e%d]};d._doDecrypt=d._doEncrypt;a=(a.CTR=function(){f.apply(this,arguments)}).prototype=new f;a._padding=b.NoPadding;a._doEncrypt=function(a,b,c){var d=4*a._blocksize;c=c.slice(0);for(var e=0;e<b.length;){var f=c.slice(0);a._encryptblock(f,0);for(var t=0;e<b.length&&t<d;t++,e++)b[e]^=f[t];256==++c[d-1]&&(c[d-1]=0,256==++c[d-2]&&(c[d-2]=0,256==++c[d-3]&&(c[d-3]=0,++c[d-4])))}};a._doDecrypt=a._doEncrypt})(Crypto);
  27. (function(){function a(a,b,c,d){return 0<=a&&15>=a?b^c^d:16<=a&&31>=a?b&c|~b&d:32<=a&&47>=a?(b|~c)^d:48<=a&&63>=a?b&d|c&~d:64<=a&&79>=a?b^(c|~d):"rmd160_f: j out of range"}function e(a,b){var c=(a&65535)+(b&65535);return(a>>16)+(b>>16)+(c>>16)<<16|c&65535}function b(a,b){return a<<b|a>>>32-b}var c=Crypto,f=c.util,d=c.charenc,m=d.UTF8,h=d.Binary;f.bytesToLWords=function(a){for(var b=Array(a.length>>2),c=0;c<b.length;c++)b[c]=0;for(c=0;c<8*a.length;c+=8)b[c>>5]|=(a[c/8]&255)<<c%32;return b};f.lWordsToBytes=
  28. function(a){for(var b=[],c=0;c<32*a.length;c+=8)b.push(a[c>>5]>>>c%32&255);return b};var q=c.RIPEMD160=function(a,b){var c=f.lWordsToBytes(q._rmd160(a));return b&&b.asBytes?c:b&&b.asString?h.bytesToString(c):f.bytesToHex(c)};q._rmd160=function(c){c.constructor==String&&(c=m.stringToBytes(c));var d=f.bytesToLWords(c);c=8*c.length;d[c>>5]|=128<<c%32;d[(c+64>>>9<<4)+14]=c;c=1732584193;for(var h=4023233417,q=2562383102,x=271733878,y=3285377520,A=0;A<d.length;A+=16){for(var z,k=c,n=h,w=q,B=x,D=y,E=c,F=
  29. h,G=q,H=x,I=y,p=0;79>=p;++p)z=e(k,a(p,n,w,B)),z=e(z,d[A+r[p]]),z=e(z,0<=p&&15>=p?0:16<=p&&31>=p?1518500249:32<=p&&47>=p?1859775393:48<=p&&63>=p?2400959708:64<=p&&79>=p?2840853838:"rmd160_K1: j out of range"),z=e(b(z,l[p]),D),k=D,D=B,B=b(w,10),w=n,n=z,z=e(E,a(79-p,F,G,H)),z=e(z,d[A+s[p]]),z=e(z,0<=p&&15>=p?1352829926:16<=p&&31>=p?1548603684:32<=p&&47>=p?1836072691:48<=p&&63>=p?2053994217:64<=p&&79>=p?0:"rmd160_K2: j out of range"),z=e(b(z,t[p]),I),E=I,I=H,H=b(G,10),G=F,F=z;z=e(h,e(w,H));h=e(q,e(B,
  30. I));q=e(x,e(D,E));x=e(y,e(k,F));y=e(c,e(n,G));c=z}return[c,h,q,x,y]};var r=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],s=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],l=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,
  31. 8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],t=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]})();
  32. (function(){var a=window.SecureRandom=function(){};a.state;a.pool;a.pptr;a.poolCopyOnInit;a.poolSize=256;a.prototype.nextBytes=function(b){var c;if(window.crypto&&window.crypto.getRandomValues&&window.Uint8Array)try{var d=new Uint8Array(b.length);window.crypto.getRandomValues(d);for(c=0;c<b.length;++c)b[c]=a.getByte()^d[c];return}catch(e){alert(e)}for(c=0;c<b.length;++c)b[c]=a.getByte()};a.seedTime=function(){a.seedInt((new Date).getTime())};a.getByte=function(){if(null==a.state){a.seedTime();a.state=
  33. a.ArcFour();a.state.init(a.pool);a.poolCopyOnInit=[];for(a.pptr=0;a.pptr<a.pool.length;++a.pptr)a.poolCopyOnInit[a.pptr]=a.pool[a.pptr];a.pptr=0}return a.state.next()};a.seedInt=function(b){a.seedInt8(b);a.seedInt8(b>>8);a.seedInt8(b>>16);a.seedInt8(b>>24)};a.seedInt16=function(b){a.seedInt8(b);a.seedInt8(b>>8)};a.seedInt8=function(b){a.pool[a.pptr++]^=b&255;a.pptr>=a.poolSize&&(a.pptr-=a.poolSize)};a.ArcFour=function(){function a(){this.j=this.i=0;this.S=[]}a.prototype.init=function(a){var b,c,d;
  34. for(b=0;256>b;++b)this.S[b]=b;for(b=c=0;256>b;++b)c=c+this.S[b]+a[b%a.length]&255,d=this.S[b],this.S[b]=this.S[c],this.S[c]=d;this.j=this.i=0};a.prototype.next=function(){var a;this.i=this.i+1&255;this.j=this.j+this.S[this.i]&255;a=this.S[this.i];this.S[this.i]=this.S[this.j];this.S[this.j]=a;return this.S[a+this.S[this.i]&255]};return new a};if(null==a.pool){a.pool=[];a.pptr=0;var e;if(window.crypto&&window.crypto.getRandomValues&&window.Uint8Array)try{var b=new Uint8Array(a.poolSize);window.crypto.getRandomValues(b);
  35. for(e=0;e<a.poolSize;++e)a.pool[a.pptr++]=b[e]}catch(c){alert(c)}for(;a.pptr<a.poolSize;)e=Math.floor(65536*Math.random()),a.pool[a.pptr++]=e>>>8,a.pool[a.pptr++]=e&255;a.pptr=Math.floor(a.poolSize*Math.random());a.seedTime();e=""+window.screen.height*window.screen.width*window.screen.colorDepth;e+=window.screen.availHeight*window.screen.availWidth*window.screen.pixelDepth;b=(new Date).getTimezoneOffset();e=e+b+navigator.userAgent;for(var f="",b=0;b<navigator.plugins.length;b++)f+=navigator.plugins[b].name+
  36. " "+navigator.plugins[b].filename+" "+navigator.plugins[b].description+" "+navigator.plugins[b].version+", ";for(var d="",b=0;b<navigator.mimeTypes.length;b++)d+=navigator.mimeTypes[b].description+" "+navigator.mimeTypes[b].type+" "+navigator.mimeTypes[b].suffixes+", ";e+=f+d;e+=navigator.cookieEnabled+typeof sessionStorage+typeof localStorage;e+=navigator.language;e+=window.history.length;e+=window.location;e=Crypto.SHA256(e,{asBytes:!0});for(b=0;b<e.length;b++)a.seedInt8(e[b])}})();
  37. (function(){var a=window.EllipticCurve=function(){};a.FieldElementFp=function(a,b){this.x=b;this.q=a};a.FieldElementFp.prototype.equals=function(a){return a==this?!0:this.q.equals(a.q)&&this.x.equals(a.x)};a.FieldElementFp.prototype.toBigInteger=function(){return this.x};a.FieldElementFp.prototype.negate=function(){return new a.FieldElementFp(this.q,this.x.negate().mod(this.q))};a.FieldElementFp.prototype.add=function(e){return new a.FieldElementFp(this.q,this.x.add(e.toBigInteger()).mod(this.q))};
  38. a.FieldElementFp.prototype.subtract=function(e){return new a.FieldElementFp(this.q,this.x.subtract(e.toBigInteger()).mod(this.q))};a.FieldElementFp.prototype.multiply=function(e){return new a.FieldElementFp(this.q,this.x.multiply(e.toBigInteger()).mod(this.q))};a.FieldElementFp.prototype.square=function(){return new a.FieldElementFp(this.q,this.x.square().mod(this.q))};a.FieldElementFp.prototype.divide=function(e){return new a.FieldElementFp(this.q,this.x.multiply(e.toBigInteger().modInverse(this.q)).mod(this.q))};
  39. a.FieldElementFp.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};a.FieldElementFp.prototype.sqrt=function(){if(!this.q.testBit(0))throw Error("even value of q");if(this.q.testBit(1)){var e=new a.FieldElementFp(this.q,this.x.modPow(this.q.shiftRight(2).add(BigInteger.ONE),this.q));return e.square().equals(this)?e:null}var e=this.q.subtract(BigInteger.ONE),b=e.shiftRight(1);if(!this.x.modPow(b,this.q).equals(BigInteger.ONE))return null;var c=e.shiftRight(2).shiftLeft(1).add(BigInteger.ONE),
  40. f=this.x,d=f.shiftLeft(2).mod(this.q),m,h;do{m=new SecureRandom;do h=new BigInteger(this.q.bitLength(),m);while(0<=h.compareTo(this.q)||!h.multiply(h).subtract(d).modPow(b,this.q).equals(e));h=a.FieldElementFp.fastLucasSequence(this.q,h,f,c);m=h[0];h=h[1];if(h.multiply(h).mod(this.q).equals(d))return h.testBit(0)&&(h=h.add(this.q)),h=h.shiftRight(1),new a.FieldElementFp(this.q,h)}while(m.equals(BigInteger.ONE)||m.equals(e));return null};a.FieldElementFp.fastLucasSequence=function(a,b,c,f){for(var d=
  41. f.bitLength(),m=f.getLowestSetBit(),h=BigInteger.ONE,q=BigInteger.TWO,r=b,s=BigInteger.ONE,l=BigInteger.ONE,d=d-1;d>=m+1;--d)s=s.multiply(l).mod(a),f.testBit(d)?(l=s.multiply(c).mod(a),h=h.multiply(r).mod(a),q=r.multiply(q).subtract(b.multiply(s)).mod(a),r=r.multiply(r).subtract(l.shiftLeft(1)).mod(a)):(l=s,h=h.multiply(q).subtract(s).mod(a),r=r.multiply(q).subtract(b.multiply(s)).mod(a),q=q.multiply(q).subtract(s.shiftLeft(1)).mod(a));s=s.multiply(l).mod(a);l=s.multiply(c).mod(a);h=h.multiply(q).subtract(s).mod(a);
  42. q=r.multiply(q).subtract(b.multiply(s)).mod(a);s=s.multiply(l).mod(a);for(d=1;d<=m;++d)h=h.multiply(q).mod(a),q=q.multiply(q).subtract(s.shiftLeft(1)).mod(a),s=s.multiply(s).mod(a);return[h,q]};a.PointFp=function(a,b,c,f,d){this.curve=a;this.x=b;this.y=c;this.z=null==f?BigInteger.ONE:f;this.zinv=null;this.compressed=!!d};a.PointFp.prototype.getX=function(){null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q));var a=this.x.toBigInteger().multiply(this.zinv);this.curve.reduce(a);return this.curve.fromBigInteger(a)};
  43. a.PointFp.prototype.getY=function(){null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q));var a=this.y.toBigInteger().multiply(this.zinv);this.curve.reduce(a);return this.curve.fromBigInteger(a)};a.PointFp.prototype.equals=function(a){return a==this?!0:this.isInfinity()?a.isInfinity():a.isInfinity()?this.isInfinity():a.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(a.z)).mod(this.curve.q).equals(BigInteger.ZERO)?a.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(a.z)).mod(this.curve.q).equals(BigInteger.ZERO):
  44. !1};a.PointFp.prototype.isInfinity=function(){return null==this.x&&null==this.y?!0:this.z.equals(BigInteger.ZERO)&&!this.y.toBigInteger().equals(BigInteger.ZERO)};a.PointFp.prototype.negate=function(){return new a.PointFp(this.curve,this.x,this.y.negate(),this.z)};a.PointFp.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var b=e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q),c=e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q);
  45. if(BigInteger.ZERO.equals(c))return BigInteger.ZERO.equals(b)?this.twice():this.curve.getInfinity();var f=new BigInteger("3"),d=this.x.toBigInteger(),m=this.y.toBigInteger();e.x.toBigInteger();e.y.toBigInteger();var h=c.square(),q=h.multiply(c),d=d.multiply(h),h=b.square().multiply(this.z),c=h.subtract(d.shiftLeft(1)).multiply(e.z).subtract(q).multiply(c).mod(this.curve.q),b=d.multiply(f).multiply(b).subtract(m.multiply(q)).subtract(h.multiply(b)).multiply(e.z).add(b.multiply(q)).mod(this.curve.q);
  46. e=q.multiply(this.z).multiply(e.z).mod(this.curve.q);return new a.PointFp(this.curve,this.curve.fromBigInteger(c),this.curve.fromBigInteger(b),e)};a.PointFp.prototype.twice=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var e=new BigInteger("3"),b=this.x.toBigInteger(),c=this.y.toBigInteger(),f=c.multiply(this.z),d=f.multiply(c).mod(this.curve.q),c=this.curve.a.toBigInteger(),m=b.square().multiply(e);BigInteger.ZERO.equals(c)||(m=m.add(this.z.square().multiply(c)));
  47. m=m.mod(this.curve.q);c=m.square().subtract(b.shiftLeft(3).multiply(d)).shiftLeft(1).multiply(f).mod(this.curve.q);e=m.multiply(e).multiply(b).subtract(d.shiftLeft(1)).shiftLeft(2).multiply(d).subtract(m.square().multiply(m)).mod(this.curve.q);f=f.square().multiply(f).shiftLeft(3).mod(this.curve.q);return new a.PointFp(this.curve,this.curve.fromBigInteger(c),this.curve.fromBigInteger(e),f)};a.PointFp.prototype.multiply=function(a){if(this.isInfinity())return this;if(0==a.signum())return this.curve.getInfinity();
  48. var b=a.multiply(new BigInteger("3")),c=this.negate(),f=this,d;for(d=b.bitLength()-2;0<d;--d){var f=f.twice(),m=b.testBit(d),h=a.testBit(d);m!=h&&(f=f.add(m?this:c))}return f};a.PointFp.prototype.multiplyTwo=function(a,b,c){var f;f=a.bitLength()>c.bitLength()?a.bitLength()-1:c.bitLength()-1;for(var d=this.curve.getInfinity(),m=this.add(b);0<=f;)d=d.twice(),a.testBit(f)?d=c.testBit(f)?d.add(m):d.add(this):c.testBit(f)&&(d=d.add(b)),--f;return d};a.PointFp.prototype.getEncoded=function(e){var b=this.getX().toBigInteger(),
  49. c=this.getY().toBigInteger(),b=a.integerToBytes(b,32);e?c.isEven()?b.unshift(2):b.unshift(3):(b.unshift(4),b=b.concat(a.integerToBytes(c,32)));return b};a.PointFp.decodeFrom=function(e,b){var c=b.length-1,f=b.slice(1,1+c/2),c=b.slice(1+c/2,1+c);f.unshift(0);c.unshift(0);f=new BigInteger(f);c=new BigInteger(c);return new a.PointFp(e,e.fromBigInteger(f),e.fromBigInteger(c))};a.PointFp.prototype.add2D=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;if(this.x.equals(e.x))return this.y.equals(e.y)?
  50. this.twice():this.curve.getInfinity();var b=e.x.subtract(this.x),b=e.y.subtract(this.y).divide(b);e=b.square().subtract(this.x).subtract(e.x);b=b.multiply(this.x.subtract(e)).subtract(this.y);return new a.PointFp(this.curve,e,b)};a.PointFp.prototype.twice2D=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var e=this.curve.fromBigInteger(BigInteger.valueOf(2)),b=this.curve.fromBigInteger(BigInteger.valueOf(3)),b=this.x.square().multiply(b).add(this.curve.a).divide(this.y.multiply(e)),
  51. e=b.square().subtract(this.x.multiply(e)),b=b.multiply(this.x.subtract(e)).subtract(this.y);return new a.PointFp(this.curve,e,b)};a.PointFp.prototype.multiply2D=function(a){if(this.isInfinity())return this;if(0==a.signum())return this.curve.getInfinity();var b=a.multiply(new BigInteger("3")),c=this.negate(),f=this,d;for(d=b.bitLength()-2;0<d;--d){var f=f.twice(),m=b.testBit(d),h=a.testBit(d);m!=h&&(f=f.add2D(m?this:c))}return f};a.PointFp.prototype.isOnCurve=function(){var a=this.getX().toBigInteger(),
  52. b=this.getY().toBigInteger(),c=this.curve.getA().toBigInteger(),f=this.curve.getB().toBigInteger(),d=this.curve.getQ(),b=b.multiply(b).mod(d),a=a.multiply(a).multiply(a).add(c.multiply(a)).add(f).mod(d);return b.equals(a)};a.PointFp.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};a.PointFp.prototype.validate=function(){var a=this.curve.getQ();if(this.isInfinity())throw Error("Point is at infinity.");var b=this.getX().toBigInteger(),
  53. c=this.getY().toBigInteger();if(0>b.compareTo(BigInteger.ONE)||0<b.compareTo(a.subtract(BigInteger.ONE)))throw Error("x coordinate out of bounds");if(0>c.compareTo(BigInteger.ONE)||0<c.compareTo(a.subtract(BigInteger.ONE)))throw Error("y coordinate out of bounds");if(!this.isOnCurve())throw Error("Point is not on the curve.");if(this.multiply(a).isInfinity())throw Error("Point is not a scalar multiple of G.");return!0};a.CurveFp=function(e,b,c){this.q=e;this.a=this.fromBigInteger(b);this.b=this.fromBigInteger(c);
  54. this.infinity=new a.PointFp(this,null,null);this.reducer=new Barrett(this.q)};a.CurveFp.prototype.getQ=function(){return this.q};a.CurveFp.prototype.getA=function(){return this.a};a.CurveFp.prototype.getB=function(){return this.b};a.CurveFp.prototype.equals=function(a){return a==this?!0:this.q.equals(a.q)&&this.a.equals(a.a)&&this.b.equals(a.b)};a.CurveFp.prototype.getInfinity=function(){return this.infinity};a.CurveFp.prototype.fromBigInteger=function(e){return new a.FieldElementFp(this.q,e)};a.CurveFp.prototype.reduce=
  55. function(a){this.reducer.reduce(a)};a.CurveFp.prototype.decodePointHex=function(e){var b=parseInt(e.substr(0,2),16);switch(b){case 0:return this.infinity;case 2:case 3:var c=b&1,b=e.substr(2,e.length-2);e=new BigInteger(b,16);return this.decompressPoint(c,e);case 4:case 6:case 7:return c=(e.length-2)/2,b=e.substr(2,c),e=e.substr(c+2,c),new a.PointFp(this,this.fromBigInteger(new BigInteger(b,16)),this.fromBigInteger(new BigInteger(e,16)));default:return null}};a.CurveFp.prototype.encodePointHex=function(a){if(a.isInfinity())return"00";
  56. var b=a.getX().toBigInteger().toString(16);a=a.getY().toBigInteger().toString(16);var c=this.getQ().toString(16).length;for(0!=c%2&&c++;b.length<c;)b="0"+b;for(;a.length<c;)a="0"+a;return"04"+b+a};a.CurveFp.prototype.decompressPoint=function(e,b){var c=this.fromBigInteger(b),f=c.multiply(c.square().add(this.getA())).add(this.getB()).sqrt();if(null==f)throw Error("Invalid point compression");var d=f.toBigInteger();(d.testBit(0)?1:0)!=e&&(f=this.fromBigInteger(this.getQ().subtract(d)));return new a.PointFp(this,
  57. c,f,null,!0)};a.fromHex=function(a){return new BigInteger(a,16)};a.integerToBytes=function(a,b){var c=a.toByteArrayUnsigned();if(b<c.length)c=c.slice(c.length-b);else for(;b>c.length;)c.unshift(0);return c};a.X9Parameters=function(a,b,c,f){this.curve=a;this.g=b;this.n=c;this.h=f};a.X9Parameters.prototype.getCurve=function(){return this.curve};a.X9Parameters.prototype.getG=function(){return this.g};a.X9Parameters.prototype.getN=function(){return this.n};a.X9Parameters.prototype.getH=function(){return this.h};
  58. a.secNamedCurves={secp256k1:function(){var e=a.fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F"),b=BigInteger.ZERO,c=a.fromHex("7"),f=a.fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141"),d=BigInteger.ONE,e=new a.CurveFp(e,b,c),b=e.decodePointHex("0479BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8");return new a.X9Parameters(e,b,f,d)}};a.getSECCurveByName=function(e){return void 0==
  59. a.secNamedCurves[e]?null:a.secNamedCurves[e]()}})();
  60. (function(a,e){function b(a){if(a&&("number"!==typeof a||0!==a%1||a<u.minBits||a>u.maxBits))throw Error("Number of bits must be an integer between "+u.minBits+" and "+u.maxBits+", inclusive.");g.radix=u.radix;g.bits=a||u.bits;g.size=Math.pow(2,g.bits);g.max=g.size-1;a=[];for(var b=[],c=1,d=u.primitivePolynomials[g.bits],f=0;f<g.size;f++)b[f]=c,a[c]=f,c<<=1,c>=g.size&&(c^=d,c&=g.max);g.logs=a;g.exps=b}function c(){return g.bits&&g.size&&g.max&&g.logs&&g.exps&&g.logs.length===g.size&&g.exps.length===
  61. g.size?!0:!1}function f(){function a(b,c,k,n){for(var w="",d=0,f=c.length-1;d<f||w.length<b;)w+=s(parseInt(c[d],k).toString(2),n),d++;w=w.substr(-b);return(w.match(/0/g)||[]).length===w.length?null:w}var b,c;if("function"===typeof require&&(c=require("crypto"))&&(b=c.randomBytes))return function(c){for(var d=Math.ceil(c/8),k=null;null===k;)k=a(c,b(d).toString("hex"),16,4);return k};if(e.crypto&&"function"===typeof e.crypto.getRandomValues&&"function"===typeof e.Uint32Array)return c=e.crypto,function(b){for(var d=
  62. Math.ceil(b/32),k=null,d=new e.Uint32Array(d);null===k;)c.getRandomValues(d),k=a(b,d,10,32);return k};g.unsafePRNG=!0;d();var f=Math.pow(2,32)-1;return function(b){for(var c=Math.ceil(b/32),k=[],n=null;null===n;){for(n=0;n<c;n++)k[n]=Math.floor(Math.random()*f+1);n=a(b,k,10,32)}return n}}function d(){e.console.warn(u.warning);"function"===typeof e.alert&&g.alert&&e.alert(u.warning)}function m(a){var b=parseInt(a[0],36);if(b&&("number"!==typeof b||0!==b%1||b<u.minBits||b>u.maxBits))throw Error("Number of bits must be an integer between "+
  63. u.minBits+" and "+u.maxBits+", inclusive.");var c=Math.pow(2,b)-1,d=c.toString(g.radix).length,f=parseInt(a.substr(1,d),g.radix);if("number"!==typeof f||0!==f%1||1>f||f>c)throw Error("Share id must be an integer between 1 and "+g.max+", inclusive.");a=a.substr(d+1);if(!a.length)throw Error("Invalid share: zero-length share.");return{bits:b,id:f,value:a}}function h(a,c){for(var d,f,e=[],h=[],k="",n,w=0,B=c.length;w<B;w++){f=m(c[w]);if("undefined"===typeof d)d=f.bits;else if(f.bits!==d)throw Error("Mismatched shares: Different bit settings.");
  64. g.bits!==d&&b(d);a:{n=0;for(var D=e.length;n<D;n++)if(e[n]===f.id){n=!0;break a}n=!1}if(!n){n=e.push(f.id)-1;f=r(l(f.value));for(var D=0,E=f.length;D<E;D++)h[D]=h[D]||[],h[D][n]=f[D]}}w=0;for(B=h.length;w<B;w++)k=s(q(a,e,h[w]).toString(2))+k;return 0===a?(n=k.indexOf("1"),t(k.slice(n+1))):t(k)}function q(a,b,c){var d=0,f,e,k;e=0;for(var n=b.length;e<n;e++)if(c[e]){f=g.logs[c[e]];for(k=0;k<n;k++)if(e!==k){if(a===b[k]){f=-1;break}f=(f+g.logs[a^b[k]]-g.logs[b[e]^b[k]]+g.max)%g.max}d=-1===f?d:d^g.exps[f]}return d}
  65. function r(a,b){b&&(a=s(a,b));for(var c=[],d=a.length;d>g.bits;d-=g.bits)c.push(parseInt(a.slice(d-g.bits,d),2));c.push(parseInt(a.slice(0,d),2));return c}function s(a,b){b=b||g.bits;var c=a.length%b;return(c?Array(b-c+1).join("0"):"")+a}function l(a){for(var b="",c,d=a.length-1;0<=d;d--){c=parseInt(a[d],16);if(isNaN(c))throw Error("Invalid hex character.");b=s(c.toString(2),4)+b}return b}function t(a){var b="",c;a=s(a,4);for(var d=a.length;4<=d;d-=4){c=parseInt(a.slice(d-4,d),2);if(isNaN(c))throw Error("Invalid binary character.");
  66. b=c.toString(16)+b}return b}var u={bits:8,radix:16,minBits:3,maxBits:20,bytesPerChar:2,maxBytesPerChar:6,primitivePolynomials:[null,null,1,3,3,5,3,3,29,17,9,5,83,27,43,3,45,9,39,39,9,5,3,33,27,9,71,39,9,5,83],warning:"WARNING:\nA secure random number generator was not found.\nUsing Math.random(), which is NOT cryptographically strong!"},g={};a.getConfig=function(){return{bits:g.bits,unsafePRNG:g.unsafePRNG}};a.init=b;a.setRNG=function(a,b){c()||this.init();g.unsafePRNG=!1;a=a||f();if("function"!==
  67. typeof a||"string"!==typeof a(g.bits)||!parseInt(a(g.bits),2)||a(g.bits).length>g.bits||a(g.bits).length<g.bits)throw Error("Random number generator is invalid. Supply an RNG of the form function(bits){} that returns a string containing 'bits' number of random 1's and 0's.");g.rng=a;g.alert=!!b;return!!g.unsafePRNG};a.random=function(a){"function"!==typeof g.rng&&this.setRNG();if("number"!==typeof a||0!==a%1||2>a)throw Error("Number of bits must be an integer greater than 1.");g.unsafePRNG&&d();return t(g.rng(a))};
  68. a.share=function(a,b,f,e,m){c()||this.init();"function"!==typeof g.rng&&this.setRNG();e=e||0;if("string"!==typeof a)throw Error("Secret must be a string.");if("number"!==typeof b||0!==b%1||2>b)throw Error("Number of shares must be an integer between 2 and 2^bits-1 ("+g.max+"), inclusive.");if(b>g.max)throw m=Math.ceil(Math.log(b+1)/Math.LN2),Error("Number of shares must be an integer between 2 and 2^bits-1 ("+g.max+"), inclusive. To create "+b+" shares, use at least "+m+" bits.");if("number"!==typeof f||
  69. 0!==f%1||2>f)throw Error("Threshold number of shares must be an integer between 2 and 2^bits-1 ("+g.max+"), inclusive.");if(f>g.max)throw m=Math.ceil(Math.log(f+1)/Math.LN2),Error("Threshold number of shares must be an integer between 2 and 2^bits-1 ("+g.max+"), inclusive.  To use a threshold of "+f+", use at least "+m+" bits.");if("number"!==typeof e||0!==e%1)throw Error("Zero-pad length must be an integer greater than 1.");g.unsafePRNG&&d();a="1"+l(a);a=r(a,e);e=Array(b);for(var h=Array(b),k=0,
  70. n=a.length;k<n;k++)for(var w=this._getShares(a[k],b,f),B=0;B<b;B++)e[B]=e[B]||w[B].x.toString(g.radix),h[B]=s(w[B].y.toString(2))+(h[B]?h[B]:"");f=g.max.toString(g.radix).length;if(m)for(k=0;k<b;k++)e[k]=t(h[k]);else for(k=0;k<b;k++)e[k]=g.bits.toString(36).toUpperCase()+s(e[k],f)+t(h[k]);return e};a._getShares=function(a,b,c){var d=[];a=[a];for(var f=1;f<c;f++)a[f]=parseInt(g.rng(g.bits),2);f=1;for(b+=1;f<b;f++){c=d;for(var e=f-1,k=f,n=g.logs[f],w=0,B=a.length-1;0<=B;B--)w=0===w?a[B]:g.exps[(n+g.logs[w])%
  71. g.max]^a[B];c[e]={x:k,y:w}}return d};a._processShare=m;a.combine=function(a){return h(0,a)};a.newShare=function(a,b){"string"===typeof a&&(a=parseInt(a,g.radix));var c=m(b[0]),c=Math.pow(2,c.bits)-1;if("number"!==typeof a||0!==a%1||1>a||a>c)throw Error("Share id must be an integer between 1 and "+g.max+", inclusive.");c=c.toString(g.radix).length;return g.bits.toString(36).toUpperCase()+s(a.toString(g.radix),c)+h(a,b)};a._lagrange=q;a.str2hex=function(a,b){if("string"!==typeof a)throw Error("Input must be a character string.");
  72. b=b||u.bytesPerChar;if("number"!==typeof b||0!==b%1||1>b||b>u.maxBytesPerChar)throw Error("Bytes per character must be an integer between 1 and "+u.maxBytesPerChar+", inclusive.");for(var c=2*b,d=Math.pow(16,c)-1,f="",e,k=0,n=a.length;k<n;k++){e=a[k].charCodeAt();if(isNaN(e))throw Error("Invalid character: "+a[k]);if(e>d)throw c=Math.ceil(Math.log(e+1)/Math.log(256)),Error("Invalid character code ("+e+"). Maximum allowable is 256^bytes-1 ("+d+"). To convert this character, use at least "+c+" bytes.");
  73. f=s(e.toString(16),c)+f}return f};a.hex2str=function(a,b){if("string"!==typeof a)throw Error("Input must be a hexadecimal string.");b=b||u.bytesPerChar;if("number"!==typeof b||0!==b%1||1>b||b>u.maxBytesPerChar)throw Error("Bytes per character must be an integer between 1 and "+u.maxBytesPerChar+", inclusive.");var c=2*b,d="";a=s(a,c);for(var f=0,e=a.length;f<e;f+=c)d=String.fromCharCode(parseInt(a.slice(f,f+c),16))+d;return d};a.init()})("undefined"!==typeof module&&module.exports?module.exports:
  74. window.secrets={},"undefined"!==typeof GLOBAL?GLOBAL:window);
  75. (function(){function a(){return new l(null)}function e(a,b,c,d,f,e){for(;0<=--e;){var m=b*this[a++]+c[d]+f;f=Math.floor(m/67108864);c[d++]=m&67108863}return f}function b(a,b,c,d,f,e){var m=b&32767;for(b>>=15;0<=--e;){var g=this[a]&32767,l=this[a++]>>15,h=b*g+l*m,g=m*g+((h&32767)<<15)+c[d]+(f&1073741823);f=(g>>>30)+(h>>>15)+b*l+(f>>>30);c[d++]=g&1073741823}return f}function c(a,b,c,d,f,e){var m=b&16383;for(b>>=14;0<=--e;){var g=this[a]&16383,l=this[a++]>>14,h=b*g+l*m,g=m*g+((h&16383)<<14)+c[d]+f;f=
  76. (g>>28)+(h>>14)+b*l;c[d++]=g&268435455}return f}function f(a,b){var c=u[a.charCodeAt(b)];return null==c?-1:c}function d(b){var c=a();c.fromInt(b);return c}function m(a){var b=1,c;0!=(c=a>>>16)&&(a=c,b+=16);0!=(c=a>>8)&&(a=c,b+=8);0!=(c=a>>4)&&(a=c,b+=4);0!=(c=a>>2)&&(a=c,b+=2);0!=a>>1&&(b+=1);return b}function h(a,b){return a&b}function q(a,b){return a|b}function r(a,b){return a^b}function s(a,b){return a&~b}var l=window.BigInteger=function(a,b,c){null!=a&&("number"==typeof a?this.fromNumber(a,b,
  77. c):null==b&&"string"!=typeof a?this.fromString(a,256):this.fromString(a,b))},t;"Microsoft Internet Explorer"==navigator.appName?(l.prototype.am=b,t=30):"Netscape"!=navigator.appName?(l.prototype.am=e,t=26):(l.prototype.am=c,t=28);l.prototype.DB=t;l.prototype.DM=(1<<t)-1;l.prototype.DV=1<<t;l.prototype.FV=Math.pow(2,52);l.prototype.F1=52-t;l.prototype.F2=2*t-52;var u=[],g;t=48;for(g=0;9>=g;++g)u[t++]=g;t=97;for(g=10;36>g;++g)u[t++]=g;t=65;for(g=10;36>g;++g)u[t++]=g;l.prototype.copyTo=function(a){for(var b=
  78. this.t-1;0<=b;--b)a[b]=this[b];a.t=this.t;a.s=this.s};l.prototype.fromInt=function(a){this.t=1;this.s=0>a?-1:0;0<a?this[0]=a:-1>a?this[0]=a+this.DV:this.t=0};l.prototype.fromString=function(a,b){var c;if(16==b)c=4;else if(8==b)c=3;else if(256==b)c=8;else if(2==b)c=1;else if(32==b)c=5;else if(4==b)c=2;else{this.fromRadix(a,b);return}this.s=this.t=0;for(var d=a.length,e=!1,m=0;0<=--d;){var g=8==c?a[d]&255:f(a,d);0>g?"-"==a.charAt(d)&&(e=!0):(e=!1,0==m?this[this.t++]=g:m+c>this.DB?(this[this.t-1]|=(g&
  79. (1<<this.DB-m)-1)<<m,this[this.t++]=g>>this.DB-m):this[this.t-1]|=g<<m,m+=c,m>=this.DB&&(m-=this.DB))}8==c&&0!=(a[0]&128)&&(this.s=-1,0<m&&(this[this.t-1]|=(1<<this.DB-m)-1<<m));this.clamp();e&&l.ZERO.subTo(this,this)};l.prototype.clamp=function(){for(var a=this.s&this.DM;0<this.t&&this[this.t-1]==a;)--this.t};l.prototype.dlShiftTo=function(a,b){var c;for(c=this.t-1;0<=c;--c)b[c+a]=this[c];for(c=a-1;0<=c;--c)b[c]=0;b.t=this.t+a;b.s=this.s};l.prototype.drShiftTo=function(a,b){for(var c=a;c<this.t;++c)b[c-
  80. a]=this[c];b.t=Math.max(this.t-a,0);b.s=this.s};l.prototype.lShiftTo=function(a,b){var c=a%this.DB,d=this.DB-c,f=(1<<d)-1,e=Math.floor(a/this.DB),m=this.s<<c&this.DM,g;for(g=this.t-1;0<=g;--g)b[g+e+1]=this[g]>>d|m,m=(this[g]&f)<<c;for(g=e-1;0<=g;--g)b[g]=0;b[e]=m;b.t=this.t+e+1;b.s=this.s;b.clamp()};l.prototype.rShiftTo=function(a,b){b.s=this.s;var c=Math.floor(a/this.DB);if(c>=this.t)b.t=0;else{var d=a%this.DB,f=this.DB-d,e=(1<<d)-1;b[0]=this[c]>>d;for(var m=c+1;m<this.t;++m)b[m-c-1]|=(this[m]&e)<<
  81. f,b[m-c]=this[m]>>d;0<d&&(b[this.t-c-1]|=(this.s&e)<<f);b.t=this.t-c;b.clamp()}};l.prototype.subTo=function(a,b){for(var c=0,d=0,f=Math.min(a.t,this.t);c<f;)d+=this[c]-a[c],b[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d-=a.s;c<this.t;)d+=this[c],b[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d-=a[c],b[c++]=d&this.DM,d>>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b[c++]=this.DV+d:0<d&&(b[c++]=d);b.t=c;b.clamp()};l.prototype.multiplyTo=function(a,b){var c=this.abs(),d=a.abs(),f=c.t;for(b.t=
  82. f+d.t;0<=--f;)b[f]=0;for(f=0;f<d.t;++f)b[f+c.t]=c.am(0,d[f],b,f,0,c.t);b.s=0;b.clamp();this.s!=a.s&&l.ZERO.subTo(b,b)};l.prototype.squareTo=function(a){for(var b=this.abs(),c=a.t=2*b.t;0<=--c;)a[c]=0;for(c=0;c<b.t-1;++c){var d=b.am(c,b[c],a,2*c,0,1);(a[c+b.t]+=b.am(c+1,2*b[c],a,2*c+1,d,b.t-c-1))>=b.DV&&(a[c+b.t]-=b.DV,a[c+b.t+1]=1)}0<a.t&&(a[a.t-1]+=b.am(c,b[c],a,2*c,0,1));a.s=0;a.clamp()};l.prototype.divRemTo=function(b,c,d){var f=b.abs();if(!(0>=f.t)){var e=this.abs();if(e.t<f.t)null!=c&&c.fromInt(0),
  83. null!=d&&this.copyTo(d);else{null==d&&(d=a());var g=a(),h=this.s;b=b.s;var q=this.DB-m(f[f.t-1]);0<q?(f.lShiftTo(q,g),e.lShiftTo(q,d)):(f.copyTo(g),e.copyTo(d));f=g.t;e=g[f-1];if(0!=e){var r=e*(1<<this.F1)+(1<f?g[f-2]>>this.F2:0),s=this.FV/r,r=(1<<this.F1)/r,p=1<<this.F2,t=d.t,x=t-f,u=null==c?a():c;g.dlShiftTo(x,u);0<=d.compareTo(u)&&(d[d.t++]=1,d.subTo(u,d));l.ONE.dlShiftTo(f,u);for(u.subTo(g,g);g.t<f;)g[g.t++]=0;for(;0<=--x;){var v=d[--t]==e?this.DM:Math.floor(d[t]*s+(d[t-1]+p)*r);if((d[t]+=g.am(0,
  84. v,d,x,0,f))<v)for(g.dlShiftTo(x,u),d.subTo(u,d);d[t]<--v;)d.subTo(u,d)}null!=c&&(d.drShiftTo(f,c),h!=b&&l.ZERO.subTo(c,c));d.t=f;d.clamp();0<q&&d.rShiftTo(q,d);0>h&&l.ZERO.subTo(d,d)}}}};l.prototype.invDigit=function(){if(1>this.t)return 0;var a=this[0];if(0==(a&1))return 0;var b=a&3,b=b*(2-(a&15)*b)&15,b=b*(2-(a&255)*b)&255,b=b*(2-((a&65535)*b&65535))&65535,b=b*(2-a*b%this.DV)%this.DV;return 0<b?this.DV-b:-b};l.prototype.isEven=function(){return 0==(0<this.t?this[0]&1:this.s)};l.prototype.exp=function(b,
  85. c){if(4294967295<b||1>b)return l.ONE;var d=a(),f=a(),e=c.convert(this),g=m(b)-1;for(e.copyTo(d);0<=--g;)if(c.sqrTo(d,f),0<(b&1<<g))c.mulTo(f,e,d);else var h=d,d=f,f=h;return c.revert(d)};l.prototype.toString=function(a){if(0>this.s)return"-"+this.negate().toString(a);if(16==a)a=4;else if(8==a)a=3;else if(2==a)a=1;else if(32==a)a=5;else if(4==a)a=2;else return this.toRadix(a);var b=(1<<a)-1,c,d=!1,f="",e=this.t,m=this.DB-e*this.DB%a;if(0<e--)for(m<this.DB&&0<(c=this[e]>>m)&&(d=!0,f="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=
  86. e;)m<a?(c=(this[e]&(1<<m)-1)<<a-m,c|=this[--e]>>(m+=this.DB-a)):(c=this[e]>>(m-=a)&b,0>=m&&(m+=this.DB,--e)),0<c&&(d=!0),d&&(f+="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));return d?f:"0"};l.prototype.negate=function(){var b=a();l.ZERO.subTo(this,b);return b};l.prototype.abs=function(){return 0>this.s?this.negate():this};l.prototype.compareTo=function(a){var b=this.s-a.s;if(0!=b)return b;var c=this.t,b=c-a.t;if(0!=b)return 0>this.s?-b:b;for(;0<=--c;)if(0!=(b=this[c]-a[c]))return b;return 0};
  87. l.prototype.bitLength=function(){return 0>=this.t?0:this.DB*(this.t-1)+m(this[this.t-1]^this.s&this.DM)};l.prototype.mod=function(b){var c=a();this.abs().divRemTo(b,null,c);0>this.s&&0<c.compareTo(l.ZERO)&&b.subTo(c,c);return c};l.prototype.modPowInt=function(a,b){var c;c=256>a||b.isEven()?new x(b):new y(b);return this.exp(a,c)};l.ZERO=d(0);l.ONE=d(1);var v=[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,
  88. 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],
  89. C=67108864/v[v.length-1];l.prototype.chunkSize=function(a){return Math.floor(Math.LN2*this.DB/Math.log(a))};l.prototype.toRadix=function(b){null==b&&(b=10);if(0==this.signum()||2>b||36<b)return"0";var c=this.chunkSize(b),c=Math.pow(b,c),f=d(c),e=a(),m=a(),g="";for(this.divRemTo(f,e,m);0<e.signum();)g=(c+m.intValue()).toString(b).substr(1)+g,e.divRemTo(f,e,m);return m.intValue().toString(b)+g};l.prototype.fromRadix=function(a,b){this.fromInt(0);null==b&&(b=10);for(var c=this.chunkSize(b),d=Math.pow(b,
  90. c),e=!1,m=0,g=0,h=0;h<a.length;++h){var q=f(a,h);0>q?"-"==a.charAt(h)&&0==this.signum()&&(e=!0):(g=b*g+q,++m>=c&&(this.dMultiply(d),this.dAddOffset(g,0),g=m=0))}0<m&&(this.dMultiply(Math.pow(b,m)),this.dAddOffset(g,0));e&&l.ZERO.subTo(this,this)};l.prototype.fromNumber=function(a,b,c){if("number"==typeof b)if(2>a)this.fromInt(1);else for(this.fromNumber(a,c),this.testBit(a-1)||this.bitwiseTo(l.ONE.shiftLeft(a-1),q,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,
  91. 0),this.bitLength()>a&&this.subTo(l.ONE.shiftLeft(a-1),this);else{c=[];var d=a&7;c.length=(a>>3)+1;b.nextBytes(c);c[0]=0<d?c[0]&(1<<d)-1:0;this.fromString(c,256)}};l.prototype.bitwiseTo=function(a,b,c){var d,f,e=Math.min(a.t,this.t);for(d=0;d<e;++d)c[d]=b(this[d],a[d]);if(a.t<this.t){f=a.s&this.DM;for(d=e;d<this.t;++d)c[d]=b(this[d],f);c.t=this.t}else{f=this.s&this.DM;for(d=e;d<a.t;++d)c[d]=b(f,a[d]);c.t=a.t}c.s=b(this.s,a.s);c.clamp()};l.prototype.changeBit=function(a,b){var c=l.ONE.shiftLeft(a);
  92. this.bitwiseTo(c,b,c);return c};l.prototype.addTo=function(a,b){for(var c=0,d=0,f=Math.min(a.t,this.t);c<f;)d+=this[c]+a[c],b[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d+=a.s;c<this.t;)d+=this[c],b[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d+=a[c],b[c++]=d&this.DM,d>>=this.DB;d+=a.s}b.s=0>d?-1:0;0<d?b[c++]=d:-1>d&&(b[c++]=this.DV+d);b.t=c;b.clamp()};l.prototype.dMultiply=function(a){this[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()};l.prototype.dAddOffset=
  93. function(a,b){if(0!=a){for(;this.t<=b;)this[this.t++]=0;for(this[b]+=a;this[b]>=this.DV;)this[b]-=this.DV,++b>=this.t&&(this[this.t++]=0),++this[b]}};l.prototype.multiplyLowerTo=function(a,b,c){var d=Math.min(this.t+a.t,b);c.s=0;for(c.t=d;0<d;)c[--d]=0;var f;for(f=c.t-this.t;d<f;++d)c[d+this.t]=this.am(0,a[d],c,d,0,this.t);for(f=Math.min(a.t,b);d<f;++d)this.am(0,a[d],c,d,0,b-d);c.clamp()};l.prototype.multiplyUpperTo=function(a,b,c){--b;var d=c.t=this.t+a.t-b;for(c.s=0;0<=--d;)c[d]=0;for(d=Math.max(b-
  94. this.t,0);d<a.t;++d)c[this.t+d-b]=this.am(b-d,a[d],c,0,0,this.t+d-b);c.clamp();c.drShiftTo(1,c)};l.prototype.modInt=function(a){if(0>=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0<this.t)if(0==b)c=this[0]%a;else for(var d=this.t-1;0<=d;--d)c=(b*c+this[d])%a;return c};l.prototype.millerRabin=function(b){var c=this.subtract(l.ONE),d=c.getLowestSetBit();if(0>=d)return!1;var f=c.shiftRight(d);b=b+1>>1;b>v.length&&(b=v.length);for(var e=a(),m=0;m<b;++m){e.fromInt(v[Math.floor(Math.random()*v.length)]);
  95. var g=e.modPow(f,this);if(0!=g.compareTo(l.ONE)&&0!=g.compareTo(c)){for(var h=1;h++<d&&0!=g.compareTo(c);)if(g=g.modPowInt(2,this),0==g.compareTo(l.ONE))return!1;if(0!=g.compareTo(c))return!1}}return!0};l.prototype.clone=function(){var b=a();this.copyTo(b);return b};l.prototype.intValue=function(){if(0>this.s){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]};l.prototype.byteValue=function(){return 0==
  96. this.t?this.s:this[0]<<24>>24};l.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16};l.prototype.signum=function(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this[0]?0:1};l.prototype.toByteArray=function(){var a=this.t,b=[];b[0]=this.s;var c=this.DB-a*this.DB%8,d,f=0;if(0<a--)for(c<this.DB&&(d=this[a]>>c)!=(this.s&this.DM)>>c&&(b[f++]=d|this.s<<this.DB-c);0<=a;)if(8>c?(d=(this[a]&(1<<c)-1)<<8-c,d|=this[--a]>>(c+=this.DB-8)):(d=this[a]>>(c-=8)&255,0>=c&&(c+=this.DB,--a)),0!=(d&
  97. 128)&&(d|=-256),0==f&&(this.s&128)!=(d&128)&&++f,0<f||d!=this.s)b[f++]=d;return b};l.prototype.equals=function(a){return 0==this.compareTo(a)};l.prototype.min=function(a){return 0>this.compareTo(a)?this:a};l.prototype.max=function(a){return 0<this.compareTo(a)?this:a};l.prototype.and=function(b){var c=a();this.bitwiseTo(b,h,c);return c};l.prototype.or=function(b){var c=a();this.bitwiseTo(b,q,c);return c};l.prototype.xor=function(b){var c=a();this.bitwiseTo(b,r,c);return c};l.prototype.andNot=function(b){var c=
  98. a();this.bitwiseTo(b,s,c);return c};l.prototype.not=function(){for(var b=a(),c=0;c<this.t;++c)b[c]=this.DM&~this[c];b.t=this.t;b.s=~this.s;return b};l.prototype.shiftLeft=function(b){var c=a();0>b?this.rShiftTo(-b,c):this.lShiftTo(b,c);return c};l.prototype.shiftRight=function(b){var c=a();0>b?this.lShiftTo(-b,c):this.rShiftTo(b,c);return c};l.prototype.getLowestSetBit=function(){for(var a=0;a<this.t;++a)if(0!=this[a]){var b=a*this.DB;a=this[a];if(0==a)a=-1;else{var c=0;0==(a&65535)&&(a>>=16,c+=16);
  99. 0==(a&255)&&(a>>=8,c+=8);0==(a&15)&&(a>>=4,c+=4);0==(a&3)&&(a>>=2,c+=2);0==(a&1)&&++c;a=c}return b+a}return 0>this.s?this.t*this.DB:-1};l.prototype.bitCount=function(){for(var a=0,b=this.s&this.DM,c=0;c<this.t;++c){for(var d=this[c]^b,f=0;0!=d;)d&=d-1,++f;a+=f}return a};l.prototype.testBit=function(a){var b=Math.floor(a/this.DB);return b>=this.t?0!=this.s:0!=(this[b]&1<<a%this.DB)};l.prototype.setBit=function(a){return this.changeBit(a,q)};l.prototype.clearBit=function(a){return this.changeBit(a,
  100. s)};l.prototype.flipBit=function(a){return this.changeBit(a,r)};l.prototype.add=function(b){var c=a();this.addTo(b,c);return c};l.prototype.subtract=function(b){var c=a();this.subTo(b,c);return c};l.prototype.multiply=function(b){var c=a();this.multiplyTo(b,c);return c};l.prototype.divide=function(b){var c=a();this.divRemTo(b,c,null);return c};l.prototype.remainder=function(b){var c=a();this.divRemTo(b,null,c);return c};l.prototype.divideAndRemainder=function(b){var c=a(),d=a();this.divRemTo(b,c,
  101. d);return[c,d]};l.prototype.modPow=function(b,c){var f=b.bitLength(),e,g=d(1),h;if(0>=f)return g;e=18>f?1:48>f?3:144>f?4:768>f?5:6;h=8>f?new x(c):c.isEven()?new z(c):new y(c);var l=[],q=3,r=e-1,t=(1<<e)-1;l[1]=h.convert(this);if(1<e)for(f=a(),h.sqrTo(l[1],f);q<=t;)l[q]=a(),h.mulTo(f,l[q-2],l[q]),q+=2;for(var p=b.t-1,s,u=!0,v=a(),f=m(b[p])-1;0<=p;){f>=r?s=b[p]>>f-r&t:(s=(b[p]&(1<<f+1)-1)<<r-f,0<p&&(s|=b[p-1]>>this.DB+f-r));for(q=e;0==(s&1);)s>>=1,--q;0>(f-=q)&&(f+=this.DB,--p);if(u)l[s].copyTo(g),
  102. u=!1;else{for(;1<q;)h.sqrTo(g,v),h.sqrTo(v,g),q-=2;0<q?h.sqrTo(g,v):(q=g,g=v,v=q);h.mulTo(v,l[s],g)}for(;0<=p&&0==(b[p]&1<<f);)h.sqrTo(g,v),q=g,g=v,v=q,0>--f&&(f=this.DB-1,--p)}return h.revert(g)};l.prototype.modInverse=function(a){var b=a.isEven();if(this.isEven()&&b||0==a.signum())return l.ZERO;for(var c=a.clone(),f=this.clone(),e=d(1),m=d(0),g=d(0),h=d(1);0!=c.signum();){for(;c.isEven();)c.rShiftTo(1,c),b?(e.isEven()&&m.isEven()||(e.addTo(this,e),m.subTo(a,m)),e.rShiftTo(1,e)):m.isEven()||m.subTo(a,
  103. m),m.rShiftTo(1,m);for(;f.isEven();)f.rShiftTo(1,f),b?(g.isEven()&&h.isEven()||(g.addTo(this,g),h.subTo(a,h)),g.rShiftTo(1,g)):h.isEven()||h.subTo(a,h),h.rShiftTo(1,h);0<=c.compareTo(f)?(c.subTo(f,c),b&&e.subTo(g,e),m.subTo(h,m)):(f.subTo(c,f),b&&g.subTo(e,g),h.subTo(m,h))}if(0!=f.compareTo(l.ONE))return l.ZERO;if(0<=h.compareTo(a))return h.subtract(a);if(0>h.signum())h.addTo(a,h);else return h;return 0>h.signum()?h.add(a):h};l.prototype.pow=function(a){return this.exp(a,new A)};l.prototype.gcd=function(a){var b=
  104. 0>this.s?this.negate():this.clone();a=0>a.s?a.negate():a.clone();if(0>b.compareTo(a)){var c=b,b=a;a=c}var c=b.getLowestSetBit(),d=a.getLowestSetBit();if(0>d)return b;c<d&&(d=c);0<d&&(b.rShiftTo(d,b),a.rShiftTo(d,a));for(;0<b.signum();)0<(c=b.getLowestSetBit())&&b.rShiftTo(c,b),0<(c=a.getLowestSetBit())&&a.rShiftTo(c,a),0<=b.compareTo(a)?(b.subTo(a,b),b.rShiftTo(1,b)):(a.subTo(b,a),a.rShiftTo(1,a));0<d&&a.lShiftTo(d,a);return a};l.prototype.isProbablePrime=function(a){var b,c=this.abs();if(1==c.t&&
  105. c[0]<=v[v.length-1]){for(b=0;b<v.length;++b)if(c[0]==v[b])return!0;return!1}if(c.isEven())return!1;for(b=1;b<v.length;){for(var d=v[b],f=b+1;f<v.length&&d<C;)d*=v[f++];for(d=c.modInt(d);b<f;)if(0==d%v[b++])return!1}return c.millerRabin(a)};l.prototype.square=function(){var b=a();this.squareTo(b);return b};l.valueOf=d;l.prototype.toByteArrayUnsigned=function(){var a=this.abs().toByteArray();return a.length?(0==a[0]&&(a=a.slice(1)),a.map(function(a){return 0>a?a+256:a})):a};l.fromByteArrayUnsigned=
  106. function(a){return a.length?a[0]&128?new l([0].concat(a)):new l(a):a.valueOf(0)};l.prototype.toByteArraySigned=function(){var a=this.abs().toByteArrayUnsigned();0>this.compareTo(l.ZERO)?a[0]&128?a.unshift(128):a[0]|=128:a[0]&128&&a.unshift(0);return a};l.fromByteArraySigned=function(a){return a[0]&128?(a[0]&=127,l.fromByteArrayUnsigned(a).negate()):l.fromByteArrayUnsigned(a)};var x=window.Classic=function(a){this.m=a};x.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):
  107. a};x.prototype.revert=function(a){return a};x.prototype.reduce=function(a){a.divRemTo(this.m,null,a)};x.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};x.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var y=window.Montgomery=function(a){this.m=a;this.mp=a.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<a.DB-15)-1;this.mt2=2*a.t};y.prototype.convert=function(b){var c=a();b.abs().dlShiftTo(this.m.t,c);c.divRemTo(this.m,null,c);0>b.s&&0<c.compareTo(l.ZERO)&&
  108. this.m.subTo(c,c);return c};y.prototype.revert=function(b){var c=a();b.copyTo(c);this.reduce(c);return c};y.prototype.reduce=function(a){for(;a.t<=this.mt2;)a[a.t++]=0;for(var b=0;b<this.m.t;++b){var c=a[b]&32767,d=c*this.mpl+((c*this.mph+(a[b]>>15)*this.mpl&this.um)<<15)&a.DM,c=b+this.m.t;for(a[c]+=this.m.am(0,d,a,b,0,this.m.t);a[c]>=a.DV;)a[c]-=a.DV,a[++c]++}a.clamp();a.drShiftTo(this.m.t,a);0<=a.compareTo(this.m)&&a.subTo(this.m,a)};y.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};
  109. y.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var A=window.NullExp=function(){};A.prototype.convert=function(a){return a};A.prototype.revert=function(a){return a};A.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};A.prototype.sqrTo=function(a,b){a.squareTo(b)};var z=window.Barrett=function(b){this.r2=a();this.q3=a();l.ONE.dlShiftTo(2*b.t,this.r2);this.mu=this.r2.divide(b);this.m=b};z.prototype.convert=function(b){if(0>b.s||b.t>2*this.m.t)return b.mod(this.m);if(0>b.compareTo(this.m))return b;
  110. var c=a();b.copyTo(c);this.reduce(c);return c};z.prototype.revert=function(a){return a};z.prototype.reduce=function(a){a.drShiftTo(this.m.t-1,this.r2);a.t>this.m.t+1&&(a.t=this.m.t+1,a.clamp());this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);for(this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>a.compareTo(this.r2);)a.dAddOffset(1,this.m.t+1);for(a.subTo(this.r2,a);0<=a.compareTo(this.m);)a.subTo(this.m,a)};z.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};z.prototype.sqrTo=
  111. function(a,b){a.squareTo(b);this.reduce(b)}})();
  112. (function(){var a=window.QRCode=function(a,c){this.typeNumber=a;this.errorCorrectLevel=c;this.modules=null;this.moduleCount=0;this.dataCache=null;this.dataList=[]};a.prototype={addData:function(b){b=new a.QR8bitByte(b);this.dataList.push(b);this.dataCache=null},isDark:function(a,c){if(0>a||this.moduleCount<=a||0>c||this.moduleCount<=c)throw Error(a+","+c);return this.modules[a][c]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(b,
  113. c){this.moduleCount=4*this.typeNumber+17;this.modules=Array(this.moduleCount);for(var f=0;f<this.moduleCount;f++){this.modules[f]=Array(this.moduleCount);for(var d=0;d<this.moduleCount;d++)this.modules[f][d]=null}this.setupPositionProbePattern(0,0);this.setupPositionProbePattern(this.moduleCount-7,0);this.setupPositionProbePattern(0,this.moduleCount-7);this.setupPositionAdjustPattern();this.setupTimingPattern();this.setupTypeInfo(b,c);7<=this.typeNumber&&this.setupTypeNumber(b);null==this.dataCache&&
  114. (this.dataCache=a.createData(this.typeNumber,this.errorCorrectLevel,this.dataList));this.mapData(this.dataCache,c)},setupPositionProbePattern:function(a,c){for(var f=-1;7>=f;f++)if(!(-1>=a+f||this.moduleCount<=a+f))for(var d=-1;7>=d;d++)-1>=c+d||this.moduleCount<=c+d||(this.modules[a+f][c+d]=0<=f&&6>=f&&(0==d||6==d)||0<=d&&6>=d&&(0==f||6==f)||2<=f&&4>=f&&2<=d&&4>=d?!0:!1)},getBestMaskPattern:function(){for(var b=0,c=0,f=0;8>f;f++){this.makeImpl(!0,f);var d=a.Util.getLostPoint(this);if(0==f||b>d)b=
  115. d,c=f}return c},createMovieClip:function(a,c,f){a=a.createEmptyMovieClip(c,f);this.make();for(c=0;c<this.modules.length;c++){f=1*c;for(var d=0;d<this.modules[c].length;d++){var e=1*d;this.modules[c][d]&&(a.beginFill(0,100),a.moveTo(e,f),a.lineTo(e+1,f),a.lineTo(e+1,f+1),a.lineTo(e,f+1),a.endFill())}}return a},setupTimingPattern:function(){for(var a=8;a<this.moduleCount-8;a++)null==this.modules[a][6]&&(this.modules[a][6]=0==a%2);for(a=8;a<this.moduleCount-8;a++)null==this.modules[6][a]&&(this.modules[6][a]=
  116. 0==a%2)},setupPositionAdjustPattern:function(){for(var b=a.Util.getPatternPosition(this.typeNumber),c=0;c<b.length;c++)for(var f=0;f<b.length;f++){var d=b[c],e=b[f];if(null==this.modules[d][e])for(var h=-2;2>=h;h++)for(var q=-2;2>=q;q++)this.modules[d+h][e+q]=-2==h||2==h||-2==q||2==q||0==h&&0==q?!0:!1}},setupTypeNumber:function(b){for(var c=a.Util.getBCHTypeNumber(this.typeNumber),f=0;18>f;f++){var d=!b&&1==(c>>f&1);this.modules[Math.floor(f/3)][f%3+this.moduleCount-8-3]=d}for(f=0;18>f;f++)d=!b&&
  117. 1==(c>>f&1),this.modules[f%3+this.moduleCount-8-3][Math.floor(f/3)]=d},setupTypeInfo:function(b,c){for(var f=a.Util.getBCHTypeInfo(this.errorCorrectLevel<<3|c),d=0;15>d;d++){var e=!b&&1==(f>>d&1);6>d?this.modules[d][8]=e:8>d?this.modules[d+1][8]=e:this.modules[this.moduleCount-15+d][8]=e}for(d=0;15>d;d++)e=!b&&1==(f>>d&1),8>d?this.modules[8][this.moduleCount-d-1]=e:9>d?this.modules[8][15-d-1+1]=e:this.modules[8][15-d-1]=e;this.modules[this.moduleCount-8][8]=!b},mapData:function(b,c){for(var f=-1,
  118. d=this.moduleCount-1,e=7,h=0,q=this.moduleCount-1;0<q;q-=2)for(6==q&&q--;;){for(var r=0;2>r;r++)if(null==this.modules[d][q-r]){var s=!1;h<b.length&&(s=1==(b[h]>>>e&1));a.Util.getMask(c,d,q-r)&&(s=!s);this.modules[d][q-r]=s;e--; -1==e&&(h++,e=7)}d+=f;if(0>d||this.moduleCount<=d){d-=f;f=-f;break}}}};a.PAD0=236;a.PAD1=17;a.createData=function(b,c,f){c=a.RSBlock.getRSBlocks(b,c);for(var d=new a.BitBuffer,e=0;e<f.length;e++){var h=f[e];d.put(h.mode,4);d.put(h.getLength(),a.Util.getLengthInBits(h.mode,
  119. b));h.write(d)}for(e=b=0;e<c.length;e++)b+=c[e].dataCount;if(d.getLengthInBits()>8*b)throw Error("code length overflow. ("+d.getLengthInBits()+">"+8*b+")");for(d.getLengthInBits()+4<=8*b&&d.put(0,4);0!=d.getLengthInBits()%8;)d.putBit(!1);for(;!(d.getLengthInBits()>=8*b);){d.put(a.PAD0,8);if(d.getLengthInBits()>=8*b)break;d.put(a.PAD1,8)}return a.createBytes(d,c)};a.createBytes=function(b,c){for(var f=0,d=0,e=0,h=Array(c.length),q=Array(c.length),r=0;r<c.length;r++){var s=c[r].dataCount,l=c[r].totalCount-
  120. s,d=Math.max(d,s),e=Math.max(e,l);h[r]=Array(s);for(var t=0;t<h[r].length;t++)h[r][t]=255&b.buffer[t+f];f+=s;t=a.Util.getErrorCorrectPolynomial(l);s=(new a.Polynomial(h[r],t.getLength()-1)).mod(t);q[r]=Array(t.getLength()-1);for(t=0;t<q[r].length;t++)l=t+s.getLength()-q[r].length,q[r][t]=0<=l?s.get(l):0}for(t=r=0;t<c.length;t++)r+=c[t].totalCount;f=Array(r);for(t=s=0;t<d;t++)for(r=0;r<c.length;r++)t<h[r].length&&(f[s++]=h[r][t]);for(t=0;t<e;t++)for(r=0;r<c.length;r++)t<q[r].length&&(f[s++]=q[r][t]);
  121. return f};a.QR8bitByte=function(b){this.mode=a.Mode.MODE_8BIT_BYTE;this.data=b};a.QR8bitByte.prototype={getLength:function(a){return this.data.length},write:function(a){for(var c=0;c<this.data.length;c++)a.put(this.data.charCodeAt(c),8)}};a.Mode={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8};a.ErrorCorrectLevel={L:1,M:0,Q:3,H:2};a.MaskPattern={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};a.Util={PATTERN_POSITION_TABLE:[[],
  122. [6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,
  123. 154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(b){for(var c=b<<10;0<=a.Util.getBCHDigit(c)-a.Util.getBCHDigit(a.Util.G15);)c^=a.Util.G15<<a.Util.getBCHDigit(c)-a.Util.getBCHDigit(a.Util.G15);return(b<<10|c)^a.Util.G15_MASK},getBCHTypeNumber:function(b){for(var c=b<<12;0<=a.Util.getBCHDigit(c)-a.Util.getBCHDigit(a.Util.G18);)c^=a.Util.G18<<a.Util.getBCHDigit(c)-a.Util.getBCHDigit(a.Util.G18);
  124. return b<<12|c},getBCHDigit:function(a){for(var c=0;0!=a;)c++,a>>>=1;return c},getPatternPosition:function(b){return a.Util.PATTERN_POSITION_TABLE[b-1]},getMask:function(b,c,f){switch(b){case a.MaskPattern.PATTERN000:return 0==(c+f)%2;case a.MaskPattern.PATTERN001:return 0==c%2;case a.MaskPattern.PATTERN010:return 0==f%3;case a.MaskPattern.PATTERN011:return 0==(c+f)%3;case a.MaskPattern.PATTERN100:return 0==(Math.floor(c/2)+Math.floor(f/3))%2;case a.MaskPattern.PATTERN101:return 0==c*f%2+c*f%3;case a.MaskPattern.PATTERN110:return 0==
  125. (c*f%2+c*f%3)%2;case a.MaskPattern.PATTERN111:return 0==(c*f%3+(c+f)%2)%2;default:throw Error("bad maskPattern:"+b);}},getErrorCorrectPolynomial:function(b){for(var c=new a.Polynomial([1],0),f=0;f<b;f++)c=c.multiply(new a.Polynomial([1,a.Math.gexp(f)],0));return c},getLengthInBits:function(b,c){if(1<=c&&10>c)switch(b){case a.Mode.MODE_NUMBER:return 10;case a.Mode.MODE_ALPHA_NUM:return 9;case a.Mode.MODE_8BIT_BYTE:return 8;case a.Mode.MODE_KANJI:return 8;default:throw Error("mode:"+b);}else if(27>
  126. c)switch(b){case a.Mode.MODE_NUMBER:return 12;case a.Mode.MODE_ALPHA_NUM:return 11;case a.Mode.MODE_8BIT_BYTE:return 16;case a.Mode.MODE_KANJI:return 10;default:throw Error("mode:"+b);}else if(41>c)switch(b){case a.Mode.MODE_NUMBER:return 14;case a.Mode.MODE_ALPHA_NUM:return 13;case a.Mode.MODE_8BIT_BYTE:return 16;case a.Mode.MODE_KANJI:return 12;default:throw Error("mode:"+b);}else throw Error("type:"+c);},getLostPoint:function(a){for(var c=a.getModuleCount(),f=0,d=0;d<c;d++)for(var e=0;e<c;e++){for(var h=
  127. 0,q=a.isDark(d,e),r=-1;1>=r;r++)if(!(0>d+r||c<=d+r))for(var s=-1;1>=s;s++)0>e+s||c<=e+s||0==r&&0==s||q!=a.isDark(d+r,e+s)||h++;5<h&&(f+=3+h-5)}for(d=0;d<c-1;d++)for(e=0;e<c-1;e++)if(h=0,a.isDark(d,e)&&h++,a.isDark(d+1,e)&&h++,a.isDark(d,e+1)&&h++,a.isDark(d+1,e+1)&&h++,0==h||4==h)f+=3;for(d=0;d<c;d++)for(e=0;e<c-6;e++)a.isDark(d,e)&&!a.isDark(d,e+1)&&a.isDark(d,e+2)&&a.isDark(d,e+3)&&a.isDark(d,e+4)&&!a.isDark(d,e+5)&&a.isDark(d,e+6)&&(f+=40);for(e=0;e<c;e++)for(d=0;d<c-6;d++)a.isDark(d,e)&&!a.isDark(d+
  128. 1,e)&&a.isDark(d+2,e)&&a.isDark(d+3,e)&&a.isDark(d+4,e)&&!a.isDark(d+5,e)&&a.isDark(d+6,e)&&(f+=40);for(e=h=0;e<c;e++)for(d=0;d<c;d++)a.isDark(d,e)&&h++;a=Math.abs(100*h/c/c-50)/5;return f+10*a}};a.Math={glog:function(b){if(1>b)throw Error("glog("+b+")");return a.Math.LOG_TABLE[b]},gexp:function(b){for(;0>b;)b+=255;for(;256<=b;)b-=255;return a.Math.EXP_TABLE[b]},EXP_TABLE:Array(256),LOG_TABLE:Array(256)};for(var e=0;8>e;e++)a.Math.EXP_TABLE[e]=1<<e;for(e=8;256>e;e++)a.Math.EXP_TABLE[e]=a.Math.EXP_TABLE[e-
  129. 4]^a.Math.EXP_TABLE[e-5]^a.Math.EXP_TABLE[e-6]^a.Math.EXP_TABLE[e-8];for(e=0;255>e;e++)a.Math.LOG_TABLE[a.Math.EXP_TABLE[e]]=e;a.Polynomial=function(a,c){if(void 0==a.length)throw Error(a.length+"/"+c);for(var f=0;f<a.length&&0==a[f];)f++;this.num=Array(a.length-f+c);for(var d=0;d<a.length-f;d++)this.num[d]=a[d+f]};a.Polynomial.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(b){for(var c=Array(this.getLength()+b.getLength()-1),f=0;f<this.getLength();f++)for(var d=
  130. 0;d<b.getLength();d++)c[f+d]^=a.Math.gexp(a.Math.glog(this.get(f))+a.Math.glog(b.get(d)));return new a.Polynomial(c,0)},mod:function(b){if(0>this.getLength()-b.getLength())return this;for(var c=a.Math.glog(this.get(0))-a.Math.glog(b.get(0)),f=Array(this.getLength()),d=0;d<this.getLength();d++)f[d]=this.get(d);for(d=0;d<b.getLength();d++)f[d]^=a.Math.gexp(a.Math.glog(b.get(d))+c);return(new a.Polynomial(f,0)).mod(b)}};a.RSBlock=function(a,c){this.totalCount=a;this.dataCount=c};a.RSBlock.RS_BLOCK_TABLE=
  131. [[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,
  132. 43,15,2,44,16]];a.RSBlock.getRSBlocks=function(b,c){var f=a.RSBlock.getRsBlockTable(b,c);if(void 0==f)throw Error("bad rs block @ typeNumber:"+b+"/errorCorrectLevel:"+c);for(var d=f.length/3,e=[],h=0;h<d;h++)for(var q=f[3*h+0],r=f[3*h+1],s=f[3*h+2],l=0;l<q;l++)e.push(new a.RSBlock(r,s));return e};a.RSBlock.getRsBlockTable=function(b,c){switch(c){case a.ErrorCorrectLevel.L:return a.RSBlock.RS_BLOCK_TABLE[4*(b-1)+0];case a.ErrorCorrectLevel.M:return a.RSBlock.RS_BLOCK_TABLE[4*(b-1)+1];case a.ErrorCorrectLevel.Q:return a.RSBlock.RS_BLOCK_TABLE[4*
  133. (b-1)+2];case a.ErrorCorrectLevel.H:return a.RSBlock.RS_BLOCK_TABLE[4*(b-1)+3]}};a.BitBuffer=function(){this.buffer=[];this.length=0};a.BitBuffer.prototype={get:function(a){return 1==(this.buffer[Math.floor(a/8)]>>>7-a%8&1)},put:function(a,c){for(var f=0;f<c;f++)this.putBit(1==(a>>>c-f-1&1))},getLengthInBits:function(){return this.length},putBit:function(a){var c=Math.floor(this.length/8);this.buffer.length<=c&&this.buffer.push(0);a&&(this.buffer[c]|=128>>>this.length%8);this.length++}}})();
  134. (function(a){})("object"===typeof module?module.exports:window.Bitcoin={});
  135. (function(a){a.Base58={alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",validRegex:/^[1-9A-HJ-NP-Za-km-z]+$/,base:BigInteger.valueOf(58),encode:function(a){for(var c=BigInteger.fromByteArrayUnsigned(a),f=[];0<=c.compareTo(e.base);){var d=c.mod(e.base);f.unshift(e.alphabet[d.intValue()]);c=c.subtract(d).divide(e.base)}f.unshift(e.alphabet[c.intValue()]);for(c=0;c<a.length;c++)if(0==a[c])f.unshift(e.alphabet[0]);else break;return f.join("")},decode:function(a){for(var c=BigInteger.valueOf(0),
  136. f=0,d=a.length-1;0<=d;d--){var m=e.alphabet.indexOf(a[d]);if(0>m)throw"Invalid character";c=c.add(BigInteger.valueOf(m).multiply(e.base.pow(a.length-1-d)));"1"==a[d]?f++:f=0}for(a=c.toByteArrayUnsigned();0<f--;)a.unshift(0);return a}};var e=a.Base58})("undefined"!=typeof Bitcoin?Bitcoin:module.exports);Bitcoin.Address=function(a){"string"==typeof a&&(a=Bitcoin.Address.decodeString(a));this.hash=a;this.version=Bitcoin.Address.networkVersion};Bitcoin.Address.networkVersion=0;
  137. Bitcoin.Address.prototype.toString=function(){var a=this.hash.slice(0);a.unshift(this.version);var e=Crypto.SHA256(Crypto.SHA256(a,{asBytes:!0}),{asBytes:!0}),a=a.concat(e.slice(0,4));return Bitcoin.Base58.encode(a)};Bitcoin.Address.prototype.getHashBase64=function(){return Crypto.util.bytesToBase64(this.hash)};
  138. Bitcoin.Address.decodeString=function(a){var e=Bitcoin.Base58.decode(a);a=e.slice(0,21);var b=Crypto.SHA256(Crypto.SHA256(a,{asBytes:!0}),{asBytes:!0});if(b[0]!=e[21]||b[1]!=e[22]||b[2]!=e[23]||b[3]!=e[24])throw"Checksum validation failed!";e=a.shift();if(0!=e)throw"Version "+e+" not supported!";return a};
  139. Bitcoin.ECDSA=function(){var a=EllipticCurve.getSECCurveByName("secp256k1"),e=new SecureRandom,b=null,c={getBigRandom:function(a){return(new BigInteger(a.bitLength(),e)).mod(a.subtract(BigInteger.ONE)).add(BigInteger.ONE)},sign:function(b,d){var e=a.getN(),h=BigInteger.fromByteArrayUnsigned(b);do var q=c.getBigRandom(e),r=a.getG().multiply(q).getX().toBigInteger().mod(e);while(0>=r.compareTo(BigInteger.ZERO));e=q.modInverse(e).multiply(h.add(d.multiply(r))).mod(e);return c.serializeSig(r,e)},verify:function(b,
  140. d,e){var h;if(Bitcoin.Util.isArray(d))d=c.parseSig(d),h=d.r,d=d.s;else if("object"===typeof d&&d.r&&d.s)h=d.r,d=d.s;else throw"Invalid value for signature";if(!(e instanceof ec.PointFp))if(Bitcoin.Util.isArray(e))e=EllipticCurve.PointFp.decodeFrom(a.getCurve(),e);else throw"Invalid format for pubkey value, must be byte array or ec.PointFp";b=BigInteger.fromByteArrayUnsigned(b);return c.verifyRaw(b,h,d,e)},verifyRaw:function(b,c,e,h){var q=a.getN(),r=a.getG();if(0>c.compareTo(BigInteger.ONE)||0<=c.compareTo(q)||
  141. 0>e.compareTo(BigInteger.ONE)||0<=e.compareTo(q))return!1;e=e.modInverse(q);b=b.multiply(e).mod(q);e=c.multiply(e).mod(q);return r.multiply(b).add(h.multiply(e)).getX().toBigInteger().mod(q).equals(c)},serializeSig:function(a,b){var c=a.toByteArraySigned(),e=b.toByteArraySigned(),q=[];q.push(2);q.push(c.length);q=q.concat(c);q.push(2);q.push(e.length);q=q.concat(e);q.unshift(q.length);q.unshift(48);return q},parseSig:function(a){var b;if(48!=a[0])throw Error("Signature not a valid DERSequence");b=
  142. 2;if(2!=a[b])throw Error("First element in signature must be a DERInteger");var c=a.slice(b+2,b+2+a[b+1]);b+=2+a[b+1];if(2!=a[b])throw Error("Second element in signature must be a DERInteger");a=a.slice(b+2,b+2+a[b+1]);c=BigInteger.fromByteArrayUnsigned(c);a=BigInteger.fromByteArrayUnsigned(a);return{r:c,s:a}},parseSigCompact:function(b){if(65!==b.length)throw"Signature has the wrong length";var c=b[0]-27;if(0>c||7<c)throw"Invalid signature type";var e=a.getN(),h=BigInteger.fromByteArrayUnsigned(b.slice(1,
  143. 33)).mod(e);b=BigInteger.fromByteArrayUnsigned(b.slice(33,65)).mod(e);return{r:h,s:b,i:c}},recoverPubKey:function(e,d,m,h){h&=3;var q=h&1,r=h>>1,s=a.getN();h=a.getG();var l=a.getCurve(),t=l.getQ(),u=l.getA().toBigInteger(),g=l.getB().toBigInteger();b||(b=t.add(BigInteger.ONE).divide(BigInteger.valueOf(4)));r=r?e.add(s):e;u=r.multiply(r).multiply(r).add(u.multiply(r)).add(g).mod(t).modPow(b,t);u.isEven();q=(u.isEven()?!q:q)?u:t.subtract(u);q=new EllipticCurve.PointFp(l,l.fromBigInteger(r),l.fromBigInteger(q));
  144. q.validate();m=BigInteger.fromByteArrayUnsigned(m);l=BigInteger.ZERO.subtract(m).mod(s);s=e.modInverse(s);u=Math.max(d.bitLength(),l.bitLength());t=q.add2D(h);r=q.curve.getInfinity();for(u-=1;0<=u;--u)r=r.twice2D(),r.z=BigInteger.ONE,d.testBit(u)?r=l.testBit(u)?r.add2D(t):r.add2D(q):l.testBit(u)&&(r=r.add2D(h));h=r.multiply(s);h.validate();if(!c.verifyRaw(m,e,d,h))throw"Pubkey recovery unsuccessful";e=new Bitcoin.ECKey;e.pub=h;return e},calcPubkeyRecoveryParam:function(a,b,c,e){for(var q=0;4>q;q++)try{if(Bitcoin.ECDSA.recoverPubKey(b,
  145. c,e,q).getBitcoinAddress().toString()==a)return q}catch(r){}throw"Unable to find valid recovery factor";}};return c}();
  146. Bitcoin.ECKey=function(){var a=Bitcoin.ECDSA,e=EllipticCurve.getSECCurveByName("secp256k1");new SecureRandom;var b=function(c){if(!c)c=e.getN(),this.priv=a.getBigRandom(c);else if(c instanceof BigInteger)this.priv=c;else if(Bitcoin.Util.isArray(c))this.priv=BigInteger.fromByteArrayUnsigned(c);else if("string"==typeof c){var f=null;b.isWalletImportFormat(c)?f=b.decodeWalletImportFormat(c):b.isCompressedWalletImportFormat(c)?(f=b.decodeCompressedWalletImportFormat(c),this.compressed=!0):b.isMiniFormat(c)?
  147. f=Crypto.SHA256(c,{asBytes:!0}):b.isHexFormat(c)?f=Crypto.util.hexToBytes(c):b.isBase64Format(c)&&(f=Crypto.util.base64ToBytes(c));b.isBase6Format(c)?this.priv=new BigInteger(c,6):this.priv=null==f||32!=f.length?null:BigInteger.fromByteArrayUnsigned(f)}this.compressed=void 0==this.compressed?!!b.compressByDefault:this.compressed};b.privateKeyPrefix=128;b.compressByDefault=!1;b.prototype.setCompressed=function(a){this.compressed=!!a;this.pubPoint&&(this.pubPoint.compressed=this.compressed);return this};
  148. b.prototype.getPub=function(){return this.compressed?this.pubComp?this.pubComp:this.pubComp=this.getPubPoint().getEncoded(1):this.pubUncomp?this.pubUncomp:this.pubUncomp=this.getPubPoint().getEncoded(0)};b.prototype.getPubPoint=function(){this.pubPoint||(this.pubPoint=e.getG().multiply(this.priv),this.pubPoint.compressed=this.compressed);return this.pubPoint};b.prototype.getPubKeyHex=function(){return this.compressed?this.pubKeyHexComp?this.pubKeyHexComp:this.pubKeyHexComp=Crypto.util.bytesToHex(this.getPub()).toString().toUpperCase():
  149. this.pubKeyHexUncomp?this.pubKeyHexUncomp:this.pubKeyHexUncomp=Crypto.util.bytesToHex(this.getPub()).toString().toUpperCase()};b.prototype.getPubKeyHash=function(){return this.compressed?this.pubKeyHashComp?this.pubKeyHashComp:this.pubKeyHashComp=Bitcoin.Util.sha256ripe160(this.getPub()):this.pubKeyHashUncomp?this.pubKeyHashUncomp:this.pubKeyHashUncomp=Bitcoin.Util.sha256ripe160(this.getPub())};b.prototype.getBitcoinAddress=function(){var a=this.getPubKeyHash();return(new Bitcoin.Address(a)).toString()};
  150. b.prototype.setPub=function(a){Bitcoin.Util.isArray(a)&&(a=Crypto.util.bytesToHex(a).toString().toUpperCase());a=e.getCurve().decodePointHex(a);this.setCompressed(a.compressed);this.pubPoint=a;return this};b.prototype.getBitcoinWalletImportFormat=function(){var a=this.getBitcoinPrivateKeyByteArray();a.unshift(b.privateKeyPrefix);this.compressed&&a.push(1);var e=Crypto.SHA256(Crypto.SHA256(a,{asBytes:!0}),{asBytes:!0}),a=a.concat(e.slice(0,4));return Bitcoin.Base58.encode(a)};b.prototype.getBitcoinHexFormat=
  151. function(){return Crypto.util.bytesToHex(this.getBitcoinPrivateKeyByteArray()).toString().toUpperCase()};b.prototype.getBitcoinBase64Format=function(){return Crypto.util.bytesToBase64(this.getBitcoinPrivateKeyByteArray())};b.prototype.getBitcoinPrivateKeyByteArray=function(){for(var a=this.priv.toByteArrayUnsigned();32>a.length;)a.unshift(0);return a};b.prototype.toString=function(a){a=a||"";return"base64"==a.toString().toLowerCase()||"b64"==a.toString().toLowerCase()?this.getBitcoinBase64Format():
  152. "wif"==a.toString().toLowerCase()?this.getBitcoinWalletImportFormat():this.getBitcoinHexFormat()};b.prototype.sign=function(b){return a.sign(b,this.priv)};b.prototype.verify=function(b,e){return a.verify(b,e,this.getPub())};b.decodeWalletImportFormat=function(a){var e=Bitcoin.Base58.decode(a);a=e.slice(0,33);var d=Crypto.SHA256(Crypto.SHA256(a,{asBytes:!0}),{asBytes:!0});if(d[0]!=e[33]||d[1]!=e[34]||d[2]!=e[35]||d[3]!=e[36])throw"Checksum validation failed!";e=a.shift();if(e!=b.privateKeyPrefix)throw"Version "+
  153. e+" not supported!";return a};b.decodeCompressedWalletImportFormat=function(a){var e=Bitcoin.Base58.decode(a);a=e.slice(0,34);var d=Crypto.SHA256(Crypto.SHA256(a,{asBytes:!0}),{asBytes:!0});if(d[0]!=e[34]||d[1]!=e[35]||d[2]!=e[36]||d[3]!=e[37])throw"Checksum validation failed!";e=a.shift();if(e!=b.privateKeyPrefix)throw"Version "+e+" not supported!";a.pop();return a};b.isHexFormat=function(a){a=a.toString();return/^[A-Fa-f0-9]{64}$/.test(a)};b.isWalletImportFormat=function(a){a=a.toString();return 128==
  154. b.privateKeyPrefix?/^5[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{50}$/.test(a):/^9[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{50}$/.test(a)};b.isCompressedWalletImportFormat=function(a){a=a.toString();return 128==b.privateKeyPrefix?/^[LK][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{51}$/.test(a):/^c[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{51}$/.test(a)};b.isBase64Format=function(a){a=a.toString();return/^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789=+\/]{44}$/.test(a)};
  155. b.isBase6Format=function(a){a=a.toString();return/^[012345]{99}$/.test(a)};b.isMiniFormat=function(a){a=a.toString();var b=/^S[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21}$/.test(a),d=/^S[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{25}$/.test(a),e=/^S[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{29}$/.test(a);a=Crypto.SHA256(a+"?",{asBytes:!0});return(0===a[0]||1===a[0])&&(b||d||e)};return b}();
  156. Bitcoin.Util={isArray:Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},makeFilledArray:function(a,e){for(var b=[],c=0;c<a;)b[c++]=e;return b},numToVarInt:function(a){return 253>a?[a]:65536>=a?[253,a>>>8,a&255]:a<=1<<32?[254].concat(Crypto.util.wordsToBytes([a])):[255].concat(Crypto.util.wordsToBytes([a>>>32,a]))},valueToBigInt:function(a){return a instanceof BigInteger?a:BigInteger.fromByteArrayUnsigned(a)},formatValue:function(a){var e=this.valueToBigInt(a).toString();
  157. a=8<e.length?e.substr(0,e.length-8):"0";for(e=8<e.length?e.substr(e.length-8):e;8>e.length;)e="0"+e;for(e=e.replace(/0*$/,"");2>e.length;)e+="0";return a+"."+e},parseValue:function(a){var e=a.split(".");a=e[0];for(e=e[1]||"0";8>e.length;)e+="0";e=e.replace(/^0+/g,"");a=BigInteger.valueOf(parseInt(a));a=a.multiply(BigInteger.valueOf(1E8));return a=a.add(BigInteger.valueOf(parseInt(e)))},sha256ripe160:function(a){return Crypto.RIPEMD160(Crypto.SHA256(a,{asBytes:!0}),{asBytes:!0})},dsha256:function(a){return Crypto.SHA256(Crypto.SHA256(a,
  158. {asBytes:!0}),{asBytes:!0})}};
  159. (function(){var a=null;window.Crypto_scrypt=function(e,b,c,f,d,m,h){function q(){function a(c,d,e,f,l,k){var m=128*e,q;h(c,d,k,0,m);for(q=0;q<f;q++)h(k,0,l,q*m,m),b(k,0,m,e);for(q=0;q<f;q++){var p=0,n=void 0,p=p+64*(2*e-1),n=(k[p+0]&255)<<0,n=n|(k[p+1]&255)<<8,n=n|(k[p+2]&255)<<16,n=n|(k[p+3]&255)<<24;g(l,(n&f-1)*m,k,0,m);b(k,0,m,e)}h(k,0,c,d,m)}function b(a,c,d,f){var l=[],k;h(a,c+64*(2*f-1),l,0,64);for(k=0;k<2*f;k++){g(a,64*k,l,0,64);for(var m=l,q=Array(32),p=Array(32),n=void 0,n=0;16>n;n++)q[n]=
  160. (m[4*n+0]&255)<<0,q[n]|=(m[4*n+1]&255)<<8,q[n]|=(m[4*n+2]&255)<<16,q[n]|=(m[4*n+3]&255)<<24;for(var n=q,r=0,s=p,t=0,u=16;u--;)s[t++]=n[r++];for(n=8;0<n;n-=2)p[4]^=e(p[0]+p[12],7),p[8]^=e(p[4]+p[0],9),p[12]^=e(p[8]+p[4],13),p[0]^=e(p[12]+p[8],18),p[9]^=e(p[5]+p[1],7),p[13]^=e(p[9]+p[5],9),p[1]^=e(p[13]+p[9],13),p[5]^=e(p[1]+p[13],18),p[14]^=e(p[10]+p[6],7),p[2]^=e(p[14]+p[10],9),p[6]^=e(p[2]+p[14],13),p[10]^=e(p[6]+p[2],18),p[3]^=e(p[15]+p[11],7),p[7]^=e(p[3]+p[15],9),p[11]^=e(p[7]+p[3],13),p[15]^=
  161. e(p[11]+p[7],18),p[1]^=e(p[0]+p[3],7),p[2]^=e(p[1]+p[0],9),p[3]^=e(p[2]+p[1],13),p[0]^=e(p[3]+p[2],18),p[6]^=e(p[5]+p[4],7),p[7]^=e(p[6]+p[5],9),p[4]^=e(p[7]+p[6],13),p[5]^=e(p[4]+p[7],18),p[11]^=e(p[10]+p[9],7),p[8]^=e(p[11]+p[10],9),p[9]^=e(p[8]+p[11],13),p[10]^=e(p[9]+p[8],18),p[12]^=e(p[15]+p[14],7),p[13]^=e(p[12]+p[15],9),p[14]^=e(p[13]+p[12],13),p[15]^=e(p[14]+p[13],18);for(n=0;16>n;++n)q[n]=p[n]+q[n];for(n=0;16>n;n++)p=4*n,m[p+0]=q[n]>>0&255,m[p+1]=q[n]>>8&255,m[p+2]=q[n]>>16&255,m[p+3]=q[n]>>
  162. 24&255;h(l,0,a,d+64*k,64)}for(k=0;k<f;k++)h(a,d+128*k,a,c+64*k,64);for(k=0;k<f;k++)h(a,d+64*(2*k+1),a,c+64*(k+f),64)}function e(a,b){return a<<b|a>>>32-b}function g(a,b,c,d,e){for(e>>=6;e--;)c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],
  163. c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=
  164. a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++],c[d++]^=a[b++]}function h(a,b,c,d,e){for(e>>=5;e--;)c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],
  165. c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++],c[d++]=a[b++]}var l=[],k=[];if("undefined"===typeof s)onmessage=function(b){b=b.data;var c=b[0],d=b[1],e=b[4],f=[];h(b[3],128*e*d,f,0,128*d);a(f,0,d,c,k,l);postMessage([e,f])};else for(var m=0;m<d;m++)a(s,128*m*f,f,c,k,l)}if(0==c||0!=(c&c-1))throw Error("N must be > 0 and a power of 2");if(c>1.67772159921875E7/f)throw Error("Parameter N is too large");if(f>1.67772159921875E7/d)throw Error("Parameter r is too large");
  166. var r={iterations:1,hasher:Crypto.SHA256,asBytes:!0},s=Crypto.PBKDF2(e,b,128*d*f,r);try{var l=0,t=0;b=function(){if(!a){var b="("+q.toString()+")()",g;try{g=new Blob([b],{type:"text/javascript"})}catch(u){window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,g=new BlobBuilder,g.append(b),g=g.getBlob("text/javascript")}a=URL.createObjectURL(g)}var y=new Worker(a);y.onmessage=function(a){var b=a.data[0];a=a.data[1];t++;l<d&&y.postMessage([c,f,d,
  167. s,l++]);for(var g=a.length,b=128*b*f,n=0;g--;)s[b++]=a[n++];t==d&&h(Crypto.PBKDF2(e,s,m,r))};return y};var u=[b(),b()];u[0].postMessage([c,f,d,s,l++]);1<d&&u[1].postMessage([c,f,d,s,l++])}catch(g){window.setTimeout(function(){q();h(Crypto.PBKDF2(e,s,m,r))},0)}}})();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement