From 819624d9cdaaa6333adc2395dfa46e81368083ac Mon Sep 17 00:00:00 2001 From: Dmitry Chestnykh Date: Tue, 9 Sep 2014 13:23:02 +0200 Subject: [PATCH] Poly1305: inline functions and unroll loops. Makes it up to 4x faster. --- nacl-fast.js | 279 +++++++++++++++++++++++++++++++++++++++-------- nacl-fast.min.js | 2 +- 2 files changed, 235 insertions(+), 46 deletions(-) diff --git a/nacl-fast.js b/nacl-fast.js index 0e5031af..a742bdfa 100644 --- a/nacl-fast.js +++ b/nacl-fast.js @@ -466,9 +466,6 @@ function crypto_stream_xor(c,cpos,m,mpos,d,n,k) { * https://github.com/floodyberry/poly1305-donna */ -function U8TO16(p, i) { return (p[i] & 0xff) | ((p[i+1] & 0xff) << 8); } -function U16TO8(p, i, v) { p[i] = (v >>> 0) & 0xff; p[i+1] = (v >>> 8) & 0xff; } - var poly1305 = function(key) { this.buffer = new Uint8Array(16); this.r = new Uint16Array(10); @@ -477,63 +474,240 @@ var poly1305 = function(key) { this.leftover = 0; this.fin = 0; - var i, t0, t1, t2, t3, t4, t5, t6, t7; + var t0, t1, t2, t3, t4, t5, t6, t7; - t0 = U8TO16(key, 0); this.r[0] = ( t0 ) & 0x1fff; - t1 = U8TO16(key, 2); this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff; - t2 = U8TO16(key, 4); this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03; - t3 = U8TO16(key, 6); this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff; - t4 = U8TO16(key, 8); this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff; + t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff; + t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff; + t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03; + t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff; + t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff; this.r[5] = ((t4 >>> 1)) & 0x1ffe; - t5 = U8TO16(key,10); this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff; - t6 = U8TO16(key,12); this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81; - t7 = U8TO16(key,14); this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff; + t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff; + t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81; + t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff; this.r[9] = ((t7 >>> 5)) & 0x007f; - for (i = 0; i < 8; i++) this.pad[i] = U8TO16(key, 16 + (2 * i)); + this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8; + this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8; + this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8; + this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8; + this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8; + this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8; + this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8; + this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8; }; poly1305.prototype.blocks = function(m, mpos, bytes) { var hibit = this.fin ? 0 : (1 << 11); - var t0, t1, t2, t3, t4, t5, t6, t7; - var d = new Uint32Array(10); - var c, i, j; + var t0, t1, t2, t3, t4, t5, t6, t7, c; + var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9; + + var h0 = this.h[0], + h1 = this.h[1], + h2 = this.h[2], + h3 = this.h[3], + h4 = this.h[4], + h5 = this.h[5], + h6 = this.h[6], + h7 = this.h[7], + h8 = this.h[8], + h9 = this.h[9]; + + var r0 = this.r[0], + r1 = this.r[1], + r2 = this.r[2], + r3 = this.r[3], + r4 = this.r[4], + r5 = this.r[5], + r6 = this.r[6], + r7 = this.r[7], + r8 = this.r[8], + r9 = this.r[9]; while (bytes >= 16) { - t0 = U8TO16(m, mpos+0); this.h[0] += ( t0 ) & 0x1fff; - t1 = U8TO16(m, mpos+2); this.h[1] += ((t0 >>> 13) | (t1 << 3)) & 0x1fff; - t2 = U8TO16(m, mpos+4); this.h[2] += ((t1 >>> 10) | (t2 << 6)) & 0x1fff; - t3 = U8TO16(m, mpos+6); this.h[3] += ((t2 >>> 7) | (t3 << 9)) & 0x1fff; - t4 = U8TO16(m, mpos+8); this.h[4] += ((t3 >>> 4) | (t4 << 12)) & 0x1fff; - this.h[5] += ((t4 >>> 1)) & 0x1fff; - t5 = U8TO16(m, mpos+10); this.h[6] += ((t4 >>> 14) | (t5 << 2)) & 0x1fff; - t6 = U8TO16(m, mpos+12); this.h[7] += ((t5 >>> 11) | (t6 << 5)) & 0x1fff; - t7 = U8TO16(m, mpos+14); this.h[8] += ((t6 >>> 8) | (t7 << 8)) & 0x1fff; - this.h[9] += ((t7 >>> 5)) | hibit; - - for (i = 0, c = 0; i < 10; i++) { - d[i] = c; - for (j = 0; j < 10; j++) { - d[i] += this.h[j] * ((j <= i) ? this.r[i - j] : (5 * this.r[i + 10 - j])); - if (j === 4) { - c = (d[i] >>> 13); - d[i] &= 0x1fff; - } - } - c += (d[i] >>> 13); - d[i] &= 0x1fff; - } + t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff; + t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff; + t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff; + t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff; + t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff; + h5 += ((t4 >>> 1)) & 0x1fff; + t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff; + t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff; + t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff; + h9 += ((t7 >>> 5)) | hibit; + + c = 0; + + d0 = c; + d0 += h0 * r0; + d0 += h1 * (5 * r9); + d0 += h2 * (5 * r8); + d0 += h3 * (5 * r7); + d0 += h4 * (5 * r6); + c = (d0 >>> 13); d0 &= 0x1fff; + d0 += h5 * (5 * r5); + d0 += h6 * (5 * r4); + d0 += h7 * (5 * r3); + d0 += h8 * (5 * r2); + d0 += h9 * (5 * r1); + c += (d0 >>> 13); d0 &= 0x1fff; + + d1 = c; + d1 += h0 * r1; + d1 += h1 * r0; + d1 += h2 * (5 * r9); + d1 += h3 * (5 * r8); + d1 += h4 * (5 * r7); + c = (d1 >>> 13); d1 &= 0x1fff; + d1 += h5 * (5 * r6); + d1 += h6 * (5 * r5); + d1 += h7 * (5 * r4); + d1 += h8 * (5 * r3); + d1 += h9 * (5 * r2); + c += (d1 >>> 13); d1 &= 0x1fff; + + d2 = c; + d2 += h0 * r2; + d2 += h1 * r1; + d2 += h2 * r0; + d2 += h3 * (5 * r9); + d2 += h4 * (5 * r8); + c = (d2 >>> 13); d2 &= 0x1fff; + d2 += h5 * (5 * r7); + d2 += h6 * (5 * r6); + d2 += h7 * (5 * r5); + d2 += h8 * (5 * r4); + d2 += h9 * (5 * r3); + c += (d2 >>> 13); d2 &= 0x1fff; + + d3 = c; + d3 += h0 * r3; + d3 += h1 * r2; + d3 += h2 * r1; + d3 += h3 * r0; + d3 += h4 * (5 * r9); + c = (d3 >>> 13); d3 &= 0x1fff; + d3 += h5 * (5 * r8); + d3 += h6 * (5 * r7); + d3 += h7 * (5 * r6); + d3 += h8 * (5 * r5); + d3 += h9 * (5 * r4); + c += (d3 >>> 13); d3 &= 0x1fff; + + d4 = c; + d4 += h0 * r4; + d4 += h1 * r3; + d4 += h2 * r2; + d4 += h3 * r1; + d4 += h4 * r0; + c = (d4 >>> 13); d4 &= 0x1fff; + d4 += h5 * (5 * r9); + d4 += h6 * (5 * r8); + d4 += h7 * (5 * r7); + d4 += h8 * (5 * r6); + d4 += h9 * (5 * r5); + c += (d4 >>> 13); d4 &= 0x1fff; + + d5 = c; + d5 += h0 * r5; + d5 += h1 * r4; + d5 += h2 * r3; + d5 += h3 * r2; + d5 += h4 * r1; + c = (d5 >>> 13); d5 &= 0x1fff; + d5 += h5 * r0; + d5 += h6 * (5 * r9); + d5 += h7 * (5 * r8); + d5 += h8 * (5 * r7); + d5 += h9 * (5 * r6); + c += (d5 >>> 13); d5 &= 0x1fff; + + d6 = c; + d6 += h0 * r6; + d6 += h1 * r5; + d6 += h2 * r4; + d6 += h3 * r3; + d6 += h4 * r2; + c = (d6 >>> 13); d6 &= 0x1fff; + d6 += h5 * r1; + d6 += h6 * r0; + d6 += h7 * (5 * r9); + d6 += h8 * (5 * r8); + d6 += h9 * (5 * r7); + c += (d6 >>> 13); d6 &= 0x1fff; + + d7 = c; + d7 += h0 * r7; + d7 += h1 * r6; + d7 += h2 * r5; + d7 += h3 * r4; + d7 += h4 * r3; + c = (d7 >>> 13); d7 &= 0x1fff; + d7 += h5 * r2; + d7 += h6 * r1; + d7 += h7 * r0; + d7 += h8 * (5 * r9); + d7 += h9 * (5 * r8); + c += (d7 >>> 13); d7 &= 0x1fff; + + d8 = c; + d8 += h0 * r8; + d8 += h1 * r7; + d8 += h2 * r6; + d8 += h3 * r5; + d8 += h4 * r4; + c = (d8 >>> 13); d8 &= 0x1fff; + d8 += h5 * r3; + d8 += h6 * r2; + d8 += h7 * r1; + d8 += h8 * r0; + d8 += h9 * (5 * r9); + c += (d8 >>> 13); d8 &= 0x1fff; + + d9 = c; + d9 += h0 * r9; + d9 += h1 * r8; + d9 += h2 * r7; + d9 += h3 * r6; + d9 += h4 * r5; + c = (d9 >>> 13); d9 &= 0x1fff; + d9 += h5 * r4; + d9 += h6 * r3; + d9 += h7 * r2; + d9 += h8 * r1; + d9 += h9 * r0; + c += (d9 >>> 13); d9 &= 0x1fff; + c = (((c << 2) + c)) | 0; - c = (c + d[0]) | 0; - d[0] = c & 0x1fff; + c = (c + d0) | 0; + d0 = c & 0x1fff; c = (c >>> 13); - d[1] += c; - - for (i = 0; i < 10; i++) this.h[i] = d[i]; + d1 += c; + + h0 = d0; + h1 = d1; + h2 = d2; + h3 = d3; + h4 = d4; + h5 = d5; + h6 = d6; + h7 = d7; + h8 = d8; + h9 = d9; mpos += 16; bytes -= 16; } + this.h[0] = h0; + this.h[1] = h1; + this.h[2] = h2; + this.h[3] = h3; + this.h[4] = h4; + this.h[5] = h5; + this.h[6] = h6; + this.h[7] = h7; + this.h[8] = h8; + this.h[9] = h9; }; poly1305.prototype.finish = function(mac, macpos) { @@ -594,7 +768,22 @@ poly1305.prototype.finish = function(mac, macpos) { this.h[i] = f & 0xffff; } - for (i = 0; i < 8; i++) U16TO8(mac, macpos + i*2, this.h[i]); + mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff; + mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff; + mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff; + mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff; + mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff; + mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff; + mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff; + mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff; + mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff; + mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff; + mac[macpos+10] = (this.h[5] >>> 0) & 0xff; + mac[macpos+11] = (this.h[5] >>> 8) & 0xff; + mac[macpos+12] = (this.h[6] >>> 0) & 0xff; + mac[macpos+13] = (this.h[6] >>> 8) & 0xff; + mac[macpos+14] = (this.h[7] >>> 0) & 0xff; + mac[macpos+15] = (this.h[7] >>> 8) & 0xff; }; poly1305.prototype.update = function(m, mpos, bytes) { diff --git a/nacl-fast.min.js b/nacl-fast.min.js index 74bc22e7..7ff2a1e3 100644 --- a/nacl-fast.min.js +++ b/nacl-fast.min.js @@ -1 +1 @@ -!function(r){"use strict";function t(r,t,n,e){r[t]=n>>24&255,r[t+1]=n>>16&255,r[t+2]=n>>8&255,r[t+3]=255&n,r[t+4]=e>>24&255,r[t+5]=e>>16&255,r[t+6]=e>>8&255,r[t+7]=255&e}function n(r,t,n,e,o){var i,a=0;for(i=0;o>i;i++)a|=r[t+i]^n[e+i];return(1&a-1>>>8)-1}function e(r,t,e,o){return n(r,t,e,o,16)}function o(r,t,e,o){return n(r,t,e,o,32)}function i(r,t,n,e){for(var o,i=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,a=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,f=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,h=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,s=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,u=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,y=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,w=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,l=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,p=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,g=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,v=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,b=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,A=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,d=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,_=i,U=a,E=f,x=h,m=s,B=u,S=c,K=y,T=w,Y=l,k=p,L=g,C=v,R=b,z=A,P=d,F=0;20>F;F+=2)o=_+C|0,m^=o<<7|o>>>25,o=m+_|0,T^=o<<9|o>>>23,o=T+m|0,C^=o<<13|o>>>19,o=C+T|0,_^=o<<18|o>>>14,o=B+U|0,Y^=o<<7|o>>>25,o=Y+B|0,R^=o<<9|o>>>23,o=R+Y|0,U^=o<<13|o>>>19,o=U+R|0,B^=o<<18|o>>>14,o=k+S|0,z^=o<<7|o>>>25,o=z+k|0,E^=o<<9|o>>>23,o=E+z|0,S^=o<<13|o>>>19,o=S+E|0,k^=o<<18|o>>>14,o=P+L|0,x^=o<<7|o>>>25,o=x+P|0,K^=o<<9|o>>>23,o=K+x|0,L^=o<<13|o>>>19,o=L+K|0,P^=o<<18|o>>>14,o=_+x|0,U^=o<<7|o>>>25,o=U+_|0,E^=o<<9|o>>>23,o=E+U|0,x^=o<<13|o>>>19,o=x+E|0,_^=o<<18|o>>>14,o=B+m|0,S^=o<<7|o>>>25,o=S+B|0,K^=o<<9|o>>>23,o=K+S|0,m^=o<<13|o>>>19,o=m+K|0,B^=o<<18|o>>>14,o=k+Y|0,L^=o<<7|o>>>25,o=L+k|0,T^=o<<9|o>>>23,o=T+L|0,Y^=o<<13|o>>>19,o=Y+T|0,k^=o<<18|o>>>14,o=P+z|0,C^=o<<7|o>>>25,o=C+P|0,R^=o<<9|o>>>23,o=R+C|0,z^=o<<13|o>>>19,o=z+R|0,P^=o<<18|o>>>14;_=_+i|0,U=U+a|0,E=E+f|0,x=x+h|0,m=m+s|0,B=B+u|0,S=S+c|0,K=K+y|0,T=T+w|0,Y=Y+l|0,k=k+p|0,L=L+g|0,C=C+v|0,R=R+b|0,z=z+A|0,P=P+d|0,r[0]=_>>>0&255,r[1]=_>>>8&255,r[2]=_>>>16&255,r[3]=_>>>24&255,r[4]=U>>>0&255,r[5]=U>>>8&255,r[6]=U>>>16&255,r[7]=U>>>24&255,r[8]=E>>>0&255,r[9]=E>>>8&255,r[10]=E>>>16&255,r[11]=E>>>24&255,r[12]=x>>>0&255,r[13]=x>>>8&255,r[14]=x>>>16&255,r[15]=x>>>24&255,r[16]=m>>>0&255,r[17]=m>>>8&255,r[18]=m>>>16&255,r[19]=m>>>24&255,r[20]=B>>>0&255,r[21]=B>>>8&255,r[22]=B>>>16&255,r[23]=B>>>24&255,r[24]=S>>>0&255,r[25]=S>>>8&255,r[26]=S>>>16&255,r[27]=S>>>24&255,r[28]=K>>>0&255,r[29]=K>>>8&255,r[30]=K>>>16&255,r[31]=K>>>24&255,r[32]=T>>>0&255,r[33]=T>>>8&255,r[34]=T>>>16&255,r[35]=T>>>24&255,r[36]=Y>>>0&255,r[37]=Y>>>8&255,r[38]=Y>>>16&255,r[39]=Y>>>24&255,r[40]=k>>>0&255,r[41]=k>>>8&255,r[42]=k>>>16&255,r[43]=k>>>24&255,r[44]=L>>>0&255,r[45]=L>>>8&255,r[46]=L>>>16&255,r[47]=L>>>24&255,r[48]=C>>>0&255,r[49]=C>>>8&255,r[50]=C>>>16&255,r[51]=C>>>24&255,r[52]=R>>>0&255,r[53]=R>>>8&255,r[54]=R>>>16&255,r[55]=R>>>24&255,r[56]=z>>>0&255,r[57]=z>>>8&255,r[58]=z>>>16&255,r[59]=z>>>24&255,r[60]=P>>>0&255,r[61]=P>>>8&255,r[62]=P>>>16&255,r[63]=P>>>24&255}function a(r,t,n,e){for(var o,i=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,a=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,f=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,h=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,s=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,u=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,y=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,w=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,l=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,p=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,g=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,v=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,b=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,A=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,d=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,_=i,U=a,E=f,x=h,m=s,B=u,S=c,K=y,T=w,Y=l,k=p,L=g,C=v,R=b,z=A,P=d,F=0;20>F;F+=2)o=_+C|0,m^=o<<7|o>>>25,o=m+_|0,T^=o<<9|o>>>23,o=T+m|0,C^=o<<13|o>>>19,o=C+T|0,_^=o<<18|o>>>14,o=B+U|0,Y^=o<<7|o>>>25,o=Y+B|0,R^=o<<9|o>>>23,o=R+Y|0,U^=o<<13|o>>>19,o=U+R|0,B^=o<<18|o>>>14,o=k+S|0,z^=o<<7|o>>>25,o=z+k|0,E^=o<<9|o>>>23,o=E+z|0,S^=o<<13|o>>>19,o=S+E|0,k^=o<<18|o>>>14,o=P+L|0,x^=o<<7|o>>>25,o=x+P|0,K^=o<<9|o>>>23,o=K+x|0,L^=o<<13|o>>>19,o=L+K|0,P^=o<<18|o>>>14,o=_+x|0,U^=o<<7|o>>>25,o=U+_|0,E^=o<<9|o>>>23,o=E+U|0,x^=o<<13|o>>>19,o=x+E|0,_^=o<<18|o>>>14,o=B+m|0,S^=o<<7|o>>>25,o=S+B|0,K^=o<<9|o>>>23,o=K+S|0,m^=o<<13|o>>>19,o=m+K|0,B^=o<<18|o>>>14,o=k+Y|0,L^=o<<7|o>>>25,o=L+k|0,T^=o<<9|o>>>23,o=T+L|0,Y^=o<<13|o>>>19,o=Y+T|0,k^=o<<18|o>>>14,o=P+z|0,C^=o<<7|o>>>25,o=C+P|0,R^=o<<9|o>>>23,o=R+C|0,z^=o<<13|o>>>19,o=z+R|0,P^=o<<18|o>>>14;r[0]=_>>>0&255,r[1]=_>>>8&255,r[2]=_>>>16&255,r[3]=_>>>24&255,r[4]=B>>>0&255,r[5]=B>>>8&255,r[6]=B>>>16&255,r[7]=B>>>24&255,r[8]=k>>>0&255,r[9]=k>>>8&255,r[10]=k>>>16&255,r[11]=k>>>24&255,r[12]=P>>>0&255,r[13]=P>>>8&255,r[14]=P>>>16&255,r[15]=P>>>24&255,r[16]=S>>>0&255,r[17]=S>>>8&255,r[18]=S>>>16&255,r[19]=S>>>24&255,r[20]=K>>>0&255,r[21]=K>>>8&255,r[22]=K>>>16&255,r[23]=K>>>24&255,r[24]=T>>>0&255,r[25]=T>>>8&255,r[26]=T>>>16&255,r[27]=T>>>24&255,r[28]=Y>>>0&255,r[29]=Y>>>8&255,r[30]=Y>>>16&255,r[31]=Y>>>24&255}function f(r,t,n,e){i(r,t,n,e)}function h(r,t,n,e){a(r,t,n,e)}function s(r,t,n,e,o,i,a){var h,s,u=new Uint8Array(16),c=new Uint8Array(64);for(s=0;16>s;s++)u[s]=0;for(s=0;8>s;s++)u[s]=i[s];for(;o>=64;){for(f(c,u,a,yt),s=0;64>s;s++)r[t+s]=n[e+s]^c[s];for(h=1,s=8;16>s;s++)h=h+(255&u[s])|0,u[s]=255&h,h>>>=8;o-=64,t+=64,e+=64}if(o>0)for(f(c,u,a,yt),s=0;o>s;s++)r[t+s]=n[e+s]^c[s];return 0}function u(r,t,n,e,o){var i,a,h=new Uint8Array(16),s=new Uint8Array(64);for(a=0;16>a;a++)h[a]=0;for(a=0;8>a;a++)h[a]=e[a];for(;n>=64;){for(f(s,h,o,yt),a=0;64>a;a++)r[t+a]=s[a];for(i=1,a=8;16>a;a++)i=i+(255&h[a])|0,h[a]=255&i,i>>>=8;n-=64,t+=64}if(n>0)for(f(s,h,o,yt),a=0;n>a;a++)r[t+a]=s[a];return 0}function c(r,t,n,e,o){var i=new Uint8Array(32);h(i,e,o,yt);for(var a=new Uint8Array(8),f=0;8>f;f++)a[f]=e[f+16];return u(r,t,n,a,i)}function y(r,t,n,e,o,i,a){var f=new Uint8Array(32);h(f,i,a,yt);for(var u=new Uint8Array(8),c=0;8>c;c++)u[c]=i[c+16];return s(r,t,n,e,o,u,f)}function w(r,t){return 255&r[t]|(255&r[t+1])<<8}function l(r,t,n){r[t]=n>>>0&255,r[t+1]=n>>>8&255}function p(r,t,n,e,o,i){var a=new wt(i);return a.update(n,e,o),a.finish(r,t),0}function g(r,t,n,o,i,a){var f=new Uint8Array(16);return p(f,0,n,o,i,a),e(r,t,f,0)}function v(r,t,n,e,o){var i;if(32>n)return-1;for(y(r,0,t,0,n,e,o),p(r,16,r,32,n-32,r),i=0;16>i;i++)r[i]=0;return 0}function b(r,t,n,e,o){var i,a=new Uint8Array(32);if(32>n)return-1;if(c(a,0,32,e,o),0!==g(t,16,t,32,n-32,a))return-1;for(y(r,0,t,0,n,e,o),i=0;32>i;i++)r[i]=0;return 0}function A(r,t){var n;for(n=0;16>n;n++)r[n]=0|t[n]}function d(r){var t,n;for(n=0;16>n;n++)r[n]+=65536,t=Math.floor(r[n]/65536),r[(n+1)*(15>n?1:0)]+=t-1+37*(t-1)*(15===n?1:0),r[n]-=65536*t}function _(r,t,n){for(var e,o=~(n-1),i=0;16>i;i++)e=o&(r[i]^t[i]),r[i]^=e,t[i]^=e}function U(r,t){var n,e,o,i=rt(),a=rt();for(n=0;16>n;n++)a[n]=t[n];for(d(a),d(a),d(a),e=0;2>e;e++){for(i[0]=a[0]-65517,n=1;15>n;n++)i[n]=a[n]-65535-(i[n-1]>>16&1),i[n-1]&=65535;i[15]=a[15]-32767-(i[14]>>16&1),o=i[15]>>16&1,i[14]&=65535,_(a,i,1-o)}for(n=0;16>n;n++)r[2*n]=255&a[n],r[2*n+1]=a[n]>>8}function E(r,t){var n=new Uint8Array(32),e=new Uint8Array(32);return U(n,r),U(e,t),o(n,0,e,0)}function x(r){var t=new Uint8Array(32);return U(t,r),1&t[0]}function m(r,t){var n;for(n=0;16>n;n++)r[n]=t[2*n]+(t[2*n+1]<<8);r[15]&=32767}function B(r,t,n){var e;for(e=0;16>e;e++)r[e]=t[e]+n[e]|0}function S(r,t,n){var e;for(e=0;16>e;e++)r[e]=t[e]-n[e]|0}function K(r,t,n){var e,o,i=new Float64Array(31);for(e=0;31>e;e++)i[e]=0;for(e=0;16>e;e++)for(o=0;16>o;o++)i[e+o]+=t[e]*n[o];for(e=0;15>e;e++)i[e]+=38*i[e+16];for(e=0;16>e;e++)r[e]=i[e];d(r),d(r)}function T(r,t){K(r,t,t)}function Y(r,t){var n,e=rt();for(n=0;16>n;n++)e[n]=t[n];for(n=253;n>=0;n--)T(e,e),2!==n&&4!==n&&K(e,e,t);for(n=0;16>n;n++)r[n]=e[n]}function k(r,t){var n,e=rt();for(n=0;16>n;n++)e[n]=t[n];for(n=250;n>=0;n--)T(e,e),1!==n&&K(e,e,t);for(n=0;16>n;n++)r[n]=e[n]}function L(r,t,n){var e,o,i=new Uint8Array(32),a=new Float64Array(80),f=rt(),h=rt(),s=rt(),u=rt(),c=rt(),y=rt();for(o=0;31>o;o++)i[o]=t[o];for(i[31]=127&t[31]|64,i[0]&=248,m(a,n),o=0;16>o;o++)h[o]=a[o],u[o]=f[o]=s[o]=0;for(f[0]=u[0]=1,o=254;o>=0;--o)e=i[o>>>3]>>>(7&o)&1,_(f,h,e),_(s,u,e),B(c,f,s),S(f,f,s),B(s,h,u),S(h,h,u),T(u,c),T(y,f),K(f,s,f),K(s,h,c),B(c,f,s),S(f,f,s),T(h,f),S(s,u,y),K(f,s,at),B(f,f,u),K(s,s,f),K(f,u,y),K(u,h,a),T(h,c),_(f,h,e),_(s,u,e);for(o=0;16>o;o++)a[o+16]=f[o],a[o+32]=s[o],a[o+48]=h[o],a[o+64]=u[o];var w=a.subarray(32),l=a.subarray(16);return Y(w,w),K(l,l,w),U(r,l),0}function C(r,t){return L(r,t,et)}function R(r,t){return tt(t,32),C(r,t)}function z(r,t,n){var e=new Uint8Array(32);return L(e,n,t),h(r,nt,e,yt)}function P(r,t,n,e,o,i){var a=new Uint8Array(32);return z(a,o,i),lt(r,t,n,e,a)}function F(r,t,n,e,o,i){var a=new Uint8Array(32);return z(a,o,i),pt(r,t,n,e,a)}function N(r,t,n,e){for(var o,i,a,f,h,s,u,c,y,w,l,p,g,v,b,A,d,_,U,E,x,m,B,S,K,T,Y=new Int32Array(16),k=new Int32Array(16),L=r[0],C=r[1],R=r[2],z=r[3],P=r[4],F=r[5],N=r[6],O=r[7],I=t[0],M=t[1],G=t[2],Z=t[3],j=t[4],V=t[5],q=t[6],X=t[7],D=0;e>=128;){for(U=0;16>U;U++)E=8*U+D,Y[U]=n[E+0]<<24|n[E+1]<<16|n[E+2]<<8|n[E+3],k[U]=n[E+4]<<24|n[E+5]<<16|n[E+6]<<8|n[E+7];for(U=0;80>U;U++)if(o=L,i=C,a=R,f=z,h=P,s=F,u=N,c=O,y=I,w=M,l=G,p=Z,g=j,v=V,b=q,A=X,x=O,m=X,B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=(P>>>14|j<<18)^(P>>>18|j<<14)^(j>>>9|P<<23),m=(j>>>14|P<<18)^(j>>>18|P<<14)^(P>>>9|j<<23),B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,x=P&F^~P&N,m=j&V^~j&q,B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,x=gt[2*U],m=gt[2*U+1],B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,x=Y[U%16],m=k[U%16],B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,d=65535&K|T<<16,_=65535&B|S<<16,x=d,m=_,B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=(L>>>28|I<<4)^(I>>>2|L<<30)^(I>>>7|L<<25),m=(I>>>28|L<<4)^(L>>>2|I<<30)^(L>>>7|I<<25),B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,x=L&C^L&R^C&R,m=I&M^I&G^M&G,B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,c=65535&K|T<<16,A=65535&B|S<<16,x=f,m=p,B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=d,m=_,B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,f=65535&K|T<<16,p=65535&B|S<<16,C=o,R=i,z=a,P=f,F=h,N=s,O=u,L=c,M=y,G=w,Z=l,j=p,V=g,q=v,X=b,I=A,U%16===15)for(E=0;16>E;E++)x=Y[E],m=k[E],B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=Y[(E+9)%16],m=k[(E+9)%16],B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,d=Y[(E+1)%16],_=k[(E+1)%16],x=(d>>>1|_<<31)^(d>>>8|_<<24)^d>>>7,m=(_>>>1|d<<31)^(_>>>8|d<<24)^(_>>>7|d<<25),B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,d=Y[(E+14)%16],_=k[(E+14)%16],x=(d>>>19|_<<13)^(_>>>29|d<<3)^d>>>6,m=(_>>>19|d<<13)^(d>>>29|_<<3)^(_>>>6|d<<26),B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,Y[E]=65535&K|T<<16,k[E]=65535&B|S<<16;x=L,m=I,B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=r[0],m=t[0],B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,r[0]=L=65535&K|T<<16,t[0]=I=65535&B|S<<16,x=C,m=M,B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=r[1],m=t[1],B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,r[1]=C=65535&K|T<<16,t[1]=M=65535&B|S<<16,x=R,m=G,B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=r[2],m=t[2],B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,r[2]=R=65535&K|T<<16,t[2]=G=65535&B|S<<16,x=z,m=Z,B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=r[3],m=t[3],B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,r[3]=z=65535&K|T<<16,t[3]=Z=65535&B|S<<16,x=P,m=j,B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=r[4],m=t[4],B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,r[4]=P=65535&K|T<<16,t[4]=j=65535&B|S<<16,x=F,m=V,B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=r[5],m=t[5],B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,r[5]=F=65535&K|T<<16,t[5]=V=65535&B|S<<16,x=N,m=q,B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=r[6],m=t[6],B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,r[6]=N=65535&K|T<<16,t[6]=q=65535&B|S<<16,x=O,m=X,B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=r[7],m=t[7],B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,r[7]=O=65535&K|T<<16,t[7]=X=65535&B|S<<16,D+=128,e-=128}return e}function O(r,n,e){var o,i=new Int32Array(8),a=new Int32Array(8),f=new Uint8Array(256),h=e;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,a[0]=4089235720,a[1]=2227873595,a[2]=4271175723,a[3]=1595750129,a[4]=2917565137,a[5]=725511199,a[6]=4215389547,a[7]=327033209,N(i,a,n,e),e%=128,o=0;e>o;o++)f[o]=n[h-e+o];for(f[e]=128,e=256-128*(112>e?1:0),f[e-9]=0,t(f,e-8,h/536870912|0,h<<3),N(i,a,f,e),o=0;8>o;o++)t(r,8*o,i[o],a[o]);return 0}function I(r,t){var n=rt(),e=rt(),o=rt(),i=rt(),a=rt(),f=rt(),h=rt(),s=rt(),u=rt();S(n,r[1],r[0]),S(u,t[1],t[0]),K(n,n,u),B(e,r[0],r[1]),B(u,t[0],t[1]),K(e,e,u),K(o,r[3],t[3]),K(o,o,ht),K(i,r[2],t[2]),B(i,i,i),S(a,e,n),S(f,i,o),B(h,i,o),B(s,e,n),K(r[0],a,f),K(r[1],s,h),K(r[2],h,f),K(r[3],a,s)}function M(r,t,n){var e;for(e=0;4>e;e++)_(r[e],t[e],n)}function G(r,t){var n=rt(),e=rt(),o=rt();Y(o,t[2]),K(n,t[0],o),K(e,t[1],o),U(r,e),r[31]^=x(n)<<7}function Z(r,t,n){var e,o;for(A(r[0],ot),A(r[1],it),A(r[2],it),A(r[3],ot),o=255;o>=0;--o)e=n[o/8|0]>>(7&o)&1,M(r,t,e),I(t,r),I(r,r),M(r,t,e)}function j(r,t){var n=[rt(),rt(),rt(),rt()];A(n[0],st),A(n[1],ut),A(n[2],it),K(n[3],st,ut),Z(r,n,t)}function V(r,t,n){var e,o=new Uint8Array(64),i=[rt(),rt(),rt(),rt()];for(n||tt(t,32),O(o,t,32),o[0]&=248,o[31]&=127,o[31]|=64,j(i,o),G(r,i),e=0;32>e;e++)t[e+32]=r[e];return 0}function q(r,t){var n,e,o,i;for(e=63;e>=32;--e){for(n=0,o=e-32,i=e-12;i>o;++o)t[o]+=n-16*t[e]*vt[o-(e-32)],n=t[o]+128>>8,t[o]-=256*n;t[o]+=n,t[e]=0}for(n=0,o=0;32>o;o++)t[o]+=n-(t[31]>>4)*vt[o],n=t[o]>>8,t[o]&=255;for(o=0;32>o;o++)t[o]-=n*vt[o];for(e=0;32>e;e++)t[e+1]+=t[e]>>8,r[e]=255&t[e]}function X(r){var t,n=new Float64Array(64);for(t=0;64>t;t++)n[t]=r[t];for(t=0;64>t;t++)r[t]=0;q(r,n)}function D(r,t,n,e){var o,i,a=new Uint8Array(64),f=new Uint8Array(64),h=new Uint8Array(64),s=new Float64Array(64),u=[rt(),rt(),rt(),rt()];O(a,e,32),a[0]&=248,a[31]&=127,a[31]|=64;var c=n+64;for(o=0;n>o;o++)r[64+o]=t[o];for(o=0;32>o;o++)r[32+o]=a[32+o];for(O(h,r.subarray(32),n+32),X(h),j(u,h),G(r,u),o=32;64>o;o++)r[o]=e[o];for(O(f,r,n+64),X(f),o=0;64>o;o++)s[o]=0;for(o=0;32>o;o++)s[o]=h[o];for(o=0;32>o;o++)for(i=0;32>i;i++)s[o+i]+=f[o]*a[i];return q(r.subarray(32),s),c}function H(r,t){var n=rt(),e=rt(),o=rt(),i=rt(),a=rt(),f=rt(),h=rt();return A(r[2],it),m(r[1],t),T(o,r[1]),K(i,o,ft),S(o,o,r[2]),B(i,r[2],i),T(a,i),T(f,a),K(h,f,a),K(n,h,o),K(n,n,i),k(n,n),K(n,n,o),K(n,n,i),K(n,n,i),K(r[0],n,i),T(e,r[0]),K(e,e,i),E(e,o)&&K(r[0],r[0],ct),T(e,r[0]),K(e,e,i),E(e,o)?-1:(x(r[0])===t[31]>>7&&S(r[0],ot,r[0]),K(r[3],r[0],r[1]),0)}function J(r,t,n,e){var i,a,f=new Uint8Array(32),h=new Uint8Array(64),s=[rt(),rt(),rt(),rt()],u=[rt(),rt(),rt(),rt()];if(a=-1,64>n)return-1;if(H(u,e))return-1;for(i=0;n>i;i++)r[i]=t[i];for(i=0;32>i;i++)r[i+32]=e[i];if(O(h,r,n),X(h),Z(s,u,h),j(u,t.subarray(32)),I(s,u),G(f,s),n-=64,o(t,0,f,0)){for(i=0;n>i;i++)r[i]=0;return-1}for(i=0;n>i;i++)r[i]=t[i+64];return a=n}function Q(r,t){if(r.length!==bt)throw new Error("bad key size");if(t.length!==At)throw new Error("bad nonce size")}function W(r,t){if(r.length!==xt)throw new Error("bad public key size");if(t.length!==mt)throw new Error("bad secret key size")}function $(){for(var r,t={}.toString,n=0;n>>13|e<<3),o=w(r,4),this.r[2]=7939&(e>>>10|o<<6),i=w(r,6),this.r[3]=8191&(o>>>7|i<<9),a=w(r,8),this.r[4]=255&(i>>>4|a<<12),this.r[5]=a>>>1&8190,f=w(r,10),this.r[6]=8191&(a>>>14|f<<2),h=w(r,12),this.r[7]=8065&(f>>>11|h<<5),s=w(r,14),this.r[8]=8191&(h>>>8|s<<8),this.r[9]=s>>>5&127,t=0;8>t;t++)this.pad[t]=w(r,16+2*t)};wt.prototype.blocks=function(r,t,n){for(var e,o,i,a,f,h,s,u,c,y,l,p=this.fin?0:2048,g=new Uint32Array(10);n>=16;){for(e=w(r,t+0),this.h[0]+=8191&e,o=w(r,t+2),this.h[1]+=8191&(e>>>13|o<<3),i=w(r,t+4),this.h[2]+=8191&(o>>>10|i<<6),a=w(r,t+6),this.h[3]+=8191&(i>>>7|a<<9),f=w(r,t+8),this.h[4]+=8191&(a>>>4|f<<12),this.h[5]+=f>>>1&8191,h=w(r,t+10),this.h[6]+=8191&(f>>>14|h<<2),s=w(r,t+12),this.h[7]+=8191&(h>>>11|s<<5),u=w(r,t+14),this.h[8]+=8191&(s>>>8|u<<8),this.h[9]+=u>>>5|p,y=0,c=0;10>y;y++){for(g[y]=c,l=0;10>l;l++)g[y]+=this.h[l]*(y>=l?this.r[y-l]:5*this.r[y+10-l]),4===l&&(c=g[y]>>>13,g[y]&=8191);c+=g[y]>>>13,g[y]&=8191}for(c=(c<<2)+c|0,c=c+g[0]|0,g[0]=8191&c,c>>>=13,g[1]+=c,y=0;10>y;y++)this.h[y]=g[y];t+=16,n-=16}},wt.prototype.finish=function(r,t){var n,e,o,i,a=new Uint16Array(10);if(this.leftover){for(i=this.leftover,this.buffer[i++]=1;16>i;i++)this.buffer[i]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(n=this.h[1]>>>13,this.h[1]&=8191,i=2;10>i;i++)this.h[i]+=n,n=this.h[i]>>>13,this.h[i]&=8191;for(this.h[0]+=5*n,n=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=n,n=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=n,a[0]=this.h[0]+5,n=a[0]>>>13,a[0]&=8191,i=1;10>i;i++)a[i]=this.h[i]+n,n=a[i]>>>13,a[i]&=8191;for(a[9]-=8192,e=(a[9]>>>15)-1,i=0;10>i;i++)a[i]&=e;for(e=~e,i=0;10>i;i++)this.h[i]=this.h[i]&e|a[i];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,i=1;8>i;i++)o=(this.h[i]+this.pad[i]|0)+(o>>>16)|0,this.h[i]=65535&o;for(i=0;8>i;i++)l(r,t+2*i,this.h[i])},wt.prototype.update=function(r,t,n){var e,o;if(this.leftover){for(o=16-this.leftover,o>n&&(o=n),e=0;o>e;e++)this.buffer[this.leftover+e]=r[t+e];if(n-=o,t+=o,this.leftover+=o,this.leftover<16)return;this.blocks(buffer,0,16),this.leftover=0}if(n>=16&&(o=n-n%16,this.blocks(r,t,o),t+=o,n-=o),n){for(e=0;n>e;e++)this.buffer[this.leftover+e]=r[t+e];this.leftover+=n}};var lt=v,pt=b,gt=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],vt=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),bt=32,At=24,dt=32,_t=16,Ut=32,Et=32,xt=32,mt=32,Bt=32,St=At,Kt=dt,Tt=_t,Yt=64,kt=32,Lt=64,Ct=32,Rt=64;r.lowlevel={crypto_core_hsalsa20:h,crypto_stream_xor:y,crypto_stream:c,crypto_stream_salsa20_xor:s,crypto_stream_salsa20:u,crypto_onetimeauth:p,crypto_onetimeauth_verify:g,crypto_verify_16:e,crypto_verify_32:o,crypto_secretbox:v,crypto_secretbox_open:b,crypto_scalarmult:L,crypto_scalarmult_base:C,crypto_box_beforenm:z,crypto_box_afternm:lt,crypto_box:P,crypto_box_open:F,crypto_box_keypair:R,crypto_hash:O,crypto_sign:D,crypto_sign_keypair:V,crypto_sign_open:J,crypto_secretbox_KEYBYTES:bt,crypto_secretbox_NONCEBYTES:At,crypto_secretbox_ZEROBYTES:dt,crypto_secretbox_BOXZEROBYTES:_t,crypto_scalarmult_BYTES:Ut,crypto_scalarmult_SCALARBYTES:Et,crypto_box_PUBLICKEYBYTES:xt,crypto_box_SECRETKEYBYTES:mt,crypto_box_BEFORENMBYTES:Bt,crypto_box_NONCEBYTES:St,crypto_box_ZEROBYTES:Kt,crypto_box_BOXZEROBYTES:Tt,crypto_sign_BYTES:Yt,crypto_sign_PUBLICKEYBYTES:kt,crypto_sign_SECRETKEYBYTES:Lt,crypto_sign_SEEDBYTES:Ct,crypto_hash_BYTES:Rt},r.util={},r.util.decodeUTF8=function(r){var t,n=unescape(encodeURIComponent(r)),e=new Uint8Array(n.length);for(t=0;tt;t++)n.push(String.fromCharCode(r[t]));return btoa(n.join(""))},r.util.decodeBase64=function(r){if("undefined"==typeof atob)return new Uint8Array(Array.prototype.slice.call(new Buffer(r,"base64"),0));var t,n=atob(r),e=new Uint8Array(n.length);for(t=0;te)return null;for(var o=new Uint8Array(e),i=0;ie;e++)o[e]=t[e];for(e=0;e=0},r.sign.keyPair=function(){var r=new Uint8Array(kt),t=new Uint8Array(Lt);return V(r,t),{publicKey:r,secretKey:t}},r.sign.keyPair.fromSecretKey=function(r){if($(r),r.length!==Lt)throw new Error("bad secret key size");for(var t=new Uint8Array(kt),n=0;ne;e++)n[e]=r[e];return V(t,n,!0),{publicKey:t,secretKey:n}},r.sign.publicKeyLength=kt,r.sign.secretKeyLength=Lt,r.sign.seedLength=Ct,r.sign.signatureLength=Yt,r.hash=function(r){$(r);var t=new Uint8Array(Rt);return O(t,r,r.length),t},r.hash.hashLength=Rt,r.verify=function(r,t){return $(r,t),0===r.length||0===t.length?!1:r.length!==t.length?!1:0===n(r,0,t,0,r.length)?!0:!1},r.setPRNG=function(r){tt=r},function(){var t;"undefined"!=typeof window?(window.crypto&&window.crypto.getRandomValues?t=window.crypto:window.msCrypto&&window.msCrypto.getRandomValues&&(t=window.msCrypto),t&&r.setPRNG(function(r,n){var e,o=new Uint8Array(n);for(t.getRandomValues(o),e=0;n>e;e++)r[e]=o[e]})):"undefined"!=typeof require&&(t=require("crypto"),t&&r.setPRNG(function(r,n){var e,o=t.randomBytes(n);for(e=0;n>e;e++)r[e]=o[e]}))}()}("undefined"!=typeof module&&module.exports?module.exports:window.nacl=window.nacl||{}); \ No newline at end of file +!function(r){"use strict";function t(r,t,n,e){r[t]=n>>24&255,r[t+1]=n>>16&255,r[t+2]=n>>8&255,r[t+3]=255&n,r[t+4]=e>>24&255,r[t+5]=e>>16&255,r[t+6]=e>>8&255,r[t+7]=255&e}function n(r,t,n,e,i){var o,h=0;for(o=0;i>o;o++)h|=r[t+o]^n[e+o];return(1&h-1>>>8)-1}function e(r,t,e,i){return n(r,t,e,i,16)}function i(r,t,e,i){return n(r,t,e,i,32)}function o(r,t,n,e){for(var i,o=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,h=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,s=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,u=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,y=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,l=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,w=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,p=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,g=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,v=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,b=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,d=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,A=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,_=o,U=h,E=a,x=f,m=s,B=u,S=c,K=y,T=l,Y=w,k=p,L=g,C=v,R=b,z=d,P=A,F=0;20>F;F+=2)i=_+C|0,m^=i<<7|i>>>25,i=m+_|0,T^=i<<9|i>>>23,i=T+m|0,C^=i<<13|i>>>19,i=C+T|0,_^=i<<18|i>>>14,i=B+U|0,Y^=i<<7|i>>>25,i=Y+B|0,R^=i<<9|i>>>23,i=R+Y|0,U^=i<<13|i>>>19,i=U+R|0,B^=i<<18|i>>>14,i=k+S|0,z^=i<<7|i>>>25,i=z+k|0,E^=i<<9|i>>>23,i=E+z|0,S^=i<<13|i>>>19,i=S+E|0,k^=i<<18|i>>>14,i=P+L|0,x^=i<<7|i>>>25,i=x+P|0,K^=i<<9|i>>>23,i=K+x|0,L^=i<<13|i>>>19,i=L+K|0,P^=i<<18|i>>>14,i=_+x|0,U^=i<<7|i>>>25,i=U+_|0,E^=i<<9|i>>>23,i=E+U|0,x^=i<<13|i>>>19,i=x+E|0,_^=i<<18|i>>>14,i=B+m|0,S^=i<<7|i>>>25,i=S+B|0,K^=i<<9|i>>>23,i=K+S|0,m^=i<<13|i>>>19,i=m+K|0,B^=i<<18|i>>>14,i=k+Y|0,L^=i<<7|i>>>25,i=L+k|0,T^=i<<9|i>>>23,i=T+L|0,Y^=i<<13|i>>>19,i=Y+T|0,k^=i<<18|i>>>14,i=P+z|0,C^=i<<7|i>>>25,i=C+P|0,R^=i<<9|i>>>23,i=R+C|0,z^=i<<13|i>>>19,i=z+R|0,P^=i<<18|i>>>14;_=_+o|0,U=U+h|0,E=E+a|0,x=x+f|0,m=m+s|0,B=B+u|0,S=S+c|0,K=K+y|0,T=T+l|0,Y=Y+w|0,k=k+p|0,L=L+g|0,C=C+v|0,R=R+b|0,z=z+d|0,P=P+A|0,r[0]=_>>>0&255,r[1]=_>>>8&255,r[2]=_>>>16&255,r[3]=_>>>24&255,r[4]=U>>>0&255,r[5]=U>>>8&255,r[6]=U>>>16&255,r[7]=U>>>24&255,r[8]=E>>>0&255,r[9]=E>>>8&255,r[10]=E>>>16&255,r[11]=E>>>24&255,r[12]=x>>>0&255,r[13]=x>>>8&255,r[14]=x>>>16&255,r[15]=x>>>24&255,r[16]=m>>>0&255,r[17]=m>>>8&255,r[18]=m>>>16&255,r[19]=m>>>24&255,r[20]=B>>>0&255,r[21]=B>>>8&255,r[22]=B>>>16&255,r[23]=B>>>24&255,r[24]=S>>>0&255,r[25]=S>>>8&255,r[26]=S>>>16&255,r[27]=S>>>24&255,r[28]=K>>>0&255,r[29]=K>>>8&255,r[30]=K>>>16&255,r[31]=K>>>24&255,r[32]=T>>>0&255,r[33]=T>>>8&255,r[34]=T>>>16&255,r[35]=T>>>24&255,r[36]=Y>>>0&255,r[37]=Y>>>8&255,r[38]=Y>>>16&255,r[39]=Y>>>24&255,r[40]=k>>>0&255,r[41]=k>>>8&255,r[42]=k>>>16&255,r[43]=k>>>24&255,r[44]=L>>>0&255,r[45]=L>>>8&255,r[46]=L>>>16&255,r[47]=L>>>24&255,r[48]=C>>>0&255,r[49]=C>>>8&255,r[50]=C>>>16&255,r[51]=C>>>24&255,r[52]=R>>>0&255,r[53]=R>>>8&255,r[54]=R>>>16&255,r[55]=R>>>24&255,r[56]=z>>>0&255,r[57]=z>>>8&255,r[58]=z>>>16&255,r[59]=z>>>24&255,r[60]=P>>>0&255,r[61]=P>>>8&255,r[62]=P>>>16&255,r[63]=P>>>24&255}function h(r,t,n,e){for(var i,o=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,h=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,s=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,u=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,y=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,l=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,w=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,p=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,g=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,v=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,b=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,d=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,A=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,_=o,U=h,E=a,x=f,m=s,B=u,S=c,K=y,T=l,Y=w,k=p,L=g,C=v,R=b,z=d,P=A,F=0;20>F;F+=2)i=_+C|0,m^=i<<7|i>>>25,i=m+_|0,T^=i<<9|i>>>23,i=T+m|0,C^=i<<13|i>>>19,i=C+T|0,_^=i<<18|i>>>14,i=B+U|0,Y^=i<<7|i>>>25,i=Y+B|0,R^=i<<9|i>>>23,i=R+Y|0,U^=i<<13|i>>>19,i=U+R|0,B^=i<<18|i>>>14,i=k+S|0,z^=i<<7|i>>>25,i=z+k|0,E^=i<<9|i>>>23,i=E+z|0,S^=i<<13|i>>>19,i=S+E|0,k^=i<<18|i>>>14,i=P+L|0,x^=i<<7|i>>>25,i=x+P|0,K^=i<<9|i>>>23,i=K+x|0,L^=i<<13|i>>>19,i=L+K|0,P^=i<<18|i>>>14,i=_+x|0,U^=i<<7|i>>>25,i=U+_|0,E^=i<<9|i>>>23,i=E+U|0,x^=i<<13|i>>>19,i=x+E|0,_^=i<<18|i>>>14,i=B+m|0,S^=i<<7|i>>>25,i=S+B|0,K^=i<<9|i>>>23,i=K+S|0,m^=i<<13|i>>>19,i=m+K|0,B^=i<<18|i>>>14,i=k+Y|0,L^=i<<7|i>>>25,i=L+k|0,T^=i<<9|i>>>23,i=T+L|0,Y^=i<<13|i>>>19,i=Y+T|0,k^=i<<18|i>>>14,i=P+z|0,C^=i<<7|i>>>25,i=C+P|0,R^=i<<9|i>>>23,i=R+C|0,z^=i<<13|i>>>19,i=z+R|0,P^=i<<18|i>>>14;r[0]=_>>>0&255,r[1]=_>>>8&255,r[2]=_>>>16&255,r[3]=_>>>24&255,r[4]=B>>>0&255,r[5]=B>>>8&255,r[6]=B>>>16&255,r[7]=B>>>24&255,r[8]=k>>>0&255,r[9]=k>>>8&255,r[10]=k>>>16&255,r[11]=k>>>24&255,r[12]=P>>>0&255,r[13]=P>>>8&255,r[14]=P>>>16&255,r[15]=P>>>24&255,r[16]=S>>>0&255,r[17]=S>>>8&255,r[18]=S>>>16&255,r[19]=S>>>24&255,r[20]=K>>>0&255,r[21]=K>>>8&255,r[22]=K>>>16&255,r[23]=K>>>24&255,r[24]=T>>>0&255,r[25]=T>>>8&255,r[26]=T>>>16&255,r[27]=T>>>24&255,r[28]=Y>>>0&255,r[29]=Y>>>8&255,r[30]=Y>>>16&255,r[31]=Y>>>24&255}function a(r,t,n,e){o(r,t,n,e)}function f(r,t,n,e){h(r,t,n,e)}function s(r,t,n,e,i,o,h){var f,s,u=new Uint8Array(16),c=new Uint8Array(64);for(s=0;16>s;s++)u[s]=0;for(s=0;8>s;s++)u[s]=o[s];for(;i>=64;){for(a(c,u,h,ut),s=0;64>s;s++)r[t+s]=n[e+s]^c[s];for(f=1,s=8;16>s;s++)f=f+(255&u[s])|0,u[s]=255&f,f>>>=8;i-=64,t+=64,e+=64}if(i>0)for(a(c,u,h,ut),s=0;i>s;s++)r[t+s]=n[e+s]^c[s];return 0}function u(r,t,n,e,i){var o,h,f=new Uint8Array(16),s=new Uint8Array(64);for(h=0;16>h;h++)f[h]=0;for(h=0;8>h;h++)f[h]=e[h];for(;n>=64;){for(a(s,f,i,ut),h=0;64>h;h++)r[t+h]=s[h];for(o=1,h=8;16>h;h++)o=o+(255&f[h])|0,f[h]=255&o,o>>>=8;n-=64,t+=64}if(n>0)for(a(s,f,i,ut),h=0;n>h;h++)r[t+h]=s[h];return 0}function c(r,t,n,e,i){var o=new Uint8Array(32);f(o,e,i,ut);for(var h=new Uint8Array(8),a=0;8>a;a++)h[a]=e[a+16];return u(r,t,n,h,o)}function y(r,t,n,e,i,o,h){var a=new Uint8Array(32);f(a,o,h,ut);for(var u=new Uint8Array(8),c=0;8>c;c++)u[c]=o[c+16];return s(r,t,n,e,i,u,a)}function l(r,t,n,e,i,o){var h=new ct(o);return h.update(n,e,i),h.finish(r,t),0}function w(r,t,n,i,o,h){var a=new Uint8Array(16);return l(a,0,n,i,o,h),e(r,t,a,0)}function p(r,t,n,e,i){var o;if(32>n)return-1;for(y(r,0,t,0,n,e,i),l(r,16,r,32,n-32,r),o=0;16>o;o++)r[o]=0;return 0}function g(r,t,n,e,i){var o,h=new Uint8Array(32);if(32>n)return-1;if(c(h,0,32,e,i),0!==w(t,16,t,32,n-32,h))return-1;for(y(r,0,t,0,n,e,i),o=0;32>o;o++)r[o]=0;return 0}function v(r,t){var n;for(n=0;16>n;n++)r[n]=0|t[n]}function b(r){var t,n;for(n=0;16>n;n++)r[n]+=65536,t=Math.floor(r[n]/65536),r[(n+1)*(15>n?1:0)]+=t-1+37*(t-1)*(15===n?1:0),r[n]-=65536*t}function d(r,t,n){for(var e,i=~(n-1),o=0;16>o;o++)e=i&(r[o]^t[o]),r[o]^=e,t[o]^=e}function A(r,t){var n,e,i,o=W(),h=W();for(n=0;16>n;n++)h[n]=t[n];for(b(h),b(h),b(h),e=0;2>e;e++){for(o[0]=h[0]-65517,n=1;15>n;n++)o[n]=h[n]-65535-(o[n-1]>>16&1),o[n-1]&=65535;o[15]=h[15]-32767-(o[14]>>16&1),i=o[15]>>16&1,o[14]&=65535,d(h,o,1-i)}for(n=0;16>n;n++)r[2*n]=255&h[n],r[2*n+1]=h[n]>>8}function _(r,t){var n=new Uint8Array(32),e=new Uint8Array(32);return A(n,r),A(e,t),i(n,0,e,0)}function U(r){var t=new Uint8Array(32);return A(t,r),1&t[0]}function E(r,t){var n;for(n=0;16>n;n++)r[n]=t[2*n]+(t[2*n+1]<<8);r[15]&=32767}function x(r,t,n){var e;for(e=0;16>e;e++)r[e]=t[e]+n[e]|0}function m(r,t,n){var e;for(e=0;16>e;e++)r[e]=t[e]-n[e]|0}function B(r,t,n){var e,i,o=new Float64Array(31);for(e=0;31>e;e++)o[e]=0;for(e=0;16>e;e++)for(i=0;16>i;i++)o[e+i]+=t[e]*n[i];for(e=0;15>e;e++)o[e]+=38*o[e+16];for(e=0;16>e;e++)r[e]=o[e];b(r),b(r)}function S(r,t){B(r,t,t)}function K(r,t){var n,e=W();for(n=0;16>n;n++)e[n]=t[n];for(n=253;n>=0;n--)S(e,e),2!==n&&4!==n&&B(e,e,t);for(n=0;16>n;n++)r[n]=e[n]}function T(r,t){var n,e=W();for(n=0;16>n;n++)e[n]=t[n];for(n=250;n>=0;n--)S(e,e),1!==n&&B(e,e,t);for(n=0;16>n;n++)r[n]=e[n]}function Y(r,t,n){var e,i,o=new Uint8Array(32),h=new Float64Array(80),a=W(),f=W(),s=W(),u=W(),c=W(),y=W();for(i=0;31>i;i++)o[i]=t[i];for(o[31]=127&t[31]|64,o[0]&=248,E(h,n),i=0;16>i;i++)f[i]=h[i],u[i]=a[i]=s[i]=0;for(a[0]=u[0]=1,i=254;i>=0;--i)e=o[i>>>3]>>>(7&i)&1,d(a,f,e),d(s,u,e),x(c,a,s),m(a,a,s),x(s,f,u),m(f,f,u),S(u,c),S(y,a),B(a,s,a),B(s,f,c),x(c,a,s),m(a,a,s),S(f,a),m(s,u,y),B(a,s,it),x(a,a,u),B(s,s,a),B(a,u,y),B(u,f,h),S(f,c),d(a,f,e),d(s,u,e);for(i=0;16>i;i++)h[i+16]=a[i],h[i+32]=s[i],h[i+48]=f[i],h[i+64]=u[i];var l=h.subarray(32),w=h.subarray(16);return K(l,l),B(w,w,l),A(r,w),0}function k(r,t){return Y(r,t,tt)}function L(r,t){return $(t,32),k(r,t)}function C(r,t,n){var e=new Uint8Array(32);return Y(e,n,t),f(r,rt,e,ut)}function R(r,t,n,e,i,o){var h=new Uint8Array(32);return C(h,i,o),yt(r,t,n,e,h)}function z(r,t,n,e,i,o){var h=new Uint8Array(32);return C(h,i,o),lt(r,t,n,e,h)}function P(r,t,n,e){for(var i,o,h,a,f,s,u,c,y,l,w,p,g,v,b,d,A,_,U,E,x,m,B,S,K,T,Y=new Int32Array(16),k=new Int32Array(16),L=r[0],C=r[1],R=r[2],z=r[3],P=r[4],F=r[5],N=r[6],O=r[7],I=t[0],M=t[1],G=t[2],Z=t[3],j=t[4],V=t[5],q=t[6],X=t[7],D=0;e>=128;){for(U=0;16>U;U++)E=8*U+D,Y[U]=n[E+0]<<24|n[E+1]<<16|n[E+2]<<8|n[E+3],k[U]=n[E+4]<<24|n[E+5]<<16|n[E+6]<<8|n[E+7];for(U=0;80>U;U++)if(i=L,o=C,h=R,a=z,f=P,s=F,u=N,c=O,y=I,l=M,w=G,p=Z,g=j,v=V,b=q,d=X,x=O,m=X,B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=(P>>>14|j<<18)^(P>>>18|j<<14)^(j>>>9|P<<23),m=(j>>>14|P<<18)^(j>>>18|P<<14)^(P>>>9|j<<23),B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,x=P&F^~P&N,m=j&V^~j&q,B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,x=wt[2*U],m=wt[2*U+1],B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,x=Y[U%16],m=k[U%16],B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,A=65535&K|T<<16,_=65535&B|S<<16,x=A,m=_,B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=(L>>>28|I<<4)^(I>>>2|L<<30)^(I>>>7|L<<25),m=(I>>>28|L<<4)^(L>>>2|I<<30)^(L>>>7|I<<25),B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,x=L&C^L&R^C&R,m=I&M^I&G^M&G,B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,c=65535&K|T<<16,d=65535&B|S<<16,x=a,m=p,B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=A,m=_,B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,a=65535&K|T<<16,p=65535&B|S<<16,C=i,R=o,z=h,P=a,F=f,N=s,O=u,L=c,M=y,G=l,Z=w,j=p,V=g,q=v,X=b,I=d,U%16===15)for(E=0;16>E;E++)x=Y[E],m=k[E],B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=Y[(E+9)%16],m=k[(E+9)%16],B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,A=Y[(E+1)%16],_=k[(E+1)%16],x=(A>>>1|_<<31)^(A>>>8|_<<24)^A>>>7,m=(_>>>1|A<<31)^(_>>>8|A<<24)^(_>>>7|A<<25),B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,A=Y[(E+14)%16],_=k[(E+14)%16],x=(A>>>19|_<<13)^(_>>>29|A<<3)^A>>>6,m=(_>>>19|A<<13)^(A>>>29|_<<3)^(_>>>6|A<<26),B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,Y[E]=65535&K|T<<16,k[E]=65535&B|S<<16;x=L,m=I,B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=r[0],m=t[0],B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,r[0]=L=65535&K|T<<16,t[0]=I=65535&B|S<<16,x=C,m=M,B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=r[1],m=t[1],B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,r[1]=C=65535&K|T<<16,t[1]=M=65535&B|S<<16,x=R,m=G,B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=r[2],m=t[2],B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,r[2]=R=65535&K|T<<16,t[2]=G=65535&B|S<<16,x=z,m=Z,B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=r[3],m=t[3],B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,r[3]=z=65535&K|T<<16,t[3]=Z=65535&B|S<<16,x=P,m=j,B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=r[4],m=t[4],B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,r[4]=P=65535&K|T<<16,t[4]=j=65535&B|S<<16,x=F,m=V,B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=r[5],m=t[5],B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,r[5]=F=65535&K|T<<16,t[5]=V=65535&B|S<<16,x=N,m=q,B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=r[6],m=t[6],B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,r[6]=N=65535&K|T<<16,t[6]=q=65535&B|S<<16,x=O,m=X,B=65535&m,S=m>>>16,K=65535&x,T=x>>>16,x=r[7],m=t[7],B+=65535&m,S+=m>>>16,K+=65535&x,T+=x>>>16,S+=B>>>16,K+=S>>>16,T+=K>>>16,r[7]=O=65535&K|T<<16,t[7]=X=65535&B|S<<16,D+=128,e-=128}return e}function F(r,n,e){var i,o=new Int32Array(8),h=new Int32Array(8),a=new Uint8Array(256),f=e;for(o[0]=1779033703,o[1]=3144134277,o[2]=1013904242,o[3]=2773480762,o[4]=1359893119,o[5]=2600822924,o[6]=528734635,o[7]=1541459225,h[0]=4089235720,h[1]=2227873595,h[2]=4271175723,h[3]=1595750129,h[4]=2917565137,h[5]=725511199,h[6]=4215389547,h[7]=327033209,P(o,h,n,e),e%=128,i=0;e>i;i++)a[i]=n[f-e+i];for(a[e]=128,e=256-128*(112>e?1:0),a[e-9]=0,t(a,e-8,f/536870912|0,f<<3),P(o,h,a,e),i=0;8>i;i++)t(r,8*i,o[i],h[i]);return 0}function N(r,t){var n=W(),e=W(),i=W(),o=W(),h=W(),a=W(),f=W(),s=W(),u=W();m(n,r[1],r[0]),m(u,t[1],t[0]),B(n,n,u),x(e,r[0],r[1]),x(u,t[0],t[1]),B(e,e,u),B(i,r[3],t[3]),B(i,i,ht),B(o,r[2],t[2]),x(o,o,o),m(h,e,n),m(a,o,i),x(f,o,i),x(s,e,n),B(r[0],h,a),B(r[1],s,f),B(r[2],f,a),B(r[3],h,s)}function O(r,t,n){var e;for(e=0;4>e;e++)d(r[e],t[e],n)}function I(r,t){var n=W(),e=W(),i=W();K(i,t[2]),B(n,t[0],i),B(e,t[1],i),A(r,e),r[31]^=U(n)<<7}function M(r,t,n){var e,i;for(v(r[0],nt),v(r[1],et),v(r[2],et),v(r[3],nt),i=255;i>=0;--i)e=n[i/8|0]>>(7&i)&1,O(r,t,e),N(t,r),N(r,r),O(r,t,e)}function G(r,t){var n=[W(),W(),W(),W()];v(n[0],at),v(n[1],ft),v(n[2],et),B(n[3],at,ft),M(r,n,t)}function Z(r,t,n){var e,i=new Uint8Array(64),o=[W(),W(),W(),W()];for(n||$(t,32),F(i,t,32),i[0]&=248,i[31]&=127,i[31]|=64,G(o,i),I(r,o),e=0;32>e;e++)t[e+32]=r[e];return 0}function j(r,t){var n,e,i,o;for(e=63;e>=32;--e){for(n=0,i=e-32,o=e-12;o>i;++i)t[i]+=n-16*t[e]*pt[i-(e-32)],n=t[i]+128>>8,t[i]-=256*n;t[i]+=n,t[e]=0}for(n=0,i=0;32>i;i++)t[i]+=n-(t[31]>>4)*pt[i],n=t[i]>>8,t[i]&=255;for(i=0;32>i;i++)t[i]-=n*pt[i];for(e=0;32>e;e++)t[e+1]+=t[e]>>8,r[e]=255&t[e]}function V(r){var t,n=new Float64Array(64);for(t=0;64>t;t++)n[t]=r[t];for(t=0;64>t;t++)r[t]=0;j(r,n)}function q(r,t,n,e){var i,o,h=new Uint8Array(64),a=new Uint8Array(64),f=new Uint8Array(64),s=new Float64Array(64),u=[W(),W(),W(),W()];F(h,e,32),h[0]&=248,h[31]&=127,h[31]|=64;var c=n+64;for(i=0;n>i;i++)r[64+i]=t[i];for(i=0;32>i;i++)r[32+i]=h[32+i];for(F(f,r.subarray(32),n+32),V(f),G(u,f),I(r,u),i=32;64>i;i++)r[i]=e[i];for(F(a,r,n+64),V(a),i=0;64>i;i++)s[i]=0;for(i=0;32>i;i++)s[i]=f[i];for(i=0;32>i;i++)for(o=0;32>o;o++)s[i+o]+=a[i]*h[o];return j(r.subarray(32),s),c}function X(r,t){var n=W(),e=W(),i=W(),o=W(),h=W(),a=W(),f=W();return v(r[2],et),E(r[1],t),S(i,r[1]),B(o,i,ot),m(i,i,r[2]),x(o,r[2],o),S(h,o),S(a,h),B(f,a,h),B(n,f,i),B(n,n,o),T(n,n),B(n,n,i),B(n,n,o),B(n,n,o),B(r[0],n,o),S(e,r[0]),B(e,e,o),_(e,i)&&B(r[0],r[0],st),S(e,r[0]),B(e,e,o),_(e,i)?-1:(U(r[0])===t[31]>>7&&m(r[0],nt,r[0]),B(r[3],r[0],r[1]),0)}function D(r,t,n,e){var o,h,a=new Uint8Array(32),f=new Uint8Array(64),s=[W(),W(),W(),W()],u=[W(),W(),W(),W()];if(h=-1,64>n)return-1;if(X(u,e))return-1;for(o=0;n>o;o++)r[o]=t[o];for(o=0;32>o;o++)r[o+32]=e[o];if(F(f,r,n),V(f),M(s,u,f),G(u,t.subarray(32)),N(s,u),I(a,s),n-=64,i(t,0,a,0)){for(o=0;n>o;o++)r[o]=0;return-1}for(o=0;n>o;o++)r[o]=t[o+64];return h=n}function H(r,t){if(r.length!==gt)throw new Error("bad key size");if(t.length!==vt)throw new Error("bad nonce size")}function J(r,t){if(r.length!==Ut)throw new Error("bad public key size");if(t.length!==Et)throw new Error("bad secret key size")}function Q(){for(var r,t={}.toString,n=0;n>>13|n<<3),e=255&r[4]|(255&r[5])<<8,this.r[2]=7939&(n>>>10|e<<6),i=255&r[6]|(255&r[7])<<8,this.r[3]=8191&(e>>>7|i<<9),o=255&r[8]|(255&r[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,h=255&r[10]|(255&r[11])<<8,this.r[6]=8191&(o>>>14|h<<2),a=255&r[12]|(255&r[13])<<8,this.r[7]=8065&(h>>>11|a<<5),f=255&r[14]|(255&r[15])<<8,this.r[8]=8191&(a>>>8|f<<8),this.r[9]=f>>>5&127,this.pad[0]=255&r[16]|(255&r[17])<<8,this.pad[1]=255&r[18]|(255&r[19])<<8,this.pad[2]=255&r[20]|(255&r[21])<<8,this.pad[3]=255&r[22]|(255&r[23])<<8,this.pad[4]=255&r[24]|(255&r[25])<<8,this.pad[5]=255&r[26]|(255&r[27])<<8,this.pad[6]=255&r[28]|(255&r[29])<<8,this.pad[7]=255&r[30]|(255&r[31])<<8};ct.prototype.blocks=function(r,t,n){for(var e,i,o,h,a,f,s,u,c,y,l,w,p,g,v,b,d,A,_,U=this.fin?0:2048,E=this.h[0],x=this.h[1],m=this.h[2],B=this.h[3],S=this.h[4],K=this.h[5],T=this.h[6],Y=this.h[7],k=this.h[8],L=this.h[9],C=this.r[0],R=this.r[1],z=this.r[2],P=this.r[3],F=this.r[4],N=this.r[5],O=this.r[6],I=this.r[7],M=this.r[8],G=this.r[9];n>=16;)e=255&r[t+0]|(255&r[t+1])<<8,E+=8191&e,i=255&r[t+2]|(255&r[t+3])<<8,x+=8191&(e>>>13|i<<3),o=255&r[t+4]|(255&r[t+5])<<8,m+=8191&(i>>>10|o<<6),h=255&r[t+6]|(255&r[t+7])<<8,B+=8191&(o>>>7|h<<9),a=255&r[t+8]|(255&r[t+9])<<8,S+=8191&(h>>>4|a<<12),K+=a>>>1&8191,f=255&r[t+10]|(255&r[t+11])<<8,T+=8191&(a>>>14|f<<2),s=255&r[t+12]|(255&r[t+13])<<8,Y+=8191&(f>>>11|s<<5),u=255&r[t+14]|(255&r[t+15])<<8,k+=8191&(s>>>8|u<<8),L+=u>>>5|U,c=0,y=c,y+=E*C,y+=5*x*G,y+=5*m*M,y+=5*B*I,y+=5*S*O,c=y>>>13,y&=8191,y+=5*K*N,y+=5*T*F,y+=5*Y*P,y+=5*k*z,y+=5*L*R,c+=y>>>13,y&=8191,l=c,l+=E*R,l+=x*C,l+=5*m*G,l+=5*B*M,l+=5*S*I,c=l>>>13,l&=8191,l+=5*K*O,l+=5*T*N,l+=5*Y*F,l+=5*k*P,l+=5*L*z,c+=l>>>13,l&=8191,w=c,w+=E*z,w+=x*R,w+=m*C,w+=5*B*G,w+=5*S*M,c=w>>>13,w&=8191,w+=5*K*I,w+=5*T*O,w+=5*Y*N,w+=5*k*F,w+=5*L*P,c+=w>>>13,w&=8191,p=c,p+=E*P,p+=x*z,p+=m*R,p+=B*C,p+=5*S*G,c=p>>>13,p&=8191,p+=5*K*M,p+=5*T*I,p+=5*Y*O,p+=5*k*N,p+=5*L*F,c+=p>>>13,p&=8191,g=c,g+=E*F,g+=x*P,g+=m*z,g+=B*R,g+=S*C,c=g>>>13,g&=8191,g+=5*K*G,g+=5*T*M,g+=5*Y*I,g+=5*k*O,g+=5*L*N,c+=g>>>13,g&=8191,v=c,v+=E*N,v+=x*F,v+=m*P,v+=B*z,v+=S*R,c=v>>>13,v&=8191,v+=K*C,v+=5*T*G,v+=5*Y*M,v+=5*k*I,v+=5*L*O,c+=v>>>13,v&=8191,b=c,b+=E*O,b+=x*N,b+=m*F,b+=B*P,b+=S*z,c=b>>>13,b&=8191,b+=K*R,b+=T*C,b+=5*Y*G,b+=5*k*M,b+=5*L*I,c+=b>>>13,b&=8191,d=c,d+=E*I,d+=x*O,d+=m*N,d+=B*F,d+=S*P,c=d>>>13,d&=8191,d+=K*z,d+=T*R,d+=Y*C,d+=5*k*G,d+=5*L*M,c+=d>>>13,d&=8191,A=c,A+=E*M,A+=x*I,A+=m*O,A+=B*N,A+=S*F,c=A>>>13,A&=8191,A+=K*P,A+=T*z,A+=Y*R,A+=k*C,A+=5*L*G,c+=A>>>13,A&=8191,_=c,_+=E*G,_+=x*M,_+=m*I,_+=B*O,_+=S*N,c=_>>>13,_&=8191,_+=K*F,_+=T*P,_+=Y*z,_+=k*R,_+=L*C,c+=_>>>13,_&=8191,c=(c<<2)+c|0,c=c+y|0,y=8191&c,c>>>=13,l+=c,E=y,x=l,m=w,B=p,S=g,K=v,T=b,Y=d,k=A,L=_,t+=16,n-=16;this.h[0]=E,this.h[1]=x,this.h[2]=m,this.h[3]=B,this.h[4]=S,this.h[5]=K,this.h[6]=T,this.h[7]=Y,this.h[8]=k,this.h[9]=L},ct.prototype.finish=function(r,t){var n,e,i,o,h=new Uint16Array(10);if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;16>o;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(n=this.h[1]>>>13,this.h[1]&=8191,o=2;10>o;o++)this.h[o]+=n,n=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=5*n,n=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=n,n=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=n,h[0]=this.h[0]+5,n=h[0]>>>13,h[0]&=8191,o=1;10>o;o++)h[o]=this.h[o]+n,n=h[o]>>>13,h[o]&=8191;for(h[9]-=8192,e=(h[9]>>>15)-1,o=0;10>o;o++)h[o]&=e;for(e=~e,o=0;10>o;o++)this.h[o]=this.h[o]&e|h[o];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),i=this.h[0]+this.pad[0],this.h[0]=65535&i,o=1;8>o;o++)i=(this.h[o]+this.pad[o]|0)+(i>>>16)|0,this.h[o]=65535&i;r[t+0]=this.h[0]>>>0&255,r[t+1]=this.h[0]>>>8&255,r[t+2]=this.h[1]>>>0&255,r[t+3]=this.h[1]>>>8&255,r[t+4]=this.h[2]>>>0&255,r[t+5]=this.h[2]>>>8&255,r[t+6]=this.h[3]>>>0&255,r[t+7]=this.h[3]>>>8&255,r[t+8]=this.h[4]>>>0&255,r[t+9]=this.h[4]>>>8&255,r[t+10]=this.h[5]>>>0&255,r[t+11]=this.h[5]>>>8&255,r[t+12]=this.h[6]>>>0&255,r[t+13]=this.h[6]>>>8&255,r[t+14]=this.h[7]>>>0&255,r[t+15]=this.h[7]>>>8&255},ct.prototype.update=function(r,t,n){var e,i;if(this.leftover){for(i=16-this.leftover,i>n&&(i=n),e=0;i>e;e++)this.buffer[this.leftover+e]=r[t+e];if(n-=i,t+=i,this.leftover+=i,this.leftover<16)return;this.blocks(buffer,0,16),this.leftover=0}if(n>=16&&(i=n-n%16,this.blocks(r,t,i),t+=i,n-=i),n){for(e=0;n>e;e++)this.buffer[this.leftover+e]=r[t+e];this.leftover+=n}};var yt=p,lt=g,wt=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],pt=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),gt=32,vt=24,bt=32,dt=16,At=32,_t=32,Ut=32,Et=32,xt=32,mt=vt,Bt=bt,St=dt,Kt=64,Tt=32,Yt=64,kt=32,Lt=64;r.lowlevel={crypto_core_hsalsa20:f,crypto_stream_xor:y,crypto_stream:c,crypto_stream_salsa20_xor:s,crypto_stream_salsa20:u,crypto_onetimeauth:l,crypto_onetimeauth_verify:w,crypto_verify_16:e,crypto_verify_32:i,crypto_secretbox:p,crypto_secretbox_open:g,crypto_scalarmult:Y,crypto_scalarmult_base:k,crypto_box_beforenm:C,crypto_box_afternm:yt,crypto_box:R,crypto_box_open:z,crypto_box_keypair:L,crypto_hash:F,crypto_sign:q,crypto_sign_keypair:Z,crypto_sign_open:D,crypto_secretbox_KEYBYTES:gt,crypto_secretbox_NONCEBYTES:vt,crypto_secretbox_ZEROBYTES:bt,crypto_secretbox_BOXZEROBYTES:dt,crypto_scalarmult_BYTES:At,crypto_scalarmult_SCALARBYTES:_t,crypto_box_PUBLICKEYBYTES:Ut,crypto_box_SECRETKEYBYTES:Et,crypto_box_BEFORENMBYTES:xt,crypto_box_NONCEBYTES:mt,crypto_box_ZEROBYTES:Bt,crypto_box_BOXZEROBYTES:St,crypto_sign_BYTES:Kt,crypto_sign_PUBLICKEYBYTES:Tt,crypto_sign_SECRETKEYBYTES:Yt,crypto_sign_SEEDBYTES:kt,crypto_hash_BYTES:Lt},r.util={},r.util.decodeUTF8=function(r){var t,n=unescape(encodeURIComponent(r)),e=new Uint8Array(n.length);for(t=0;tt;t++)n.push(String.fromCharCode(r[t]));return btoa(n.join(""))},r.util.decodeBase64=function(r){if("undefined"==typeof atob)return new Uint8Array(Array.prototype.slice.call(new Buffer(r,"base64"),0));var t,n=atob(r),e=new Uint8Array(n.length);for(t=0;te)return null;for(var i=new Uint8Array(e),o=0;oe;e++)i[e]=t[e];for(e=0;e=0},r.sign.keyPair=function(){var r=new Uint8Array(Tt),t=new Uint8Array(Yt);return Z(r,t),{publicKey:r,secretKey:t}},r.sign.keyPair.fromSecretKey=function(r){if(Q(r),r.length!==Yt)throw new Error("bad secret key size");for(var t=new Uint8Array(Tt),n=0;ne;e++)n[e]=r[e];return Z(t,n,!0),{publicKey:t,secretKey:n}},r.sign.publicKeyLength=Tt,r.sign.secretKeyLength=Yt,r.sign.seedLength=kt,r.sign.signatureLength=Kt,r.hash=function(r){Q(r);var t=new Uint8Array(Lt);return F(t,r,r.length),t},r.hash.hashLength=Lt,r.verify=function(r,t){return Q(r,t),0===r.length||0===t.length?!1:r.length!==t.length?!1:0===n(r,0,t,0,r.length)?!0:!1},r.setPRNG=function(r){$=r},function(){var t;"undefined"!=typeof window?(window.crypto&&window.crypto.getRandomValues?t=window.crypto:window.msCrypto&&window.msCrypto.getRandomValues&&(t=window.msCrypto),t&&r.setPRNG(function(r,n){var e,i=new Uint8Array(n);for(t.getRandomValues(i),e=0;n>e;e++)r[e]=i[e]})):"undefined"!=typeof require&&(t=require("crypto"),t&&r.setPRNG(function(r,n){var e,i=t.randomBytes(n);for(e=0;n>e;e++)r[e]=i[e]}))}()}("undefined"!=typeof module&&module.exports?module.exports:window.nacl=window.nacl||{}); \ No newline at end of file