forked from dchest/tweetnacl-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnacl.esm.min.js
1 lines (1 loc) · 18.9 KB
/
nacl.esm.min.js
1
function r(r){if(r.__esModule)return r;var n=r.default;if("function"==typeof n){var e=function r(){if(this instanceof r){var e=[null];return e.push.apply(e,arguments),new(Function.bind.apply(n,e))}return n.apply(this,arguments)};e.prototype=n.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach((function(n){var t=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(e,n,t.get?t:{enumerable:!0,get:function(){return r[n]}})})),e}function n(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var e,t={},o={get exports(){return t},set exports(r){t=r}},i=r(Object.freeze({__proto__:null,default:{}}));(function(r){var e=function(r,n){this.hi=0|r,this.lo=0|n},t=function(r){var n,e=new Float64Array(16);if(r)for(n=0;n<r.length;n++)e[n]=r[n];return e},o=function(){throw new Error("no PRNG")},a=new Uint8Array(16),f=new Uint8Array(32);f[0]=9;var u=t(),c=t([1]),w=t([56129,1]),y=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),l=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),s=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),h=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function p(r,n){return r<<n|r>>>32-n}function g(r,n){var e=255&r[n+3];return(e=(e=e<<8|255&r[n+2])<<8|255&r[n+1])<<8|255&r[n+0]}function b(r,n){var t=r[n]<<24|r[n+1]<<16|r[n+2]<<8|r[n+3],o=r[n+4]<<24|r[n+5]<<16|r[n+6]<<8|r[n+7];return new e(t,o)}function _(r,n,e){var t;for(t=0;t<4;t++)r[n+t]=255&e,e>>>=8}function A(r,n,e){r[n]=e.hi>>24&255,r[n+1]=e.hi>>16&255,r[n+2]=e.hi>>8&255,r[n+3]=255&e.hi,r[n+4]=e.lo>>24&255,r[n+5]=e.lo>>16&255,r[n+6]=e.lo>>8&255,r[n+7]=255&e.lo}function U(r,n,e,t,o){var i,a=0;for(i=0;i<o;i++)a|=r[n+i]^e[t+i];return(1&a-1>>>8)-1}function E(r,n,e,t){return U(r,n,e,t,16)}function d(r,n,e,t){return U(r,n,e,t,32)}function x(r,n,e,t,o){var i,a,f,u=new Uint32Array(16),c=new Uint32Array(16),w=new Uint32Array(16),y=new Uint32Array(4);for(i=0;i<4;i++)c[5*i]=g(t,4*i),c[1+i]=g(e,4*i),c[6+i]=g(n,4*i),c[11+i]=g(e,16+4*i);for(i=0;i<16;i++)w[i]=c[i];for(i=0;i<20;i++){for(a=0;a<4;a++){for(f=0;f<4;f++)y[f]=c[(5*a+4*f)%16];for(y[1]^=p(y[0]+y[3]|0,7),y[2]^=p(y[1]+y[0]|0,9),y[3]^=p(y[2]+y[1]|0,13),y[0]^=p(y[3]+y[2]|0,18),f=0;f<4;f++)u[4*a+(a+f)%4]=y[f]}for(f=0;f<16;f++)c[f]=u[f]}if(o){for(i=0;i<16;i++)c[i]=c[i]+w[i]|0;for(i=0;i<4;i++)c[5*i]=c[5*i]-g(t,4*i)|0,c[6+i]=c[6+i]-g(n,4*i)|0;for(i=0;i<4;i++)_(r,4*i,c[5*i]),_(r,16+4*i,c[6+i])}else for(i=0;i<16;i++)_(r,4*i,c[i]+w[i]|0)}function m(r,n,e,t){return x(r,n,e,t,!1),0}function B(r,n,e,t){return x(r,n,e,t,!0),0}var S=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function K(r,n,e,t,o,i,a){var f,u,c=new Uint8Array(16),w=new Uint8Array(64);if(!o)return 0;for(u=0;u<16;u++)c[u]=0;for(u=0;u<8;u++)c[u]=i[u];for(;o>=64;){for(m(w,c,a,S),u=0;u<64;u++)r[n+u]=(e?e[t+u]:0)^w[u];for(f=1,u=8;u<16;u++)f=f+(255&c[u])|0,c[u]=255&f,f>>>=8;o-=64,n+=64,e&&(t+=64)}if(o>0)for(m(w,c,a,S),u=0;u<o;u++)r[n+u]=(e?e[t+u]:0)^w[u];return 0}function Y(r,n,e,t,o){return K(r,n,null,0,e,t,o)}function L(r,n,e,t,o){var i=new Uint8Array(32);return B(i,t,o,S),Y(r,n,e,t.subarray(16),i)}function T(r,n,e,t,o,i,a){var f=new Uint8Array(32);return B(f,i,a,S),K(r,n,e,t,o,i.subarray(16),f)}function k(r,n){var e,t=0;for(e=0;e<17;e++)t=t+(r[e]+n[e]|0)|0,r[e]=255&t,t>>>=8}var R=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function z(r,n,e,t,o,i){var a,f,u,c,w=new Uint32Array(17),y=new Uint32Array(17),l=new Uint32Array(17),s=new Uint32Array(17),h=new Uint32Array(17);for(u=0;u<17;u++)y[u]=l[u]=0;for(u=0;u<16;u++)y[u]=i[u];for(y[3]&=15,y[4]&=252,y[7]&=15,y[8]&=252,y[11]&=15,y[12]&=252,y[15]&=15;o>0;){for(u=0;u<17;u++)s[u]=0;for(u=0;u<16&&u<o;++u)s[u]=e[t+u];for(s[u]=1,t+=u,o-=u,k(l,s),f=0;f<17;f++)for(w[f]=0,u=0;u<17;u++)w[f]=0|w[f]+l[u]*(u<=f?y[f-u]:320*y[f+17-u]|0);for(f=0;f<17;f++)l[f]=w[f];for(c=0,u=0;u<16;u++)c=c+l[u]|0,l[u]=255&c,c>>>=8;for(c=c+l[16]|0,l[16]=3&c,c=5*(c>>>2)|0,u=0;u<16;u++)c=c+l[u]|0,l[u]=255&c,c>>>=8;c=c+l[16]|0,l[16]=c}for(u=0;u<17;u++)h[u]=l[u];for(k(l,R),a=0|-(l[16]>>>7),u=0;u<17;u++)l[u]^=a&(h[u]^l[u]);for(u=0;u<16;u++)s[u]=i[u+16];for(s[16]=0,k(l,s),u=0;u<16;u++)r[n+u]=l[u];return 0}function O(r,n,e,t,o,i){var a=new Uint8Array(16);return z(a,0,e,t,o,i),E(r,n,a,0)}function P(r,n,e,t,o){var i;if(e<32)return-1;for(T(r,0,n,0,e,t,o),z(r,16,r,32,e-32,r),i=0;i<16;i++)r[i]=0;return 0}function M(r,n,e,t,o){var i,a=new Uint8Array(32);if(e<32)return-1;if(L(a,0,32,t,o),0!==O(n,16,n,32,e-32,a))return-1;for(T(r,0,n,0,e,t,o),i=0;i<32;i++)r[i]=0;return 0}function C(r,n){var e;for(e=0;e<16;e++)r[e]=0|n[e]}function N(r){var n,e;for(e=0;e<16;e++)r[e]+=65536,n=Math.floor(r[e]/65536),r[(e+1)*(e<15?1:0)]+=n-1+37*(n-1)*(15===e?1:0),r[e]-=65536*n}function F(r,n,e){for(var t,o=~(e-1),i=0;i<16;i++)t=o&(r[i]^n[i]),r[i]^=t,n[i]^=t}function j(r,n){var e,o,i,a=t(),f=t();for(e=0;e<16;e++)f[e]=n[e];for(N(f),N(f),N(f),o=0;o<2;o++){for(a[0]=f[0]-65517,e=1;e<15;e++)a[e]=f[e]-65535-(a[e-1]>>16&1),a[e-1]&=65535;a[15]=f[15]-32767-(a[14]>>16&1),i=a[15]>>16&1,a[14]&=65535,F(f,a,1-i)}for(e=0;e<16;e++)r[2*e]=255&f[e],r[2*e+1]=f[e]>>8}function Z(r,n){var e=new Uint8Array(32),t=new Uint8Array(32);return j(e,r),j(t,n),d(e,0,t,0)}function q(r){var n=new Uint8Array(32);return j(n,r),1&n[0]}function D(r,n){var e;for(e=0;e<16;e++)r[e]=n[2*e]+(n[2*e+1]<<8);r[15]&=32767}function G(r,n,e){var t;for(t=0;t<16;t++)r[t]=n[t]+e[t]|0}function I(r,n,e){var t;for(t=0;t<16;t++)r[t]=n[t]-e[t]|0}function V(r,n,e){var t,o,i=new Float64Array(31);for(t=0;t<31;t++)i[t]=0;for(t=0;t<16;t++)for(o=0;o<16;o++)i[t+o]+=n[t]*e[o];for(t=0;t<15;t++)i[t]+=38*i[t+16];for(t=0;t<16;t++)r[t]=i[t];N(r),N(r)}function X(r,n){V(r,n,n)}function H(r,n){var e,o=t();for(e=0;e<16;e++)o[e]=n[e];for(e=253;e>=0;e--)X(o,o),2!==e&&4!==e&&V(o,o,n);for(e=0;e<16;e++)r[e]=o[e]}function J(r,n){var e,o=t();for(e=0;e<16;e++)o[e]=n[e];for(e=250;e>=0;e--)X(o,o),1!==e&&V(o,o,n);for(e=0;e<16;e++)r[e]=o[e]}function Q(r,n,e){var o,i,a=new Uint8Array(32),f=new Float64Array(80),u=t(),c=t(),y=t(),l=t(),s=t(),h=t();for(i=0;i<31;i++)a[i]=n[i];for(a[31]=127&n[31]|64,a[0]&=248,D(f,e),i=0;i<16;i++)c[i]=f[i],l[i]=u[i]=y[i]=0;for(u[0]=l[0]=1,i=254;i>=0;--i)F(u,c,o=a[i>>>3]>>>(7&i)&1),F(y,l,o),G(s,u,y),I(u,u,y),G(y,c,l),I(c,c,l),X(l,s),X(h,u),V(u,y,u),V(y,c,s),G(s,u,y),I(u,u,y),X(c,u),I(y,l,h),V(u,y,w),G(u,u,l),V(y,y,u),V(u,l,h),V(l,c,f),X(c,s),F(u,c,o),F(y,l,o);for(i=0;i<16;i++)f[i+16]=u[i],f[i+32]=y[i],f[i+48]=c[i],f[i+64]=l[i];var v=f.subarray(32),p=f.subarray(16);return H(v,v),V(p,p,v),j(r,p),0}function W(r,n){return Q(r,n,f)}function $(r,n){return o(n,32),W(r,n)}function rr(r,n,e){var t=new Uint8Array(32);return Q(t,e,n),B(r,a,t,S)}var nr=P,er=M;function tr(){var r,n,t,o=0,i=0,a=0,f=0,u=65535;for(t=0;t<arguments.length;t++)o+=(r=arguments[t].lo)&u,i+=r>>>16,a+=(n=arguments[t].hi)&u,f+=n>>>16;return new e((a+=(i+=o>>>16)>>>16)&u|(f+=a>>>16)<<16,o&u|i<<16)}function or(r,n){return new e(r.hi>>>n,r.lo>>>n|r.hi<<32-n)}function ir(){var r,n=0,t=0;for(r=0;r<arguments.length;r++)n^=arguments[r].lo,t^=arguments[r].hi;return new e(t,n)}function ar(r,n){var t,o,i=32-n;return n<32?(t=r.hi>>>n|r.lo<<i,o=r.lo>>>n|r.hi<<i):n<64&&(t=r.lo>>>n|r.hi<<i,o=r.hi>>>n|r.lo<<i),new e(t,o)}function fr(r,n,t){var o=r.hi&n.hi^~r.hi&t.hi,i=r.lo&n.lo^~r.lo&t.lo;return new e(o,i)}function ur(r,n,t){var o=r.hi&n.hi^r.hi&t.hi^n.hi&t.hi,i=r.lo&n.lo^r.lo&t.lo^n.lo&t.lo;return new e(o,i)}function cr(r){return ir(ar(r,28),ar(r,34),ar(r,39))}function wr(r){return ir(ar(r,14),ar(r,18),ar(r,41))}function yr(r){return ir(ar(r,1),ar(r,8),or(r,7))}function lr(r){return ir(ar(r,19),ar(r,61),or(r,6))}var sr=[new e(1116352408,3609767458),new e(1899447441,602891725),new e(3049323471,3964484399),new e(3921009573,2173295548),new e(961987163,4081628472),new e(1508970993,3053834265),new e(2453635748,2937671579),new e(2870763221,3664609560),new e(3624381080,2734883394),new e(310598401,1164996542),new e(607225278,1323610764),new e(1426881987,3590304994),new e(1925078388,4068182383),new e(2162078206,991336113),new e(2614888103,633803317),new e(3248222580,3479774868),new e(3835390401,2666613458),new e(4022224774,944711139),new e(264347078,2341262773),new e(604807628,2007800933),new e(770255983,1495990901),new e(1249150122,1856431235),new e(1555081692,3175218132),new e(1996064986,2198950837),new e(2554220882,3999719339),new e(2821834349,766784016),new e(2952996808,2566594879),new e(3210313671,3203337956),new e(3336571891,1034457026),new e(3584528711,2466948901),new e(113926993,3758326383),new e(338241895,168717936),new e(666307205,1188179964),new e(773529912,1546045734),new e(1294757372,1522805485),new e(1396182291,2643833823),new e(1695183700,2343527390),new e(1986661051,1014477480),new e(2177026350,1206759142),new e(2456956037,344077627),new e(2730485921,1290863460),new e(2820302411,3158454273),new e(3259730800,3505952657),new e(3345764771,106217008),new e(3516065817,3606008344),new e(3600352804,1432725776),new e(4094571909,1467031594),new e(275423344,851169720),new e(430227734,3100823752),new e(506948616,1363258195),new e(659060556,3750685593),new e(883997877,3785050280),new e(958139571,3318307427),new e(1322822218,3812723403),new e(1537002063,2003034995),new e(1747873779,3602036899),new e(1955562222,1575990012),new e(2024104815,1125592928),new e(2227730452,2716904306),new e(2361852424,442776044),new e(2428436474,593698344),new e(2756734187,3733110249),new e(3204031479,2999351573),new e(3329325298,3815920427),new e(3391569614,3928383900),new e(3515267271,566280711),new e(3940187606,3454069534),new e(4118630271,4000239992),new e(116418474,1914138554),new e(174292421,2731055270),new e(289380356,3203993006),new e(460393269,320620315),new e(685471733,587496836),new e(852142971,1086792851),new e(1017036298,365543100),new e(1126000580,2618297676),new e(1288033470,3409855158),new e(1501505948,4234509866),new e(1607167915,987167468),new e(1816402316,1246189591)];function hr(r,n,e){var t,o,i,a=[],f=[],u=[],c=[];for(o=0;o<8;o++)a[o]=u[o]=b(r,8*o);for(var w=0;e>=128;){for(o=0;o<16;o++)c[o]=b(n,8*o+w);for(o=0;o<80;o++){for(i=0;i<8;i++)f[i]=u[i];for(t=tr(u[7],wr(u[4]),fr(u[4],u[5],u[6]),sr[o],c[o%16]),f[7]=tr(t,cr(u[0]),ur(u[0],u[1],u[2])),f[3]=tr(f[3],t),i=0;i<8;i++)u[(i+1)%8]=f[i];if(o%16==15)for(i=0;i<16;i++)c[i]=tr(c[i],c[(i+9)%16],yr(c[(i+1)%16]),lr(c[(i+14)%16]))}for(o=0;o<8;o++)u[o]=tr(u[o],a[o]),a[o]=u[o];w+=128,e-=128}for(o=0;o<8;o++)A(r,8*o,a[o]);return e}var vr=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function pr(r,n,t){var o,i=new Uint8Array(64),a=new Uint8Array(256),f=t;for(o=0;o<64;o++)i[o]=vr[o];for(hr(i,n,t),t%=128,o=0;o<256;o++)a[o]=0;for(o=0;o<t;o++)a[o]=n[f-t+o];for(a[t]=128,a[(t=256-128*(t<112?1:0))-9]=0,A(a,t-8,new e(f/536870912|0,f<<3)),hr(i,a,t),o=0;o<64;o++)r[o]=i[o];return 0}function gr(r,n){var e=t(),o=t(),i=t(),a=t(),f=t(),u=t(),c=t(),w=t(),y=t();I(e,r[1],r[0]),I(y,n[1],n[0]),V(e,e,y),G(o,r[0],r[1]),G(y,n[0],n[1]),V(o,o,y),V(i,r[3],n[3]),V(i,i,l),V(a,r[2],n[2]),G(a,a,a),I(f,o,e),I(u,a,i),G(c,a,i),G(w,o,e),V(r[0],f,u),V(r[1],w,c),V(r[2],c,u),V(r[3],f,w)}function br(r,n,e){var t;for(t=0;t<4;t++)F(r[t],n[t],e)}function _r(r,n){var e=t(),o=t(),i=t();H(i,n[2]),V(e,n[0],i),V(o,n[1],i),j(r,o),r[31]^=q(e)<<7}function Ar(r,n,e){var t,o;for(C(r[0],u),C(r[1],c),C(r[2],c),C(r[3],u),o=255;o>=0;--o)br(r,n,t=e[o/8|0]>>(7&o)&1),gr(n,r),gr(r,r),br(r,n,t)}function Ur(r,n){var e=[t(),t(),t(),t()];C(e[0],s),C(e[1],h),C(e[2],c),V(e[3],s,h),Ar(r,e,n)}function Er(r,n,e){var i,a=new Uint8Array(64),f=[t(),t(),t(),t()];for(e||o(n,32),pr(a,n,32),a[0]&=248,a[31]&=127,a[31]|=64,Ur(f,a),_r(r,f),i=0;i<32;i++)n[i+32]=r[i];return 0}var dr=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]);function xr(r,n){var e,t,o,i;for(t=63;t>=32;--t){for(e=0,o=t-32,i=t-12;o<i;++o)n[o]+=e-16*n[t]*dr[o-(t-32)],e=Math.floor((n[o]+128)/256),n[o]-=256*e;n[o]+=e,n[t]=0}for(e=0,o=0;o<32;o++)n[o]+=e-(n[31]>>4)*dr[o],e=n[o]>>8,n[o]&=255;for(o=0;o<32;o++)n[o]-=e*dr[o];for(t=0;t<32;t++)n[t+1]+=n[t]>>8,r[t]=255&n[t]}function mr(r){var n,e=new Float64Array(64);for(n=0;n<64;n++)e[n]=r[n];for(n=0;n<64;n++)r[n]=0;xr(r,e)}function Br(r,n,e,o){var i,a,f=new Uint8Array(64),u=new Uint8Array(64),c=new Uint8Array(64),w=new Float64Array(64),y=[t(),t(),t(),t()];pr(f,o,32),f[0]&=248,f[31]&=127,f[31]|=64;var l=e+64;for(i=0;i<e;i++)r[64+i]=n[i];for(i=0;i<32;i++)r[32+i]=f[32+i];for(pr(c,r.subarray(32),e+32),mr(c),Ur(y,c),_r(r,y),i=32;i<64;i++)r[i]=o[i];for(pr(u,r,e+64),mr(u),i=0;i<64;i++)w[i]=0;for(i=0;i<32;i++)w[i]=c[i];for(i=0;i<32;i++)for(a=0;a<32;a++)w[i+a]+=u[i]*f[a];return xr(r.subarray(32),w),l}function Sr(r,n,e,o){var i,a=new Uint8Array(32),f=new Uint8Array(64),w=[t(),t(),t(),t()],l=[t(),t(),t(),t()];if(e<64)return-1;if(function(r,n){var e=t(),o=t(),i=t(),a=t(),f=t(),w=t(),l=t();return C(r[2],c),D(r[1],n),X(i,r[1]),V(a,i,y),I(i,i,r[2]),G(a,r[2],a),X(f,a),X(w,f),V(l,w,f),V(e,l,i),V(e,e,a),J(e,e),V(e,e,i),V(e,e,a),V(e,e,a),V(r[0],e,a),X(o,r[0]),V(o,o,a),Z(o,i)&&V(r[0],r[0],v),X(o,r[0]),V(o,o,a),Z(o,i)?-1:(q(r[0])===n[31]>>7&&I(r[0],u,r[0]),V(r[3],r[0],r[1]),0)}(l,o))return-1;for(i=0;i<e;i++)r[i]=n[i];for(i=0;i<32;i++)r[i+32]=o[i];if(pr(f,r,e),mr(f),Ar(w,l,f),Ur(l,n.subarray(32)),gr(w,l),_r(a,w),e-=64,d(n,0,a,0)){for(i=0;i<e;i++)r[i]=0;return-1}for(i=0;i<e;i++)r[i]=n[i+64];return e}var Kr,Yr=32,Lr=24,Tr=16,kr=32,Rr=32,zr=Lr,Or=64,Pr=32,Mr=64;function Cr(r,n){if(r.length!==Yr)throw new Error("bad key size");if(n.length!==Lr)throw new Error("bad nonce size")}function Nr(){for(var r=0;r<arguments.length;r++)if(!(arguments[r]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Fr(r){for(var n=0;n<r.length;n++)r[n]=0}r.lowlevel={crypto_core_hsalsa20:B,crypto_stream_xor:T,crypto_stream:L,crypto_stream_salsa20_xor:K,crypto_stream_salsa20:Y,crypto_onetimeauth:z,crypto_onetimeauth_verify:O,crypto_verify_16:E,crypto_verify_32:d,crypto_secretbox:P,crypto_secretbox_open:M,crypto_scalarmult:Q,crypto_scalarmult_base:W,crypto_box_beforenm:rr,crypto_box_afternm:nr,crypto_box:function(r,n,e,t,o,i){var a=new Uint8Array(32);return rr(a,o,i),nr(r,n,e,t,a)},crypto_box_open:function(r,n,e,t,o,i){var a=new Uint8Array(32);return rr(a,o,i),er(r,n,e,t,a)},crypto_box_keypair:$,crypto_hash:pr,crypto_sign:Br,crypto_sign_keypair:Er,crypto_sign_open:Sr,crypto_secretbox_KEYBYTES:Yr,crypto_secretbox_NONCEBYTES:Lr,crypto_secretbox_ZEROBYTES:32,crypto_secretbox_BOXZEROBYTES:Tr,crypto_scalarmult_BYTES:32,crypto_scalarmult_SCALARBYTES:32,crypto_box_PUBLICKEYBYTES:kr,crypto_box_SECRETKEYBYTES:Rr,crypto_box_BEFORENMBYTES:32,crypto_box_NONCEBYTES:zr,crypto_box_ZEROBYTES:32,crypto_box_BOXZEROBYTES:16,crypto_sign_BYTES:Or,crypto_sign_PUBLICKEYBYTES:Pr,crypto_sign_SECRETKEYBYTES:Mr,crypto_sign_SEEDBYTES:32,crypto_hash_BYTES:64,gf:t,D:y,L:dr,pack25519:j,unpack25519:D,M:V,A:G,S:X,Z:I,pow2523:J,add:gr,set25519:C,modL:xr,scalarmult:Ar,scalarbase:Ur},r.randomBytes=function(r){var n=new Uint8Array(r);return o(n,r),n},r.secretbox=function(r,n,e){Nr(r,n,e),Cr(e,n);for(var t=new Uint8Array(32+r.length),o=new Uint8Array(t.length),i=0;i<r.length;i++)t[i+32]=r[i];return P(o,t,t.length,n,e),o.subarray(Tr)},r.secretbox.open=function(r,n,e){Nr(r,n,e),Cr(e,n);for(var t=new Uint8Array(Tr+r.length),o=new Uint8Array(t.length),i=0;i<r.length;i++)t[i+Tr]=r[i];return t.length<32||0!==M(o,t,t.length,n,e)?null:o.subarray(32)},r.secretbox.keyLength=Yr,r.secretbox.nonceLength=Lr,r.secretbox.overheadLength=Tr,r.scalarMult=function(r,n){if(Nr(r,n),32!==r.length)throw new Error("bad n size");if(32!==n.length)throw new Error("bad p size");var e=new Uint8Array(32);return Q(e,r,n),e},r.scalarMult.base=function(r){if(Nr(r),32!==r.length)throw new Error("bad n size");var n=new Uint8Array(32);return W(n,r),n},r.scalarMult.scalarLength=32,r.scalarMult.groupElementLength=32,r.box=function(n,e,t,o){var i=r.box.before(t,o);return r.secretbox(n,e,i)},r.box.before=function(r,n){Nr(r,n),function(r,n){if(r.length!==kr)throw new Error("bad public key size");if(n.length!==Rr)throw new Error("bad secret key size")}(r,n);var e=new Uint8Array(32);return rr(e,r,n),e},r.box.after=r.secretbox,r.box.open=function(n,e,t,o){var i=r.box.before(t,o);return r.secretbox.open(n,e,i)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var r=new Uint8Array(kr),n=new Uint8Array(Rr);return $(r,n),{publicKey:r,secretKey:n}},r.box.keyPair.fromSecretKey=function(r){if(Nr(r),r.length!==Rr)throw new Error("bad secret key size");var n=new Uint8Array(kr);return W(n,r),{publicKey:n,secretKey:new Uint8Array(r)}},r.box.publicKeyLength=kr,r.box.secretKeyLength=Rr,r.box.sharedKeyLength=32,r.box.nonceLength=zr,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(r,n){if(Nr(r,n),n.length!==Mr)throw new Error("bad secret key size");var e=new Uint8Array(Or+r.length);return Br(e,r,r.length,n),e},r.sign.open=function(r,n){if(Nr(r,n),n.length!==Pr)throw new Error("bad public key size");var e=new Uint8Array(r.length),t=Sr(e,r,r.length,n);if(t<0)return null;for(var o=new Uint8Array(t),i=0;i<o.length;i++)o[i]=e[i];return o},r.sign.detached=function(n,e){for(var t=r.sign(n,e),o=new Uint8Array(Or),i=0;i<o.length;i++)o[i]=t[i];return o},r.sign.detached.verify=function(r,n,e){if(Nr(r,n,e),n.length!==Or)throw new Error("bad signature size");if(e.length!==Pr)throw new Error("bad public key size");var t,o=new Uint8Array(Or+r.length),i=new Uint8Array(Or+r.length);for(t=0;t<Or;t++)o[t]=n[t];for(t=0;t<r.length;t++)o[t+Or]=r[t];return Sr(i,o,o.length,e)>=0},r.sign.keyPair=function(){var r=new Uint8Array(Pr),n=new Uint8Array(Mr);return Er(r,n),{publicKey:r,secretKey:n}},r.sign.keyPair.fromSecretKey=function(r){if(Nr(r),r.length!==Mr)throw new Error("bad secret key size");for(var n=new Uint8Array(Pr),e=0;e<n.length;e++)n[e]=r[32+e];return{publicKey:n,secretKey:new Uint8Array(r)}},r.sign.keyPair.fromSeed=function(r){if(Nr(r),32!==r.length)throw new Error("bad seed size");for(var n=new Uint8Array(Pr),e=new Uint8Array(Mr),t=0;t<32;t++)e[t]=r[t];return Er(n,e,!0),{publicKey:n,secretKey:e}},r.sign.publicKeyLength=Pr,r.sign.secretKeyLength=Mr,r.sign.seedLength=32,r.sign.signatureLength=Or,r.hash=function(r){Nr(r);var n=new Uint8Array(64);return pr(n,r,r.length),n},r.hash.hashLength=64,r.verify=function(r,n){return Nr(r,n),0!==r.length&&0!==n.length&&r.length===n.length&&0===U(r,0,n,0,r.length)},r.setPRNG=function(r){o=r},(Kr="undefined"!=typeof self?self.crypto||self.msCrypto:null)&&Kr.getRandomValues?r.setPRNG((function(r,n){var e,t=new Uint8Array(n);for(e=0;e<n;e+=65536)Kr.getRandomValues(t.subarray(e,e+Math.min(n-e,65536)));for(e=0;e<n;e++)r[e]=t[e];Fr(t)})):void 0!==n&&(Kr=i)&&Kr.randomBytes&&r.setPRNG((function(r,n){var e,t=Kr.randomBytes(n);for(e=0;e<n;e++)r[e]=t[e];Fr(t)}))})((e=o).exports?e.exports:self.nacl=self.nacl||{});var a=t;export{a as default};