@protontech/openpgp 6.0.0-alpha.0 → 6.0.0-alpha.1.patch.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +6 -6
  2. package/dist/lightweight/argon2id.min.mjs +1 -1
  3. package/dist/lightweight/argon2id.min.mjs.map +1 -1
  4. package/dist/lightweight/argon2id.mjs +1 -1
  5. package/dist/lightweight/bn.interface.min.mjs +2 -2
  6. package/dist/lightweight/bn.interface.min.mjs.map +1 -1
  7. package/dist/lightweight/bn.interface.mjs +3460 -2
  8. package/dist/lightweight/interface.min.mjs +1 -1
  9. package/dist/lightweight/interface.min.mjs.map +1 -1
  10. package/dist/lightweight/interface.mjs +1 -1
  11. package/dist/lightweight/legacy_ciphers.min.mjs +3 -0
  12. package/dist/lightweight/legacy_ciphers.min.mjs.map +1 -0
  13. package/dist/lightweight/legacy_ciphers.mjs +1829 -0
  14. package/dist/lightweight/native.interface.min.mjs +1 -1
  15. package/dist/lightweight/native.interface.min.mjs.map +1 -1
  16. package/dist/lightweight/native.interface.mjs +1 -1
  17. package/dist/lightweight/noble_curves.min.mjs +11 -11
  18. package/dist/lightweight/noble_curves.min.mjs.map +1 -1
  19. package/dist/lightweight/noble_curves.mjs +84 -55
  20. package/dist/lightweight/noble_hashes.min.mjs +2 -2
  21. package/dist/lightweight/noble_hashes.min.mjs.map +1 -1
  22. package/dist/lightweight/noble_hashes.mjs +1 -2
  23. package/dist/lightweight/openpgp.min.mjs +2 -2
  24. package/dist/lightweight/openpgp.min.mjs.map +1 -1
  25. package/dist/lightweight/openpgp.mjs +1373 -3341
  26. package/dist/lightweight/sha3.min.mjs +3 -3
  27. package/dist/lightweight/sha3.min.mjs.map +1 -1
  28. package/dist/lightweight/sha3.mjs +51 -37
  29. package/dist/node/openpgp.cjs +7887 -8057
  30. package/dist/node/openpgp.min.cjs +11 -11
  31. package/dist/node/openpgp.min.cjs.map +1 -1
  32. package/dist/node/openpgp.min.mjs +11 -11
  33. package/dist/node/openpgp.min.mjs.map +1 -1
  34. package/dist/node/openpgp.mjs +7886 -8058
  35. package/dist/openpgp.js +7940 -8020
  36. package/dist/openpgp.min.js +11 -11
  37. package/dist/openpgp.min.js.map +1 -1
  38. package/dist/openpgp.min.mjs +11 -11
  39. package/dist/openpgp.min.mjs.map +1 -1
  40. package/dist/openpgp.mjs +7939 -8021
  41. package/openpgp.d.ts +58 -43
  42. package/package.json +32 -34
  43. package/dist/lightweight/bn.min.mjs +0 -3
  44. package/dist/lightweight/bn.min.mjs.map +0 -1
  45. package/dist/lightweight/bn.mjs +0 -3449
package/README.md CHANGED
@@ -59,9 +59,9 @@ library to convert back and forth between them.
59
59
  |:---------------:|:----------:|:---------:|:----------:|:---------:|:-----------------:|
60
60
  | curve25519 | ECDH | N/A | No | No | Algorithmically** |
61
61
  | ed25519 | N/A | EdDSA | No | No | Algorithmically** |
62
- | p256 | ECDH | ECDSA | Yes* | Yes* | If native*** |
63
- | p384 | ECDH | ECDSA | Yes* | Yes* | If native*** |
64
- | p521 | ECDH | ECDSA | Yes* | Yes* | If native*** |
62
+ | nistP256 | ECDH | ECDSA | Yes* | Yes* | If native*** |
63
+ | nistP384 | ECDH | ECDSA | Yes* | Yes* | If native*** |
64
+ | nistP521 | ECDH | ECDSA | Yes* | Yes* | If native*** |
65
65
  | brainpoolP256r1 | ECDH | ECDSA | Yes* | No | If native*** |
66
66
  | brainpoolP384r1 | ECDH | ECDSA | Yes* | No | If native*** |
67
67
  | brainpoolP512r1 | ECDH | ECDSA | Yes* | No | If native*** |
@@ -74,7 +74,7 @@ library to convert back and forth between them.
74
74
  * If the user's browser supports [native WebCrypto](https://caniuse.com/#feat=cryptography) via the `window.crypto.subtle` API, this will be used. Under Node.js the native [crypto module](https://nodejs.org/api/crypto.html#crypto_crypto) is used.
75
75
 
76
76
  * The library implements authenticated encryption (AEAD) as per the ["crypto refresh" draft standard](https://datatracker.ietf.org/doc/draft-ietf-openpgp-crypto-refresh) using AES-OCB, EAX, or GCM. This makes symmetric encryption faster on platforms with native implementations. However, since the specification is very recent and other OpenPGP implementations are in the process of adopting it, the feature is currently behind a flag. **Note: activating this setting can break compatibility with other OpenPGP implementations which have yet to implement the feature.** You can enable it by setting `openpgp.config.aeadProtect = true`.
77
- Note that this setting has a different effect from the one in OpenPGP.js v5, which implemented support for a provisional version of AEAD from [RFC4880bis](https://tools.ietf.org/html/draft-ietf-openpgp-rfc4880bis-10), which was modified in a later draft of the crypto refresh.
77
+ Note that this setting has a different effect from the one in OpenPGP.js v6, which implemented support for a provisional version of AEAD from [RFC4880bis](https://tools.ietf.org/html/draft-ietf-openpgp-rfc4880bis-10), which was modified in a later draft of the crypto refresh.
78
78
 
79
79
  You can change the AEAD mode by setting one of the following options:
80
80
 
@@ -182,7 +182,7 @@ If you notice missing or incorrect type definitions, feel free to open a PR.
182
182
 
183
183
  ### Examples
184
184
 
185
- Here are some examples of how to use OpenPGP.js v5. For more elaborate examples and working code, please check out the [public API unit tests](https://github.com/openpgpjs/openpgpjs/blob/main/test/general/openpgp.js). If you're upgrading from v4 it might help to check out the [changelog](https://github.com/openpgpjs/openpgpjs/wiki/V5-Changelog) and [documentation](https://github.com/openpgpjs/openpgpjs#documentation).
185
+ Here are some examples of how to use OpenPGP.js v6. For more elaborate examples and working code, please check out the [public API unit tests](https://github.com/openpgpjs/openpgpjs/blob/main/test/general/openpgp.js). If you're upgrading from v4 it might help to check out the [changelog](https://github.com/openpgpjs/openpgpjs/wiki/v6-Changelog) and [documentation](https://github.com/openpgpjs/openpgpjs#documentation).
186
186
 
187
187
  #### Encrypt and decrypt *Uint8Array* data with a password
188
188
 
@@ -451,7 +451,7 @@ can `.pipe()` to a `Writable` stream, for example.
451
451
 
452
452
  ECC keys (smaller and faster to generate):
453
453
 
454
- Possible values for `curve` are: `curve25519`, `ed25519`, `p256`, `p384`, `p521`,
454
+ Possible values for `curve` are: `curve25519`, `ed25519`, `nistP256`, `nistP384`, `nistP521`,
455
455
  `brainpoolP256r1`, `brainpoolP384r1`, `brainpoolP512r1`, and `secp256k1`.
456
456
  Note that both the `curve25519` and `ed25519` options generate a primary key for signing using Ed25519
457
457
  and a subkey for encryption using Curve25519.
@@ -1,3 +1,3 @@
1
- /*! OpenPGP.js v6.0.0-alpha.0 - 2023-12-12 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
1
+ /*! OpenPGP.js v6.0.0-alpha.1.patch.0 - 2024-03-01 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
2
2
  const A="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function I(A,I,g,B){A[I]+=g[B],A[I+1]+=g[B+1]+(A[I]<g[B])}function g(A,I){A[0]+=I,A[1]+=A[0]<I}function B(A,g,B,C,Q,E,t,i){I(A,B,A,C),I(A,B,g,t);let e=A[E]^A[B],w=A[E+1]^A[B+1];A[E]=w,A[E+1]=e,I(A,Q,A,E),e=A[C]^A[Q],w=A[C+1]^A[Q+1],A[C]=e>>>24^w<<8,A[C+1]=w>>>24^e<<8,I(A,B,A,C),I(A,B,g,i),e=A[E]^A[B],w=A[E+1]^A[B+1],A[E]=e>>>16^w<<16,A[E+1]=w>>>16^e<<16,I(A,Q,A,E),e=A[C]^A[Q],w=A[C+1]^A[Q+1],A[C]=w>>>31^e<<1,A[C+1]=e>>>31^w<<1}const C=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Q=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map((A=>2*A)));function E(A,I){const g=new Uint32Array(32),E=new Uint32Array(A.b.buffer,A.b.byteOffset,32);for(let I=0;I<16;I++)g[I]=A.h[I],g[I+16]=C[I];g[24]^=A.t0[0],g[25]^=A.t0[1];const t=I?4294967295:0;g[28]^=t,g[29]^=t;for(let A=0;A<12;A++){const I=A<<4;B(g,E,0,8,16,24,Q[I+0],Q[I+1]),B(g,E,2,10,18,26,Q[I+2],Q[I+3]),B(g,E,4,12,20,28,Q[I+4],Q[I+5]),B(g,E,6,14,22,30,Q[I+6],Q[I+7]),B(g,E,0,10,20,30,Q[I+8],Q[I+9]),B(g,E,2,12,22,24,Q[I+10],Q[I+11]),B(g,E,4,14,16,26,Q[I+12],Q[I+13]),B(g,E,6,8,18,28,Q[I+14],Q[I+15])}for(let I=0;I<16;I++)A.h[I]^=g[I]^g[I+16]}class t{constructor(A,I,g,B){const Q=new Uint8Array(64);this.S={b:new Uint8Array(s),h:new Uint32Array(e/4),t0:new Uint32Array(2),c:0,outlen:A},Q[0]=A,I&&(Q[1]=I.length),Q[2]=1,Q[3]=1,g&&Q.set(g,32),B&&Q.set(B,48);const E=new Uint32Array(Q.buffer,Q.byteOffset,Q.length/Uint32Array.BYTES_PER_ELEMENT);for(let A=0;A<16;A++)this.S.h[A]=C[A]^E[A];if(I){const A=new Uint8Array(s);A.set(I),this.update(A)}}update(A){if(!(A instanceof Uint8Array))throw Error("Input must be Uint8Array or Buffer");let I=0;for(;I<A.length;){this.S.c===s&&(g(this.S.t0,this.S.c),E(this.S,!1),this.S.c=0);let B=s-this.S.c;this.S.b.set(A.subarray(I,I+B),this.S.c);const C=Math.min(B,A.length-I);this.S.c+=C,I+=C}return this}digest(A){g(this.S.t0,this.S.c),this.S.b.fill(0,this.S.c),this.S.c=s,E(this.S,!0);const I=A||new Uint8Array(this.S.outlen);for(let A=0;A<this.S.outlen;A++)I[A]=this.S.h[A>>2]>>8*(3&A);return this.S.h=null,I.buffer}}function i(A,I,g,B){if(A>e)throw Error(`outlen must be at most ${e} (given: ${A})`);if(I){if(!(I instanceof Uint8Array))throw Error("key must be Uint8Array or Buffer");if(I.length>w)throw Error(`key size must be at most ${w} (given: ${I.length})`)}if(g){if(!(g instanceof Uint8Array))throw Error("salt must be Uint8Array or Buffer");if(g.length!==n)throw Error(`salt must be exactly ${n} (given: ${g.length}`)}if(B){if(!(B instanceof Uint8Array))throw Error("personal must be Uint8Array or Buffer");if(B.length!==r)throw Error(`salt must be exactly ${r} (given: ${B.length}`)}return new t(A,I,g,B)}const e=64,w=64,n=16,r=16,s=128,f=2,D=19,o=4294967295,c=4,a=4294967295,y=8,h=4294967295,S=8,M=4294967295,U=4294967295,R=32,l=1024,N=64,k=205===new Uint8Array(new Uint16Array([43981]).buffer)[0];function H(A,I,g){return A[g+0]=I,A[g+1]=I>>8,A[g+2]=I>>16,A[g+3]=I>>24,A}function G(A,I,g){if(I>Number.MAX_SAFE_INTEGER)throw Error("LE64: large numbers unsupported");let B=I;for(let I=g;I<g+7;I++)A[I]=B,B=(B-A[I])/256;return A}function u(A,I,g){const B=new Uint8Array(64),C=new Uint8Array(4+I.length);if(H(C,A,0),C.set(I,4),A<=64)return i(A).update(C).digest(g),g;const Q=Math.ceil(A/32)-2;for(let A=0;A<Q;A++)i(64).update(0===A?C:B).digest(B),g.set(B.subarray(0,32),32*A);const E=new Uint8Array(i(A-32*Q).update(B).digest());return g.set(E,32*Q),g}function F(A,I,g,B){return A.fn.XOR(I.byteOffset,g.byteOffset,B.byteOffset),I}function L(A,I,g,B){return A.fn.G(I.byteOffset,g.byteOffset,B.byteOffset,A.refs.gZ.byteOffset),B}function J(A,I,g,B){return A.fn.G2(I.byteOffset,g.byteOffset,B.byteOffset,A.refs.gZ.byteOffset),B}function*K(A,I,g,B,C,Q,E,t){A.refs.prngTmp.fill(0);const i=A.refs.prngTmp.subarray(0,48);G(i,I,0),G(i,g,8),G(i,B,16),G(i,C,24),G(i,Q,32),G(i,f,40);for(let I=1;I<=E;I++){G(A.refs.prngTmp,I,i.length);const g=J(A,A.refs.ZERO1024,A.refs.prngTmp,A.refs.prngR);for(let A=1===I?8*t:0;A<g.length;A+=8)yield g.subarray(A,A+8)}return[]}const p=1024,b=64*p;function d(A,{memory:I,instance:g}){if(!k)throw Error("BigEndian system not supported");const B=function({type:A,version:I,tagLength:g,password:B,salt:C,ad:Q,secret:E,parallelism:t,memorySize:i,passes:e}){const w=(A,I,g,B)=>{if(I<g||I>B)throw Error(`${A} size should be between ${g} and ${B} bytes`)};if(A!==f||I!==D)throw Error("Unsupported type or version");return w("password",B,S,h),w("salt",C,y,a),w("tag",g,c,o),w("memory",i,8*t,M),Q&&w("associated data",Q,0,U),E&&w("secret",E,0,R),{type:A,version:I,tagLength:g,password:B,salt:C,ad:Q,secret:E,lanes:t,memorySize:i,passes:e}}({type:f,version:D,...A}),{G:C,G2:Q,xor:E,getLZ:t}=g.exports,e={},w={};w.G=C,w.G2=Q,w.XOR=E;const n=4*B.lanes*Math.floor(B.memorySize/(4*B.lanes)),r=n*l+10*p;if(I.buffer.byteLength<r){const A=Math.ceil((r-I.buffer.byteLength)/b);I.grow(A)}let s=0;e.gZ=new Uint8Array(I.buffer,s,l),s+=e.gZ.length,e.prngR=new Uint8Array(I.buffer,s,l),s+=e.prngR.length,e.prngTmp=new Uint8Array(I.buffer,s,l),s+=e.prngTmp.length,e.ZERO1024=new Uint8Array(I.buffer,s,1024),s+=e.ZERO1024.length;const G=new Uint32Array(I.buffer,s,2);s+=G.length*Uint32Array.BYTES_PER_ELEMENT;const J={fn:w,refs:e},d=new Uint8Array(I.buffer,s,l);s+=d.length;const v=new Uint8Array(I.buffer,s,B.memorySize*l),Y=new Uint8Array(I.buffer,0,s),m=function(A){const I=i(N),g=new Uint8Array(4),B=new Uint8Array(24);H(B,A.lanes,0),H(B,A.tagLength,4),H(B,A.memorySize,8),H(B,A.passes,12),H(B,A.version,16),H(B,A.type,20);const C=[B];A.password?(C.push(H(new Uint8Array(4),A.password.length,0)),C.push(A.password)):C.push(g);A.salt?(C.push(H(new Uint8Array(4),A.salt.length,0)),C.push(A.salt)):C.push(g);A.secret?(C.push(H(new Uint8Array(4),A.secret.length,0)),C.push(A.secret)):C.push(g);A.ad?(C.push(H(new Uint8Array(4),A.ad.length,0)),C.push(A.ad)):C.push(g);I.update(function(A){if(1===A.length)return A[0];let I=0;for(let g=0;g<A.length;g++){if(!(A[g]instanceof Uint8Array))throw Error("concatArrays: Data must be in the form of a Uint8Array");I+=A[g].length}const g=new Uint8Array(I);let B=0;return A.forEach((A=>{g.set(A,B),B+=A.length})),g}(C));const Q=I.digest();return new Uint8Array(Q)}(B),T=n/B.lanes,P=Array(B.lanes).fill(null).map((()=>Array(T))),x=(A,I)=>(P[A][I]=v.subarray(A*T*1024+1024*I,A*T*1024+1024*I+l),P[A][I]);for(let A=0;A<B.lanes;A++){const I=new Uint8Array(m.length+8);I.set(m),H(I,0,m.length),H(I,A,m.length+4),u(l,I,x(A,0)),H(I,1,m.length),u(l,I,x(A,1))}const O=T/4;for(let A=0;A<B.passes;A++)for(let I=0;I<4;I++){const g=0===A&&I<=1;for(let C=0;C<B.lanes;C++){let Q=0===I&&0===A?2:0;const E=g?K(J,A,C,I,n,B.passes,O,Q):null;for(;Q<O;Q++){const i=I*O+Q,e=i>0?P[C][i-1]:P[C][T-1],w=g?E.next().value:e;t(G.byteOffset,w.byteOffset,C,B.lanes,A,I,Q,4,O);const n=G[0],r=G[1];0===A&&x(C,i),L(J,e,P[n][r],A>0?d:P[C][i]),A>0&&F(J,P[C][i],d,P[C][i])}}}const V=P[0][T-1];for(let A=1;A<B.lanes;A++)F(J,V,V,P[A][T-1]);const Z=u(B.tagLength,V,new Uint8Array(B.tagLength));return Y.fill(0),I.grow(0),Z}let v;async function Y(A,I){const g=new WebAssembly.Memory({initial:1040,maximum:65536}),B=await async function(A,I,g){const B={env:{memory:A}};if(void 0===v)try{const A=await I(B);return v=!0,A}catch(A){v=!1}return(v?I:g)(B)}(g,A,I);return A=>d(A,{instance:B.instance,memory:g})}function m(I,g,B,C){function Q(A,I,g){var B=g?WebAssembly.instantiateStreaming:WebAssembly.instantiate,C=g?WebAssembly.compileStreaming:WebAssembly.compile;return I?B(A,I):C(A)}var E=null;if(g)return Q(fetch(g),C,!0);var t=A.atob(B),i=t.length;E=new Uint8Array(new ArrayBuffer(i));for(var e=0;e<i;e++)E[e]=t.charCodeAt(e);if(I){var w=new WebAssembly.Module(E);return C?new WebAssembly.Instance(w,C):w}return Q(E,C,!1)}const T=async()=>Y((A=>m(0,null,"AGFzbQEAAAABKwdgBH9/f38AYAABf2AAAGADf39/AGAJf39/f39/f39/AX9gAX8AYAF/AX8CEwEDZW52Bm1lbW9yeQIBkAiAgAQDCgkCAwAABAEFBgEEBQFwAQICBgkBfwFBkIjAAgsHfQoDeG9yAAEBRwACAkcyAAMFZ2V0TFoABBlfX2luZGlyZWN0X2Z1bmN0aW9uX3RhYmxlAQALX2luaXRpYWxpemUAABBfX2Vycm5vX2xvY2F0aW9uAAgJc3RhY2tTYXZlAAUMc3RhY2tSZXN0b3JlAAYKc3RhY2tBbGxvYwAHCQcBAEEBCwEACs0gCQMAAQtYAQJ/A0AgACAEQQR0IgNqIAIgA2r9AAQAIAEgA2r9AAQA/VH9CwQAIAAgA0EQciIDaiACIANq/QAEACABIANq/QAEAP1R/QsEACAEQQJqIgRBwABHDQALC7ceAgt7A38DQCADIBFBBHQiD2ogASAPav0ABAAgACAPav0ABAD9USIF/QsEACACIA9qIAX9CwQAIAMgD0EQciIPaiABIA9q/QAEACAAIA9q/QAEAP1RIgX9CwQAIAIgD2ogBf0LBAAgEUECaiIRQcAARw0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GBwEEBQFwAQICBgkBfwFBkIjAAgsHfQoDeG9yAAEBRwADAkcyAAQFZ2V0TFoABRlfX2luZGlyZWN0X2Z1bmN0aW9uX3RhYmxlAQALX2luaXRpYWxpemUAABBfX2Vycm5vX2xvY2F0aW9uAAkJc3RhY2tTYXZlAAYMc3RhY2tSZXN0b3JlAAcKc3RhY2tBbGxvYwAICQcBAEEBCwEACssaCgMAAQtQAQJ/A0AgACAEQQN0IgNqIAIgA2opAwAgASADaikDAIU3AwAgACADQQhyIgNqIAIgA2opAwAgASADaikDAIU3AwAgBEECaiIEQYABRw0ACwveDwICfgF/IAAgAUEDdGoiEyATKQMAIhEgACAFQQN0aiIBKQMAIhJ8IBFCAYZC/v///x+DIBJC/////w+DfnwiETcDACAAIA1BA3RqIgUgESAFKQMAhUIgiSIRNwMAIAAgCUEDdGoiCSARIAkpAwAiEnwgEUL/////D4MgEkIBhkL+////H4N+fCIRNwMAIAEgESABKQMAhUIoiSIRNwMAIBMgESATKQMAIhJ8IBFC/////w+DIBJCAYZC/v///x+DfnwiETcDACAFIBEgBSkDAIVCMIkiETcDACAJIBEgCSkDACISfCARQv////8PgyASQgGGQv7///8fg358IhE3AwAgASARIAEpAwCFQgGJNwMAIAAgAkEDdGoiDSANKQMAIhEgACAGQQN0aiICKQMAIhJ8IBFCAYZC/v///x+DIBJC/////w+DfnwiETcDACAAIA5BA3RqIgYgESAGKQMAhUIgiSIRNwMAIAAgCkEDdGoiCiARIAopAwAiEnwgEUL/////D4MgEkIBhkL+////H4N+fCIRNwMAIAIgESACKQMAhUIoiSIRNwMAIA0gESANKQMAIhJ8IBFC/////w+DIBJCAYZC/v///x+DfnwiETcDACAGIBEgBikDAIVCMIkiETcDACAKIBEgCikDACISfCARQv////8PgyASQgGGQv7///8fg358IhE3AwAgAiARIAIpAwCFQgGJNwMAIAAgA0EDdGoiDiAOKQMAIhEgACAHQQN0aiIDKQMAIhJ8IBFCAYZC/v///x+DIBJC/////w+DfnwiETcDACAAIA9BA3RqIgcgESAHKQMAhUIgiSIRNwMAIAAgC0EDdGoiCyARIAspAwAiEnwgEUL/////D4MgEkIBhkL+////H4N+fCIRNwMAIAMgESADKQMAhUIoiSIRNwMAIA4gESAOKQMAIhJ8IBFC/////w+DIBJCAYZC/v///x+DfnwiETcDACAHIBEgBykDAIVCMIkiETcDACALIBEgCykDACISfCARQv////8PgyASQgGGQv7///8fg358IhE3AwAgAyARIAMpAwCFQgGJNwMAIAAgBEEDdGoiDyAPKQMAIhEgACAIQQN0aiIEKQMAIhJ8IBFCAYZC/v///x+DIBJC/////w+DfnwiETcDACAAIBBBA3RqIgggESAIKQMAhUIgiSIRNwMAIAAgDEEDdGoiACARIAApAwAiEnwgEUL/////D4MgEkIBhkL+////H4N+fCIRNwMAIAQgESAEKQMAhUIoiSIRNwMAIA8gESAPKQMAIhJ8IBFC/////w+DIBJCAYZC/v///x+DfnwiETcDACAIIBEgCCkDAIVCMIkiETcDACAAIBEgACkDACISfCARQv////8PgyASQgGGQv7///8fg358IhE3AwAgBCARIAQpAwCFQgGJNwMAIBMgEykDACIRIAIpAwAiEnwgEUIBhkL+////H4MgEkL/////D4N+fCIRNwMAIAggESAIKQMAhUIgiSIRNwMAIAsgESALKQMAIhJ8IBFC/////w+DIBJCAYZC/v///x+DfnwiETcDACACIBEgAikDAIVCKIkiETcDACATIBEgEykDACISfCARQv////8PgyASQgGGQv7///8fg358IhE3AwAgCCARIAgpAwCFQjCJIhE3AwAgCyARIAspAwAiEnwgEUL/////D4MgEkIBhkL+////H4N+fCIRNwMAIAIgESACKQMAhUIBiTcDACANIA0pAwAiESADKQMAIhJ8IBFCAYZC/v///x+DIBJC/////w+DfnwiETcDACAFIBEgBSkDAIVCIIkiETcDACAAIBEgACkDACISfCARQv////8PgyASQgGGQv7///8fg358IhE3AwAgAyARIAMpAwCFQiiJIhE3AwAgDSARIA0pAwAiEnwgEUL/////D4MgEkIBhkL+////H4N+fCIRNwMAIAUgESAFKQMAhUIwiSIRNwMAIAAgESAAKQMAIhJ8IBFC/////w+DIBJCAYZC/v///x+DfnwiETcDACADIBEgAykDAIVCAYk3AwAgDiAOKQMAIhEgBCkDACISfCARQgGGQv7///8fgyASQv////8Pg358IhE3AwAgBiARIAYpAwCFQiCJIhE3AwAgCSARIAkpAwAiEnwgEUL/////D4MgEkIBhkL+////H4N+fCIRNwMAIAQgESAEKQMAhUIoiSIRNwMAIA4gESAOKQMAIhJ8IBFC/////w+DIBJCAYZC/v///x+DfnwiETcDACAGIBEgBikDAIVCMIkiETcDACAJIBEgCSkDACISfCARQv////8PgyASQgGGQv7///8fg358IhE3AwAgBCARIAQpAwCFQgGJNwMAIA8gDykDACIRIAEpAwAiEnwgEUIBhkL+////H4MgEkL/////D4N+fCIRNwMAIAcgESAHKQMAhUIgiSIRNwMAIAogESAKKQMAIhJ8IBFC/////w+DIBJCAYZC/v///x+DfnwiETcDACABIBEgASkDAIVCKIkiETcDACAPIBEgDykDACISfCARQv////8PgyASQgGGQv7///8fg358IhE3AwAgByARIAcpAwCFQjCJIhE3AwAgCiARIAopAwAiEnwgEUL/////D4MgEkIBhkL+////H4N+fCIRNwMAIAEgESABKQMAhUIBiTcDAAvdCAEPfwNAIAIgBUEDdCIGaiABIAZqKQMAIAAgBmopAwCFNwMAIAIgBkEIciIGaiABIAZqKQMAIAAgBmopAwCFNwMAIAVBAmoiBUGAAUcNAAsDQCADIARBA3QiAGogACACaikDADcDACADIARBAXIiAEEDdCIBaiABIAJqKQMANwMAIAMgBEECciIBQQN0IgVqIAIgBWopAwA3AwAgAyAEQQNyIgVBA3QiBmogAiAGaikDADcDACADIARBBHIiBkEDdCIHaiACIAdqKQMANwMAIAMgBEEFciIHQQN0IghqIAIgCGopAwA3AwAgAyAEQQZyIghBA3QiCWogAiAJaikDADcDACADIARBB3IiCUEDdCIKaiACIApqKQMANwMAIAMgBEEIciIKQQN0IgtqIAIgC2opAwA3AwAgAyAEQQlyIgtBA3QiDGogAiAMaikDADcDACADIARBCnIiDEEDdCINai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TYCACAAIAdBAWsgBSAEGyAIbCAGQQFrQQBBfyAGGyACIAlGG2oiASAFQQFqIAhsQQAgBBtqIAGtIAogCn5CIIh+QiCIp0F/c2ogByAIbHA2AgQgAAsEACMACwYAIAAkAAsQACMAIABrQXBxIgAkACAACwUAQYAICw==",A)));export{T as default};
3
3
  //# sourceMappingURL=argon2id.min.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"argon2id.min.mjs","sources":["../../node_modules/argon2id/lib/blake2b.js","../../node_modules/argon2id/lib/argon2id.js","../../node_modules/argon2id/lib/setup.js","../../node_modules/argon2id/index.js"],"sourcesContent":["// Adapted from the reference implementation in RFC7693\n// Initial port to Javascript by https://github.com/dcposch and https://github.com/emilbayes\n\n// Uint64 values are represented using two Uint32s, stored as little endian\n// NB: Uint32Arrays endianness depends on the underlying system, so for interoperability, conversions between Uint8Array and Uint32Arrays\n// need to be manually handled\n\n// 64-bit unsigned addition (little endian, in place)\n// Sets a[i,i+1] += b[j,j+1]\n// `a` and `b` must be Uint32Array(2)\nfunction ADD64 (a, i, b, j) {\n a[i] += b[j];\n a[i+1] += b[j+1] + (a[i] < b[j]); // add carry\n}\n\n// Increment 64-bit little-endian unsigned value by `c` (in place)\n// `a` must be Uint32Array(2)\nfunction INC64 (a, c) {\n a[0] += c;\n a[1] += (a[0] < c);\n}\n\n// G Mixing function\n// The ROTRs are inlined for speed\nfunction G (v, m, a, b, c, d, ix, iy) {\n ADD64(v, a, v, b) // v[a,a+1] += v[b,b+1]\n ADD64(v, a, m, ix) // v[a, a+1] += x ... x0\n\n // v[d,d+1] = (v[d,d+1] xor v[a,a+1]) rotated to the right by 32 bits\n let xor0 = v[d] ^ v[a]\n let xor1 = v[d + 1] ^ v[a + 1]\n v[d] = xor1\n v[d + 1] = xor0\n\n ADD64(v, c, v, d)\n\n // v[b,b+1] = (v[b,b+1] xor v[c,c+1]) rotated right by 24 bits\n xor0 = v[b] ^ v[c]\n xor1 = v[b + 1] ^ v[c + 1]\n v[b] = (xor0 >>> 24) ^ (xor1 << 8)\n v[b + 1] = (xor1 >>> 24) ^ (xor0 << 8)\n\n ADD64(v, a, v, b)\n ADD64(v, a, m, iy)\n\n // v[d,d+1] = (v[d,d+1] xor v[a,a+1]) rotated right by 16 bits\n xor0 = v[d] ^ v[a]\n xor1 = v[d + 1] ^ v[a + 1]\n v[d] = (xor0 >>> 16) ^ (xor1 << 16)\n v[d + 1] = (xor1 >>> 16) ^ (xor0 << 16)\n\n ADD64(v, c, v, d)\n\n // v[b,b+1] = (v[b,b+1] xor v[c,c+1]) rotated right by 63 bits\n xor0 = v[b] ^ v[c]\n xor1 = v[b + 1] ^ v[c + 1]\n v[b] = (xor1 >>> 31) ^ (xor0 << 1)\n v[b + 1] = (xor0 >>> 31) ^ (xor1 << 1)\n}\n\n// Initialization Vector\nconst BLAKE2B_IV32 = new Uint32Array([\n 0xF3BCC908, 0x6A09E667, 0x84CAA73B, 0xBB67AE85,\n 0xFE94F82B, 0x3C6EF372, 0x5F1D36F1, 0xA54FF53A,\n 0xADE682D1, 0x510E527F, 0x2B3E6C1F, 0x9B05688C,\n 0xFB41BD6B, 0x1F83D9AB, 0x137E2179, 0x5BE0CD19\n])\n\n// These are offsets into a Uint64 buffer.\n// Multiply them all by 2 to make them offsets into a Uint32 buffer\nconst SIGMA = new Uint8Array([\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3,\n 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4,\n 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8,\n 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13,\n 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9,\n 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11,\n 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10,\n 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5,\n 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0,\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3\n].map(x => x * 2))\n\n// Compression function. 'last' flag indicates last block.\n// Note: we're representing 16 uint64s as 32 uint32s\nfunction compress(S, last) {\n const v = new Uint32Array(32)\n const m = new Uint32Array(S.b.buffer, S.b.byteOffset, 32)\n\n // init work variables\n for (let i = 0; i < 16; i++) {\n v[i] = S.h[i]\n v[i + 16] = BLAKE2B_IV32[i]\n }\n\n // low 64 bits of offset\n v[24] ^= S.t0[0]\n v[25] ^= S.t0[1]\n // high 64 bits not supported (`t1`), offset may not be higher than 2**53-1\n\n // if last block\n const f0 = last ? 0xFFFFFFFF : 0;\n v[28] ^= f0;\n v[29] ^= f0;\n\n // twelve rounds of mixing\n for (let i = 0; i < 12; i++) {\n // ROUND(r)\n const i16 = i << 4;\n G(v, m, 0, 8, 16, 24, SIGMA[i16 + 0], SIGMA[i16 + 1])\n G(v, m, 2, 10, 18, 26, SIGMA[i16 + 2], SIGMA[i16 + 3])\n G(v, m, 4, 12, 20, 28, SIGMA[i16 + 4], SIGMA[i16 + 5])\n G(v, m, 6, 14, 22, 30, SIGMA[i16 + 6], SIGMA[i16 + 7])\n G(v, m, 0, 10, 20, 30, SIGMA[i16 + 8], SIGMA[i16 + 9])\n G(v, m, 2, 12, 22, 24, SIGMA[i16 + 10], SIGMA[i16 + 11])\n G(v, m, 4, 14, 16, 26, SIGMA[i16 + 12], SIGMA[i16 + 13])\n G(v, m, 6, 8, 18, 28, SIGMA[i16 + 14], SIGMA[i16 + 15])\n }\n\n for (let i = 0; i < 16; i++) {\n S.h[i] ^= v[i] ^ v[i + 16]\n }\n}\n\n// Creates a BLAKE2b hashing context\n// Requires an output length between 1 and 64 bytes\n// Takes an optional Uint8Array key\nclass Blake2b {\n constructor(outlen, key, salt, personal) {\n const params = new Uint8Array(64)\n // 0: outlen, keylen, fanout, depth\n // 4: leaf length, sequential mode\n // 8: node offset\n // 12: node offset\n // 16: node depth, inner length, rfu\n // 20: rfu\n // 24: rfu\n // 28: rfu\n // 32: salt\n // 36: salt\n // 40: salt\n // 44: salt\n // 48: personal\n // 52: personal\n // 56: personal\n // 60: personal\n\n // init internal state\n this.S = {\n b: new Uint8Array(BLOCKBYTES),\n h: new Uint32Array(OUTBYTES_MAX / 4),\n t0: new Uint32Array(2), // input counter `t`, lower 64-bits only\n c: 0, // `fill`, pointer within buffer, up to `BLOCKBYTES`\n outlen // output length in bytes\n }\n\n // init parameter block\n params[0] = outlen\n if (key) params[1] = key.length\n params[2] = 1 // fanout\n params[3] = 1 // depth\n if (salt) params.set(salt, 32)\n if (personal) params.set(personal, 48)\n const params32 = new Uint32Array(params.buffer, params.byteOffset, params.length / Uint32Array.BYTES_PER_ELEMENT);\n\n // initialize hash state\n for (let i = 0; i < 16; i++) {\n this.S.h[i] = BLAKE2B_IV32[i] ^ params32[i];\n }\n\n // key the hash, if applicable\n if (key) {\n const block = new Uint8Array(BLOCKBYTES)\n block.set(key)\n this.update(block)\n }\n }\n\n // Updates a BLAKE2b streaming hash\n // Requires Uint8Array (byte array)\n update(input) {\n if (!(input instanceof Uint8Array)) throw new Error('Input must be Uint8Array or Buffer')\n // for (let i = 0; i < input.length; i++) {\n // if (this.S.c === BLOCKBYTES) { // buffer full\n // INC64(this.S.t0, this.S.c) // add counters\n // compress(this.S, false)\n // this.S.c = 0 // empty buffer\n // }\n // this.S.b[this.S.c++] = input[i]\n // }\n let i = 0\n while(i < input.length) {\n if (this.S.c === BLOCKBYTES) { // buffer full\n INC64(this.S.t0, this.S.c) // add counters\n compress(this.S, false)\n this.S.c = 0 // empty buffer\n }\n let left = BLOCKBYTES - this.S.c\n this.S.b.set(input.subarray(i, i + left), this.S.c) // end index can be out of bounds\n const fill = Math.min(left, input.length - i)\n this.S.c += fill\n i += fill\n }\n return this\n }\n\n /**\n * Return a BLAKE2b hash, either filling the given Uint8Array or allocating a new one\n * @param {Uint8Array} [prealloc] - optional preallocated buffer\n * @returns {ArrayBuffer} message digest\n */\n digest(prealloc) {\n INC64(this.S.t0, this.S.c) // mark last block offset\n\n // final block, padded\n this.S.b.fill(0, this.S.c);\n this.S.c = BLOCKBYTES;\n compress(this.S, true)\n\n const out = prealloc || new Uint8Array(this.S.outlen);\n for (let i = 0; i < this.S.outlen; i++) {\n // must be loaded individually since default Uint32 endianness is platform dependant\n out[i] = this.S.h[i >> 2] >> (8 * (i & 3))\n }\n this.S.h = null; // prevent calling `update` after `digest`\n return out.buffer;\n }\n}\n\n\nexport default function createHash(outlen, key, salt, personal) {\n if (outlen > OUTBYTES_MAX) throw new Error(`outlen must be at most ${OUTBYTES_MAX} (given: ${outlen})`)\n if (key) {\n if (!(key instanceof Uint8Array)) throw new Error('key must be Uint8Array or Buffer')\n if (key.length > KEYBYTES_MAX) throw new Error(`key size must be at most ${KEYBYTES_MAX} (given: ${key.length})`)\n }\n if (salt) {\n if (!(salt instanceof Uint8Array)) throw new Error('salt must be Uint8Array or Buffer')\n if (salt.length !== SALTBYTES) throw new Error(`salt must be exactly ${SALTBYTES} (given: ${salt.length}`)\n }\n if (personal) {\n if (!(personal instanceof Uint8Array)) throw new Error('personal must be Uint8Array or Buffer')\n if (personal.length !== PERSONALBYTES) throw new Error(`salt must be exactly ${PERSONALBYTES} (given: ${personal.length}`)\n }\n\n return new Blake2b(outlen, key, salt, personal)\n}\n\nconst OUTBYTES_MAX = 64;\nconst KEYBYTES_MAX = 64;\nconst SALTBYTES = 16;\nconst PERSONALBYTES = 16;\nconst BLOCKBYTES = 128;\n\n","import blake2b from \"./blake2b.js\"\nconst TYPE = 2; // Argon2id\nconst VERSION = 0x13;\nconst TAGBYTES_MAX = 0xFFFFFFFF; // Math.pow(2, 32) - 1;\nconst TAGBYTES_MIN = 4; // Math.pow(2, 32) - 1;\nconst SALTBYTES_MAX = 0xFFFFFFFF; // Math.pow(2, 32) - 1;\nconst SALTBYTES_MIN = 8;\nconst passwordBYTES_MAX = 0xFFFFFFFF;// Math.pow(2, 32) - 1;\nconst passwordBYTES_MIN = 8;\nconst MEMBYTES_MAX = 0xFFFFFFFF;// Math.pow(2, 32) - 1;\nconst ADBYTES_MAX = 0xFFFFFFFF; // Math.pow(2, 32) - 1; // associated data (optional)\nconst SECRETBYTES_MAX = 32; // key (optional)\n\nconst ARGON2_BLOCK_SIZE = 1024;\nconst ARGON2_PREHASH_DIGEST_LENGTH = 64;\n\nconst isLittleEndian = new Uint8Array(new Uint16Array([0xabcd]).buffer)[0] === 0xcd;\n\n// store n as a little-endian 32-bit Uint8Array inside buf (at buf[i:i+3])\nfunction LE32(buf, n, i) {\n buf[i+0] = n;\n buf[i+1] = n >> 8;\n buf[i+2] = n >> 16;\n buf[i+3] = n >> 24;\n return buf;\n}\n\n/**\n * Store n as a 64-bit LE number in the given buffer (from buf[i] to buf[i+7])\n * @param {Uint8Array} buf\n * @param {Number} n\n * @param {Number} i\n */\nfunction LE64(buf, n, i) {\n if (n > Number.MAX_SAFE_INTEGER) throw new Error(\"LE64: large numbers unsupported\");\n // ECMAScript standard has engines convert numbers to 32-bit integers for bitwise operations\n // shifting by 32 or more bits is not supported (https://stackoverflow.com/questions/6729122/javascript-bit-shift-number-wraps)\n // so we manually extract each byte\n let remainder = n;\n for (let offset = i; offset < i+7; offset++) { // last byte can be ignored as it would overflow MAX_SAFE_INTEGER\n buf[offset] = remainder; // implicit & 0xff\n remainder = (remainder - buf[offset]) / 256;\n }\n return buf;\n}\n\n/**\n * Variable-Length Hash Function H'\n * @param {Number} outlen - T\n * @param {Uint8Array} X - value to hash\n * @param {Uint8Array} res - output buffer, of length `outlength` or larger\n */\nfunction H_(outlen, X, res) {\n const V = new Uint8Array(64); // no need to keep around all V_i\n\n const V1_in = new Uint8Array(4 + X.length);\n LE32(V1_in, outlen, 0);\n V1_in.set(X, 4);\n if (outlen <= 64) {\n // H'^T(A) = H^T(LE32(T)||A)\n blake2b(outlen).update(V1_in).digest(res);\n return res\n }\n\n const r = Math.ceil(outlen / 32) - 2;\n\n // Let V_i be a 64-byte block and W_i be its first 32 bytes.\n // V_1 = H^(64)(LE32(T)||A)\n // V_2 = H^(64)(V_1)\n // ...\n // V_r = H^(64)(V_{r-1})\n // V_{r+1} = H^(T-32*r)(V_{r})\n // H'^T(X) = W_1 || W_2 || ... || W_r || V_{r+1}\n for (let i = 0; i < r; i++) {\n blake2b(64).update(i === 0 ? V1_in : V).digest(V);\n // store W_i in result buffer already\n res.set(V.subarray(0, 32), i*32)\n }\n // V_{r+1}\n const V_r1 = new Uint8Array(blake2b(outlen - 32*r).update(V).digest());\n res.set(V_r1, r*32);\n\n return res;\n}\n\n// compute buf = xs ^ ys\nfunction XOR(wasmContext, buf, xs, ys) {\n wasmContext.fn.XOR(\n buf.byteOffset,\n xs.byteOffset,\n ys.byteOffset,\n );\n return buf\n}\n\n/**\n * @param {Uint8Array} X (read-only)\n * @param {Uint8Array} Y (read-only)\n * @param {Uint8Array} R - output buffer\n * @returns\n */\nfunction G(wasmContext, X, Y, R) {\n wasmContext.fn.G(\n X.byteOffset,\n Y.byteOffset,\n R.byteOffset,\n wasmContext.refs.gZ.byteOffset\n );\n return R;\n}\n\nfunction G2(wasmContext, X, Y, R) {\n wasmContext.fn.G2(\n X.byteOffset,\n Y.byteOffset,\n R.byteOffset,\n wasmContext.refs.gZ.byteOffset\n );\n return R;\n}\n\n// Generator for data-independent J1, J2. Each `next()` invocation returns a new pair of values.\nfunction* makePRNG(wasmContext, pass, lane, slice, m_, totalPasses, segmentLength, segmentOffset) {\n // For each segment, we do the following. First, we compute the value Z as:\n // Z= ( LE64(r) || LE64(l) || LE64(sl) || LE64(m') || LE64(t) || LE64(y) )\n wasmContext.refs.prngTmp.fill(0);\n const Z = wasmContext.refs.prngTmp.subarray(0, 6 * 8);\n LE64(Z, pass, 0);\n LE64(Z, lane, 8);\n LE64(Z, slice, 16);\n LE64(Z, m_, 24);\n LE64(Z, totalPasses, 32);\n LE64(Z, TYPE, 40);\n\n // Then we compute q/(128*SL) 1024-byte values\n // G( ZERO(1024),\n // G( ZERO(1024), Z || LE64(1) || ZERO(968) ) ),\n // ...,\n // G( ZERO(1024),\n // G( ZERO(1024), Z || LE64(q/(128*SL)) || ZERO(968) )),\n for(let i = 1; i <= segmentLength; i++) {\n // tmp.set(Z); // no need to re-copy\n LE64(wasmContext.refs.prngTmp, i, Z.length); // tmp.set(ZER0968) not necessary, memory already zeroed\n const g2 = G2(wasmContext, wasmContext.refs.ZERO1024, wasmContext.refs.prngTmp, wasmContext.refs.prngR );\n\n // each invocation of G^2 outputs 1024 bytes that are to be partitioned into 8-bytes values, take as X1 || X2\n // NB: the first generated pair must be used for the first block of the segment, and so on.\n // Hence, if some blocks are skipped (e.g. during the first pass), the corresponding J1J2 are discarded based on the given segmentOffset.\n for(let k = i === 1 ? segmentOffset*8 : 0; k < g2.length; k += 8) {\n yield g2.subarray(k, k+8);\n }\n }\n return [];\n}\n\nfunction validateParams({ type, version, tagLength, password, salt, ad, secret, parallelism, memorySize, passes }) {\n const assertLength = (name, value, min, max) => {\n if (value < min || value > max) { throw new Error(`${name} size should be between ${min} and ${max} bytes`); }\n }\n\n if (type !== TYPE || version !== VERSION) throw new Error('Unsupported type or version');\n assertLength('password', password, passwordBYTES_MIN, passwordBYTES_MAX);\n assertLength('salt', salt, SALTBYTES_MIN, SALTBYTES_MAX);\n assertLength('tag', tagLength, TAGBYTES_MIN, TAGBYTES_MAX);\n assertLength('memory', memorySize, 8*parallelism, MEMBYTES_MAX);\n // optional fields\n ad && assertLength('associated data', ad, 0, ADBYTES_MAX);\n secret && assertLength('secret', secret, 0, SECRETBYTES_MAX);\n\n return { type, version, tagLength, password, salt, ad, secret, lanes: parallelism, memorySize, passes };\n}\n\nconst KB = 1024;\nconst WASM_PAGE_SIZE = 64 * KB;\n\nexport default function argon2id(params, { memory, instance: wasmInstance }) {\n if (!isLittleEndian) throw new Error('BigEndian system not supported'); // optmisations assume LE system\n\n const ctx = validateParams({ type: TYPE, version: VERSION, ...params });\n\n const { G:wasmG, G2:wasmG2, xor:wasmXOR, getLZ:wasmLZ } = wasmInstance.exports;\n const wasmRefs = {};\n const wasmFn = {};\n wasmFn.G = wasmG;\n wasmFn.G2 = wasmG2;\n wasmFn.XOR = wasmXOR;\n\n // The actual number of blocks is m', which is m rounded down to the nearest multiple of 4*p.\n const m_ = 4 * ctx.lanes * Math.floor(ctx.memorySize / (4 * ctx.lanes));\n const requiredMemory = m_ * ARGON2_BLOCK_SIZE + 10 * KB; // Additional KBs for utility references\n if (memory.buffer.byteLength < requiredMemory) {\n const missing = Math.ceil((requiredMemory - memory.buffer.byteLength) / WASM_PAGE_SIZE)\n // If enough memory is available, the `memory.buffer` is internally detached and the reference updated.\n // Otherwise, the operation fails, and the original memory can still be used.\n memory.grow(missing)\n }\n\n let offset = 0;\n // Init wasm memory needed in other functions\n wasmRefs.gZ = new Uint8Array(memory.buffer, offset, ARGON2_BLOCK_SIZE); offset+= wasmRefs.gZ.length;\n wasmRefs.prngR = new Uint8Array(memory.buffer, offset, ARGON2_BLOCK_SIZE); offset+=wasmRefs.prngR.length;\n wasmRefs.prngTmp = new Uint8Array(memory.buffer, offset, ARGON2_BLOCK_SIZE); offset+=wasmRefs.prngTmp.length;\n wasmRefs.ZERO1024 = new Uint8Array(memory.buffer, offset, 1024); offset+=wasmRefs.ZERO1024.length;\n // Init wasm memory needed locally\n const lz = new Uint32Array(memory.buffer, offset, 2); offset+=lz.length * Uint32Array.BYTES_PER_ELEMENT;\n const wasmContext = { fn: wasmFn, refs: wasmRefs };\n const newBlock = new Uint8Array(memory.buffer, offset, ARGON2_BLOCK_SIZE); offset+=newBlock.length;\n const blockMemory = new Uint8Array(memory.buffer, offset, ctx.memorySize * ARGON2_BLOCK_SIZE);\n const allocatedMemory = new Uint8Array(memory.buffer, 0, offset);\n\n // 1. Establish H_0\n const H0 = getH0(ctx);\n\n // 2. Allocate the memory as m' 1024-byte blocks\n // For p lanes, the memory is organized in a matrix B[i][j] of blocks with p rows (lanes) and q = m' / p columns.\n const q = m_ / ctx.lanes;\n const B = new Array(ctx.lanes).fill(null).map(() => new Array(q));\n const initBlock = (i, j) => {\n B[i][j] = blockMemory.subarray(i*q*1024 + j*1024, (i*q*1024 + j*1024) + ARGON2_BLOCK_SIZE);\n return B[i][j];\n }\n\n for (let i = 0; i < ctx.lanes; i++) {\n // const LEi = LE0; // since p = 1 for us\n const tmp = new Uint8Array(H0.length + 8);\n // 3. Compute B[i][0] for all i ranging from (and including) 0 to (not including) p\n // B[i][0] = H'^(1024)(H_0 || LE32(0) || LE32(i))\n tmp.set(H0); LE32(tmp, 0, H0.length); LE32(tmp, i, H0.length + 4);\n H_(ARGON2_BLOCK_SIZE, tmp, initBlock(i, 0));\n // 4. Compute B[i][1] for all i ranging from (and including) 0 to (not including) p\n // B[i][1] = H'^(1024)(H_0 || LE32(1) || LE32(i))\n LE32(tmp, 1, H0.length);\n H_(ARGON2_BLOCK_SIZE, tmp, initBlock(i, 1));\n }\n\n // 5. Compute B[i][j] for all i ranging from (and including) 0 to (not including) p and for all j ranging from (and including) 2\n // to (not including) q. The computation MUST proceed slicewise (Section 3.4) : first, blocks from slice 0 are computed for all lanes\n // (in an arbitrary order of lanes), then blocks from slice 1 are computed, etc.\n const SL = 4; // vertical slices\n const segmentLength = q / SL;\n for (let pass = 0; pass < ctx.passes; pass++) {\n // The intersection of a slice and a lane is called a segment, which has a length of q/SL. Segments of the same slice can be computed in parallel\n for (let sl = 0; sl < SL; sl++) {\n const isDataIndependent = pass === 0 && sl <= 1;\n for (let i = 0; i < ctx.lanes; i++) { // lane\n // On the first slice of the first pass, blocks 0 and 1 are already filled\n let segmentOffset = sl === 0 && pass === 0 ? 2 : 0;\n // no need to generate all J1J2s, use iterator/generator that creates the value on the fly (to save memory)\n const PRNG = isDataIndependent ? makePRNG(wasmContext, pass, i, sl, m_, ctx.passes, segmentLength, segmentOffset) : null;\n for (segmentOffset; segmentOffset < segmentLength; segmentOffset++) {\n const j = sl * segmentLength + segmentOffset;\n const prevBlock = j > 0 ? B[i][j-1] : B[i][q-1]; // B[i][(j-1) mod q]\n\n // we can assume the PRNG is never done\n const J1J2 = isDataIndependent ? PRNG.next().value : prevBlock; // .subarray(0, 8) not required since we only pass the byteOffset to wasm\n // The block indices l and z are determined for each i, j differently for Argon2d, Argon2i, and Argon2id.\n wasmLZ(lz.byteOffset, J1J2.byteOffset, i, ctx.lanes, pass, sl, segmentOffset, SL, segmentLength)\n const l = lz[0]; const z = lz[1];\n // for (let i = 0; i < p; i++ )\n // B[i][j] = G(B[i][j-1], B[l][z])\n // The block indices l and z are determined for each i, j differently for Argon2d, Argon2i, and Argon2id.\n if (pass === 0) initBlock(i, j);\n G(wasmContext, prevBlock, B[l][z], pass > 0 ? newBlock : B[i][j]);\n\n // 6. If the number of passes t is larger than 1, we repeat step 5. However, blocks are computed differently as the old value is XORed with the new one\n if (pass > 0) XOR(wasmContext, B[i][j], newBlock, B[i][j])\n }\n }\n }\n }\n\n // 7. After t steps have been iterated, the final block C is computed as the XOR of the last column:\n // C = B[0][q-1] XOR B[1][q-1] XOR ... XOR B[p-1][q-1]\n const C = B[0][q-1];\n for(let i = 1; i < ctx.lanes; i++) {\n XOR(wasmContext, C, C, B[i][q-1])\n }\n\n const tag = H_(ctx.tagLength, C, new Uint8Array(ctx.tagLength));\n // clear memory since the module might be cached\n allocatedMemory.fill(0) // clear sensitive contents\n memory.grow(0) // allow deallocation\n // 8. The output tag is computed as H'^T(C).\n return tag;\n\n}\n\nfunction getH0(ctx) {\n const H = blake2b(ARGON2_PREHASH_DIGEST_LENGTH);\n const ZERO32 = new Uint8Array(4);\n const params = new Uint8Array(24);\n LE32(params, ctx.lanes, 0);\n LE32(params, ctx.tagLength, 4);\n LE32(params, ctx.memorySize, 8);\n LE32(params, ctx.passes, 12);\n LE32(params, ctx.version, 16);\n LE32(params, ctx.type, 20);\n\n const toHash = [params];\n if (ctx.password) {\n toHash.push(LE32(new Uint8Array(4), ctx.password.length, 0))\n toHash.push(ctx.password)\n } else {\n toHash.push(ZERO32) // context.password.length\n }\n\n if (ctx.salt) {\n toHash.push(LE32(new Uint8Array(4), ctx.salt.length, 0))\n toHash.push(ctx.salt)\n } else {\n toHash.push(ZERO32) // context.salt.length\n }\n\n if (ctx.secret) {\n toHash.push(LE32(new Uint8Array(4), ctx.secret.length, 0))\n toHash.push(ctx.secret)\n // todo clear secret?\n } else {\n toHash.push(ZERO32) // context.secret.length\n }\n\n if (ctx.ad) {\n toHash.push(LE32(new Uint8Array(4), ctx.ad.length, 0))\n toHash.push(ctx.ad)\n } else {\n toHash.push(ZERO32) // context.ad.length\n }\n H.update(concatArrays(toHash))\n\n const outputBuffer = H.digest();\n return new Uint8Array(outputBuffer);\n}\n\nfunction concatArrays(arrays) {\n if (arrays.length === 1) return arrays[0];\n\n let totalLength = 0;\n for (let i = 0; i < arrays.length; i++) {\n if (!(arrays[i] instanceof Uint8Array)) {\n throw new Error('concatArrays: Data must be in the form of a Uint8Array');\n }\n\n totalLength += arrays[i].length;\n }\n\n const result = new Uint8Array(totalLength);\n let pos = 0;\n arrays.forEach((element) => {\n result.set(element, pos);\n pos += element.length;\n });\n\n return result;\n}\n","import argon2id from \"./argon2id.js\";\n\nlet isSIMDSupported;\nasync function wasmLoader(memory, getSIMD, getNonSIMD) {\n const importObject = { env: { memory } };\n if (isSIMDSupported === undefined) {\n try {\n const loaded = await getSIMD(importObject);\n isSIMDSupported = true;\n return loaded;\n } catch(e) {\n isSIMDSupported = false;\n }\n }\n\n const loader = isSIMDSupported ? getSIMD : getNonSIMD;\n return loader(importObject);\n}\n\nexport default async function setupWasm(getSIMD, getNonSIMD) {\n const memory = new WebAssembly.Memory({\n // in pages of 64KiB each\n // these values need to be compatible with those declared when building in `build-wasm`\n initial: 1040, // 65MB\n maximum: 65536, // 4GB\n });\n const wasmModule = await wasmLoader(memory, getSIMD, getNonSIMD);\n\n /**\n * Argon2id hash function\n * @callback computeHash\n * @param {Object} params\n * @param {Uint8Array} params.password - password\n * @param {Uint8Array} params.salt - salt\n * @param {Integer} params.parallelism\n * @param {Integer} params.passes\n * @param {Integer} params.memorySize - in kibibytes\n * @param {Integer} params.tagLength - output tag length\n * @param {Uint8Array} [params.ad] - associated data (optional)\n * @param {Uint8Array} [params.secret] - secret data (optional)\n * @return {Uint8Array} argon2id hash\n */\n const computeHash = (params) => argon2id(params, { instance: wasmModule.instance, memory });\n\n return computeHash;\n}\n","import setupWasm from './lib/setup.js';\nimport wasmSIMD from './dist/simd.wasm';\nimport wasmNonSIMD from './dist/no-simd.wasm';\n\nconst loadWasm = async () => setupWasm(\n (instanceObject) => wasmSIMD(instanceObject),\n (instanceObject) => wasmNonSIMD(instanceObject),\n);\n\nexport default loadWasm;\n"],"names":["ADD64","a","i","b","j","INC64","c","G","v","m","d","ix","iy","xor0","xor1","BLAKE2B_IV32","Uint32Array","SIGMA","Uint8Array","map","x","compress","S","last","buffer","byteOffset","h","t0","f0","i16","Blake2b","constructor","outlen","key","salt","personal","params","this","BLOCKBYTES","OUTBYTES_MAX","length","set","params32","BYTES_PER_ELEMENT","block","update","input","Error","left","subarray","fill","Math","min","digest","prealloc","out","createHash","KEYBYTES_MAX","SALTBYTES","PERSONALBYTES","TYPE","VERSION","TAGBYTES_MAX","TAGBYTES_MIN","SALTBYTES_MAX","SALTBYTES_MIN","passwordBYTES_MAX","passwordBYTES_MIN","MEMBYTES_MAX","ADBYTES_MAX","SECRETBYTES_MAX","ARGON2_BLOCK_SIZE","ARGON2_PREHASH_DIGEST_LENGTH","isLittleEndian","Uint16Array","LE32","buf","n","LE64","Number","MAX_SAFE_INTEGER","remainder","offset","H_","X","res","V","V1_in","blake2b","r","ceil","V_r1","XOR","wasmContext","xs","ys","fn","Y","R","refs","gZ","G2","makePRNG","pass","lane","slice","m_","totalPasses","segmentLength","segmentOffset","prngTmp","Z","g2","ZERO1024","prngR","k","KB","WASM_PAGE_SIZE","argon2id","memory","instance","wasmInstance","ctx","type","version","tagLength","password","ad","secret","parallelism","memorySize","passes","assertLength","name","value","max","lanes","validateParams","wasmG","wasmG2","xor","wasmXOR","getLZ","wasmLZ","exports","wasmRefs","wasmFn","floor","requiredMemory","byteLength","missing","grow","lz","newBlock","blockMemory","allocatedMemory","H0","H","ZERO32","toHash","push","arrays","totalLength","result","pos","forEach","element","concatArrays","outputBuffer","getH0","q","B","Array","initBlock","tmp","sl","isDataIndependent","PRNG","prevBlock","J1J2","next","l","z","C","tag","isSIMDSupported","async","setupWasm","getSIMD","getNonSIMD","WebAssembly","Memory","initial","maximum","wasmModule","importObject","env","undefined","loaded","e","wasmLoader","loadWasm","instanceObject"],"mappings":";6GAUA,SAASA,EAAOC,EAAGC,EAAGC,EAAGC,GACvBH,EAAEC,IAAMC,EAAEC,GACVH,EAAEC,EAAE,IAAMC,EAAEC,EAAE,IAAMH,EAAEC,GAAKC,EAAEC,GAC/B,CAIA,SAASC,EAAOJ,EAAGK,GACjBL,EAAE,IAAMK,EACRL,EAAE,IAAOA,EAAE,GAAKK,CAClB,CAIA,SAASC,EAAGC,EAAGC,EAAGR,EAAGE,EAAGG,EAAGI,EAAGC,EAAIC,GAChCZ,EAAMQ,EAAGP,EAAGO,EAAGL,GACfH,EAAMQ,EAAGP,EAAGQ,EAAGE,GAGf,IAAIE,EAAOL,EAAEE,GAAKF,EAAEP,GAChBa,EAAON,EAAEE,EAAI,GAAKF,EAAEP,EAAI,GAC5BO,EAAEE,GAAKI,EACPN,EAAEE,EAAI,GAAKG,EAEXb,EAAMQ,EAAGF,EAAGE,EAAGE,GAGfG,EAAOL,EAAEL,GAAKK,EAAEF,GAChBQ,EAAON,EAAEL,EAAI,GAAKK,EAAEF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rK,WAAWwG,EAAIG,YAKpD,OAHA8B,EAAgBzG,KAAK,GACrBqE,EAAOgC,KAAK,GAELiC,CAET,CC3RA,IAAIC,EAiBWC,eAAeC,EAAUC,EAASC,GAC/C,MAAMtE,EAAS,IAAIuE,YAAYC,OAAO,CAGpCC,QAAS,KACTC,QAAS,QAELC,QAvBRR,eAA0BnE,EAAQqE,EAASC,GACzC,MAAMM,EAAe,CAAEC,IAAK,CAAE7E,WAC9B,QAAwB8E,IAApBZ,EACF,IACE,MAAMa,QAAeV,EAAQO,GAE7B,OADAV,GAAkB,EACXa,CACR,CAAC,MAAMC,GACNd,GAAkB,CACnB,CAIH,OADeA,EAAkBG,EAAUC,GAC7BM,EAChB,CAS2BK,CAAWjF,EAAQqE,EAASC,GAkBrD,OAFqBzJ,GAAWkF,EAASlF,EAAQ,CAAEoF,SAAU0E,EAAW1E,SAAUD,UAGpF,maCzCK,MAACkF,EAAWf,SAAYC,GAC1Be,+wLAA4BA,KAC5BA,2yJAA+BA","x_google_ignoreList":[0,1,2,3]}
1
+ {"version":3,"file":"argon2id.min.mjs","sources":["../../node_modules/argon2id/lib/blake2b.js","../../node_modules/argon2id/lib/argon2id.js","../../node_modules/argon2id/lib/setup.js","../../node_modules/argon2id/index.js"],"sourcesContent":["// Adapted from the reference implementation in RFC7693\n// Initial port to Javascript by https://github.com/dcposch and https://github.com/emilbayes\n\n// Uint64 values are represented using two Uint32s, stored as little endian\n// NB: Uint32Arrays endianness depends on the underlying system, so for interoperability, conversions between Uint8Array and Uint32Arrays\n// need to be manually handled\n\n// 64-bit unsigned addition (little endian, in place)\n// Sets a[i,i+1] += b[j,j+1]\n// `a` and `b` must be Uint32Array(2)\nfunction ADD64 (a, i, b, j) {\n a[i] += b[j];\n a[i+1] += b[j+1] + (a[i] < b[j]); // add carry\n}\n\n// Increment 64-bit little-endian unsigned value by `c` (in place)\n// `a` must be Uint32Array(2)\nfunction INC64 (a, c) {\n a[0] += c;\n a[1] += (a[0] < c);\n}\n\n// G Mixing function\n// The ROTRs are inlined for speed\nfunction G (v, m, a, b, c, d, ix, iy) {\n ADD64(v, a, v, b) // v[a,a+1] += v[b,b+1]\n ADD64(v, a, m, ix) // v[a, a+1] += x ... x0\n\n // v[d,d+1] = (v[d,d+1] xor v[a,a+1]) rotated to the right by 32 bits\n let xor0 = v[d] ^ v[a]\n let xor1 = v[d + 1] ^ v[a + 1]\n v[d] = xor1\n v[d + 1] = xor0\n\n ADD64(v, c, v, d)\n\n // v[b,b+1] = (v[b,b+1] xor v[c,c+1]) rotated right by 24 bits\n xor0 = v[b] ^ v[c]\n xor1 = v[b + 1] ^ v[c + 1]\n v[b] = (xor0 >>> 24) ^ (xor1 << 8)\n v[b + 1] = (xor1 >>> 24) ^ (xor0 << 8)\n\n ADD64(v, a, v, b)\n ADD64(v, a, m, iy)\n\n // v[d,d+1] = (v[d,d+1] xor v[a,a+1]) rotated right by 16 bits\n xor0 = v[d] ^ v[a]\n xor1 = v[d + 1] ^ v[a + 1]\n v[d] = (xor0 >>> 16) ^ (xor1 << 16)\n v[d + 1] = (xor1 >>> 16) ^ (xor0 << 16)\n\n ADD64(v, c, v, d)\n\n // v[b,b+1] = (v[b,b+1] xor v[c,c+1]) rotated right by 63 bits\n xor0 = v[b] ^ v[c]\n xor1 = v[b + 1] ^ v[c + 1]\n v[b] = (xor1 >>> 31) ^ (xor0 << 1)\n v[b + 1] = (xor0 >>> 31) ^ (xor1 << 1)\n}\n\n// Initialization Vector\nconst BLAKE2B_IV32 = new Uint32Array([\n 0xF3BCC908, 0x6A09E667, 0x84CAA73B, 0xBB67AE85,\n 0xFE94F82B, 0x3C6EF372, 0x5F1D36F1, 0xA54FF53A,\n 0xADE682D1, 0x510E527F, 0x2B3E6C1F, 0x9B05688C,\n 0xFB41BD6B, 0x1F83D9AB, 0x137E2179, 0x5BE0CD19\n])\n\n// These are offsets into a Uint64 buffer.\n// Multiply them all by 2 to make them offsets into a Uint32 buffer\nconst SIGMA = new Uint8Array([\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3,\n 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4,\n 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8,\n 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13,\n 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9,\n 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11,\n 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10,\n 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5,\n 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0,\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3\n].map(x => x * 2))\n\n// Compression function. 'last' flag indicates last block.\n// Note: we're representing 16 uint64s as 32 uint32s\nfunction compress(S, last) {\n const v = new Uint32Array(32)\n const m = new Uint32Array(S.b.buffer, S.b.byteOffset, 32)\n\n // init work variables\n for (let i = 0; i < 16; i++) {\n v[i] = S.h[i]\n v[i + 16] = BLAKE2B_IV32[i]\n }\n\n // low 64 bits of offset\n v[24] ^= S.t0[0]\n v[25] ^= S.t0[1]\n // high 64 bits not supported (`t1`), offset may not be higher than 2**53-1\n\n // if last block\n const f0 = last ? 0xFFFFFFFF : 0;\n v[28] ^= f0;\n v[29] ^= f0;\n\n // twelve rounds of mixing\n for (let i = 0; i < 12; i++) {\n // ROUND(r)\n const i16 = i << 4;\n G(v, m, 0, 8, 16, 24, SIGMA[i16 + 0], SIGMA[i16 + 1])\n G(v, m, 2, 10, 18, 26, SIGMA[i16 + 2], SIGMA[i16 + 3])\n G(v, m, 4, 12, 20, 28, SIGMA[i16 + 4], SIGMA[i16 + 5])\n G(v, m, 6, 14, 22, 30, SIGMA[i16 + 6], SIGMA[i16 + 7])\n G(v, m, 0, 10, 20, 30, SIGMA[i16 + 8], SIGMA[i16 + 9])\n G(v, m, 2, 12, 22, 24, SIGMA[i16 + 10], SIGMA[i16 + 11])\n G(v, m, 4, 14, 16, 26, SIGMA[i16 + 12], SIGMA[i16 + 13])\n G(v, m, 6, 8, 18, 28, SIGMA[i16 + 14], SIGMA[i16 + 15])\n }\n\n for (let i = 0; i < 16; i++) {\n S.h[i] ^= v[i] ^ v[i + 16]\n }\n}\n\n// Creates a BLAKE2b hashing context\n// Requires an output length between 1 and 64 bytes\n// Takes an optional Uint8Array key\nclass Blake2b {\n constructor(outlen, key, salt, personal) {\n const params = new Uint8Array(64)\n // 0: outlen, keylen, fanout, depth\n // 4: leaf length, sequential mode\n // 8: node offset\n // 12: node offset\n // 16: node depth, inner length, rfu\n // 20: rfu\n // 24: rfu\n // 28: rfu\n // 32: salt\n // 36: salt\n // 40: salt\n // 44: salt\n // 48: personal\n // 52: personal\n // 56: personal\n // 60: personal\n\n // init internal state\n this.S = {\n b: new Uint8Array(BLOCKBYTES),\n h: new Uint32Array(OUTBYTES_MAX / 4),\n t0: new Uint32Array(2), // input counter `t`, lower 64-bits only\n c: 0, // `fill`, pointer within buffer, up to `BLOCKBYTES`\n outlen // output length in bytes\n }\n\n // init parameter block\n params[0] = outlen\n if (key) params[1] = key.length\n params[2] = 1 // fanout\n params[3] = 1 // depth\n if (salt) params.set(salt, 32)\n if (personal) params.set(personal, 48)\n const params32 = new Uint32Array(params.buffer, params.byteOffset, params.length / Uint32Array.BYTES_PER_ELEMENT);\n\n // initialize hash state\n for (let i = 0; i < 16; i++) {\n this.S.h[i] = BLAKE2B_IV32[i] ^ params32[i];\n }\n\n // key the hash, if applicable\n if (key) {\n const block = new Uint8Array(BLOCKBYTES)\n block.set(key)\n this.update(block)\n }\n }\n\n // Updates a BLAKE2b streaming hash\n // Requires Uint8Array (byte array)\n update(input) {\n if (!(input instanceof Uint8Array)) throw new Error('Input must be Uint8Array or Buffer')\n // for (let i = 0; i < input.length; i++) {\n // if (this.S.c === BLOCKBYTES) { // buffer full\n // INC64(this.S.t0, this.S.c) // add counters\n // compress(this.S, false)\n // this.S.c = 0 // empty buffer\n // }\n // this.S.b[this.S.c++] = input[i]\n // }\n let i = 0\n while(i < input.length) {\n if (this.S.c === BLOCKBYTES) { // buffer full\n INC64(this.S.t0, this.S.c) // add counters\n compress(this.S, false)\n this.S.c = 0 // empty buffer\n }\n let left = BLOCKBYTES - this.S.c\n this.S.b.set(input.subarray(i, i + left), this.S.c) // end index can be out of bounds\n const fill = Math.min(left, input.length - i)\n this.S.c += fill\n i += fill\n }\n return this\n }\n\n /**\n * Return a BLAKE2b hash, either filling the given Uint8Array or allocating a new one\n * @param {Uint8Array} [prealloc] - optional preallocated buffer\n * @returns {ArrayBuffer} message digest\n */\n digest(prealloc) {\n INC64(this.S.t0, this.S.c) // mark last block offset\n\n // final block, padded\n this.S.b.fill(0, this.S.c);\n this.S.c = BLOCKBYTES;\n compress(this.S, true)\n\n const out = prealloc || new Uint8Array(this.S.outlen);\n for (let i = 0; i < this.S.outlen; i++) {\n // must be loaded individually since default Uint32 endianness is platform dependant\n out[i] = this.S.h[i >> 2] >> (8 * (i & 3))\n }\n this.S.h = null; // prevent calling `update` after `digest`\n return out.buffer;\n }\n}\n\n\nexport default function createHash(outlen, key, salt, personal) {\n if (outlen > OUTBYTES_MAX) throw new Error(`outlen must be at most ${OUTBYTES_MAX} (given: ${outlen})`)\n if (key) {\n if (!(key instanceof Uint8Array)) throw new Error('key must be Uint8Array or Buffer')\n if (key.length > KEYBYTES_MAX) throw new Error(`key size must be at most ${KEYBYTES_MAX} (given: ${key.length})`)\n }\n if (salt) {\n if (!(salt instanceof Uint8Array)) throw new Error('salt must be Uint8Array or Buffer')\n if (salt.length !== SALTBYTES) throw new Error(`salt must be exactly ${SALTBYTES} (given: ${salt.length}`)\n }\n if (personal) {\n if (!(personal instanceof Uint8Array)) throw new Error('personal must be Uint8Array or Buffer')\n if (personal.length !== PERSONALBYTES) throw new Error(`salt must be exactly ${PERSONALBYTES} (given: ${personal.length}`)\n }\n\n return new Blake2b(outlen, key, salt, personal)\n}\n\nconst OUTBYTES_MAX = 64;\nconst KEYBYTES_MAX = 64;\nconst SALTBYTES = 16;\nconst PERSONALBYTES = 16;\nconst BLOCKBYTES = 128;\n\n","import blake2b from \"./blake2b.js\"\nconst TYPE = 2; // Argon2id\nconst VERSION = 0x13;\nconst TAGBYTES_MAX = 0xFFFFFFFF; // Math.pow(2, 32) - 1;\nconst TAGBYTES_MIN = 4; // Math.pow(2, 32) - 1;\nconst SALTBYTES_MAX = 0xFFFFFFFF; // Math.pow(2, 32) - 1;\nconst SALTBYTES_MIN = 8;\nconst passwordBYTES_MAX = 0xFFFFFFFF;// Math.pow(2, 32) - 1;\nconst passwordBYTES_MIN = 8;\nconst MEMBYTES_MAX = 0xFFFFFFFF;// Math.pow(2, 32) - 1;\nconst ADBYTES_MAX = 0xFFFFFFFF; // Math.pow(2, 32) - 1; // associated data (optional)\nconst SECRETBYTES_MAX = 32; // key (optional)\n\nconst ARGON2_BLOCK_SIZE = 1024;\nconst ARGON2_PREHASH_DIGEST_LENGTH = 64;\n\nconst isLittleEndian = new Uint8Array(new Uint16Array([0xabcd]).buffer)[0] === 0xcd;\n\n// store n as a little-endian 32-bit Uint8Array inside buf (at buf[i:i+3])\nfunction LE32(buf, n, i) {\n buf[i+0] = n;\n buf[i+1] = n >> 8;\n buf[i+2] = n >> 16;\n buf[i+3] = n >> 24;\n return buf;\n}\n\n/**\n * Store n as a 64-bit LE number in the given buffer (from buf[i] to buf[i+7])\n * @param {Uint8Array} buf\n * @param {Number} n\n * @param {Number} i\n */\nfunction LE64(buf, n, i) {\n if (n > Number.MAX_SAFE_INTEGER) throw new Error(\"LE64: large numbers unsupported\");\n // ECMAScript standard has engines convert numbers to 32-bit integers for bitwise operations\n // shifting by 32 or more bits is not supported (https://stackoverflow.com/questions/6729122/javascript-bit-shift-number-wraps)\n // so we manually extract each byte\n let remainder = n;\n for (let offset = i; offset < i+7; offset++) { // last byte can be ignored as it would overflow MAX_SAFE_INTEGER\n buf[offset] = remainder; // implicit & 0xff\n remainder = (remainder - buf[offset]) / 256;\n }\n return buf;\n}\n\n/**\n * Variable-Length Hash Function H'\n * @param {Number} outlen - T\n * @param {Uint8Array} X - value to hash\n * @param {Uint8Array} res - output buffer, of length `outlength` or larger\n */\nfunction H_(outlen, X, res) {\n const V = new Uint8Array(64); // no need to keep around all V_i\n\n const V1_in = new Uint8Array(4 + X.length);\n LE32(V1_in, outlen, 0);\n V1_in.set(X, 4);\n if (outlen <= 64) {\n // H'^T(A) = H^T(LE32(T)||A)\n blake2b(outlen).update(V1_in).digest(res);\n return res\n }\n\n const r = Math.ceil(outlen / 32) - 2;\n\n // Let V_i be a 64-byte block and W_i be its first 32 bytes.\n // V_1 = H^(64)(LE32(T)||A)\n // V_2 = H^(64)(V_1)\n // ...\n // V_r = H^(64)(V_{r-1})\n // V_{r+1} = H^(T-32*r)(V_{r})\n // H'^T(X) = W_1 || W_2 || ... || W_r || V_{r+1}\n for (let i = 0; i < r; i++) {\n blake2b(64).update(i === 0 ? V1_in : V).digest(V);\n // store W_i in result buffer already\n res.set(V.subarray(0, 32), i*32)\n }\n // V_{r+1}\n const V_r1 = new Uint8Array(blake2b(outlen - 32*r).update(V).digest());\n res.set(V_r1, r*32);\n\n return res;\n}\n\n// compute buf = xs ^ ys\nfunction XOR(wasmContext, buf, xs, ys) {\n wasmContext.fn.XOR(\n buf.byteOffset,\n xs.byteOffset,\n ys.byteOffset,\n );\n return buf\n}\n\n/**\n * @param {Uint8Array} X (read-only)\n * @param {Uint8Array} Y (read-only)\n * @param {Uint8Array} R - output buffer\n * @returns\n */\nfunction G(wasmContext, X, Y, R) {\n wasmContext.fn.G(\n X.byteOffset,\n Y.byteOffset,\n R.byteOffset,\n wasmContext.refs.gZ.byteOffset\n );\n return R;\n}\n\nfunction G2(wasmContext, X, Y, R) {\n wasmContext.fn.G2(\n X.byteOffset,\n Y.byteOffset,\n R.byteOffset,\n wasmContext.refs.gZ.byteOffset\n );\n return R;\n}\n\n// Generator for data-independent J1, J2. Each `next()` invocation returns a new pair of values.\nfunction* makePRNG(wasmContext, pass, lane, slice, m_, totalPasses, segmentLength, segmentOffset) {\n // For each segment, we do the following. First, we compute the value Z as:\n // Z= ( LE64(r) || LE64(l) || LE64(sl) || LE64(m') || LE64(t) || LE64(y) )\n wasmContext.refs.prngTmp.fill(0);\n const Z = wasmContext.refs.prngTmp.subarray(0, 6 * 8);\n LE64(Z, pass, 0);\n LE64(Z, lane, 8);\n LE64(Z, slice, 16);\n LE64(Z, m_, 24);\n LE64(Z, totalPasses, 32);\n LE64(Z, TYPE, 40);\n\n // Then we compute q/(128*SL) 1024-byte values\n // G( ZERO(1024),\n // G( ZERO(1024), Z || LE64(1) || ZERO(968) ) ),\n // ...,\n // G( ZERO(1024),\n // G( ZERO(1024), Z || LE64(q/(128*SL)) || ZERO(968) )),\n for(let i = 1; i <= segmentLength; i++) {\n // tmp.set(Z); // no need to re-copy\n LE64(wasmContext.refs.prngTmp, i, Z.length); // tmp.set(ZER0968) not necessary, memory already zeroed\n const g2 = G2(wasmContext, wasmContext.refs.ZERO1024, wasmContext.refs.prngTmp, wasmContext.refs.prngR );\n\n // each invocation of G^2 outputs 1024 bytes that are to be partitioned into 8-bytes values, take as X1 || X2\n // NB: the first generated pair must be used for the first block of the segment, and so on.\n // Hence, if some blocks are skipped (e.g. during the first pass), the corresponding J1J2 are discarded based on the given segmentOffset.\n for(let k = i === 1 ? segmentOffset*8 : 0; k < g2.length; k += 8) {\n yield g2.subarray(k, k+8);\n }\n }\n return [];\n}\n\nfunction validateParams({ type, version, tagLength, password, salt, ad, secret, parallelism, memorySize, passes }) {\n const assertLength = (name, value, min, max) => {\n if (value < min || value > max) { throw new Error(`${name} size should be between ${min} and ${max} bytes`); }\n }\n\n if (type !== TYPE || version !== VERSION) throw new Error('Unsupported type or version');\n assertLength('password', password, passwordBYTES_MIN, passwordBYTES_MAX);\n assertLength('salt', salt, SALTBYTES_MIN, SALTBYTES_MAX);\n assertLength('tag', tagLength, TAGBYTES_MIN, TAGBYTES_MAX);\n assertLength('memory', memorySize, 8*parallelism, MEMBYTES_MAX);\n // optional fields\n ad && assertLength('associated data', ad, 0, ADBYTES_MAX);\n secret && assertLength('secret', secret, 0, SECRETBYTES_MAX);\n\n return { type, version, tagLength, password, salt, ad, secret, lanes: parallelism, memorySize, passes };\n}\n\nconst KB = 1024;\nconst WASM_PAGE_SIZE = 64 * KB;\n\nexport default function argon2id(params, { memory, instance: wasmInstance }) {\n if (!isLittleEndian) throw new Error('BigEndian system not supported'); // optmisations assume LE system\n\n const ctx = validateParams({ type: TYPE, version: VERSION, ...params });\n\n const { G:wasmG, G2:wasmG2, xor:wasmXOR, getLZ:wasmLZ } = wasmInstance.exports;\n const wasmRefs = {};\n const wasmFn = {};\n wasmFn.G = wasmG;\n wasmFn.G2 = wasmG2;\n wasmFn.XOR = wasmXOR;\n\n // The actual number of blocks is m', which is m rounded down to the nearest multiple of 4*p.\n const m_ = 4 * ctx.lanes * Math.floor(ctx.memorySize / (4 * ctx.lanes));\n const requiredMemory = m_ * ARGON2_BLOCK_SIZE + 10 * KB; // Additional KBs for utility references\n if (memory.buffer.byteLength < requiredMemory) {\n const missing = Math.ceil((requiredMemory - memory.buffer.byteLength) / WASM_PAGE_SIZE)\n // If enough memory is available, the `memory.buffer` is internally detached and the reference updated.\n // Otherwise, the operation fails, and the original memory can still be used.\n memory.grow(missing)\n }\n\n let offset = 0;\n // Init wasm memory needed in other functions\n wasmRefs.gZ = new Uint8Array(memory.buffer, offset, ARGON2_BLOCK_SIZE); offset+= wasmRefs.gZ.length;\n wasmRefs.prngR = new Uint8Array(memory.buffer, offset, ARGON2_BLOCK_SIZE); offset+=wasmRefs.prngR.length;\n wasmRefs.prngTmp = new Uint8Array(memory.buffer, offset, ARGON2_BLOCK_SIZE); offset+=wasmRefs.prngTmp.length;\n wasmRefs.ZERO1024 = new Uint8Array(memory.buffer, offset, 1024); offset+=wasmRefs.ZERO1024.length;\n // Init wasm memory needed locally\n const lz = new Uint32Array(memory.buffer, offset, 2); offset+=lz.length * Uint32Array.BYTES_PER_ELEMENT;\n const wasmContext = { fn: wasmFn, refs: wasmRefs };\n const newBlock = new Uint8Array(memory.buffer, offset, ARGON2_BLOCK_SIZE); offset+=newBlock.length;\n const blockMemory = new Uint8Array(memory.buffer, offset, ctx.memorySize * ARGON2_BLOCK_SIZE);\n const allocatedMemory = new Uint8Array(memory.buffer, 0, offset);\n\n // 1. Establish H_0\n const H0 = getH0(ctx);\n\n // 2. Allocate the memory as m' 1024-byte blocks\n // For p lanes, the memory is organized in a matrix B[i][j] of blocks with p rows (lanes) and q = m' / p columns.\n const q = m_ / ctx.lanes;\n const B = new Array(ctx.lanes).fill(null).map(() => new Array(q));\n const initBlock = (i, j) => {\n B[i][j] = blockMemory.subarray(i*q*1024 + j*1024, (i*q*1024 + j*1024) + ARGON2_BLOCK_SIZE);\n return B[i][j];\n }\n\n for (let i = 0; i < ctx.lanes; i++) {\n // const LEi = LE0; // since p = 1 for us\n const tmp = new Uint8Array(H0.length + 8);\n // 3. Compute B[i][0] for all i ranging from (and including) 0 to (not including) p\n // B[i][0] = H'^(1024)(H_0 || LE32(0) || LE32(i))\n tmp.set(H0); LE32(tmp, 0, H0.length); LE32(tmp, i, H0.length + 4);\n H_(ARGON2_BLOCK_SIZE, tmp, initBlock(i, 0));\n // 4. Compute B[i][1] for all i ranging from (and including) 0 to (not including) p\n // B[i][1] = H'^(1024)(H_0 || LE32(1) || LE32(i))\n LE32(tmp, 1, H0.length);\n H_(ARGON2_BLOCK_SIZE, tmp, initBlock(i, 1));\n }\n\n // 5. Compute B[i][j] for all i ranging from (and including) 0 to (not including) p and for all j ranging from (and including) 2\n // to (not including) q. The computation MUST proceed slicewise (Section 3.4) : first, blocks from slice 0 are computed for all lanes\n // (in an arbitrary order of lanes), then blocks from slice 1 are computed, etc.\n const SL = 4; // vertical slices\n const segmentLength = q / SL;\n for (let pass = 0; pass < ctx.passes; pass++) {\n // The intersection of a slice and a lane is called a segment, which has a length of q/SL. Segments of the same slice can be computed in parallel\n for (let sl = 0; sl < SL; sl++) {\n const isDataIndependent = pass === 0 && sl <= 1;\n for (let i = 0; i < ctx.lanes; i++) { // lane\n // On the first slice of the first pass, blocks 0 and 1 are already filled\n let segmentOffset = sl === 0 && pass === 0 ? 2 : 0;\n // no need to generate all J1J2s, use iterator/generator that creates the value on the fly (to save memory)\n const PRNG = isDataIndependent ? makePRNG(wasmContext, pass, i, sl, m_, ctx.passes, segmentLength, segmentOffset) : null;\n for (segmentOffset; segmentOffset < segmentLength; segmentOffset++) {\n const j = sl * segmentLength + segmentOffset;\n const prevBlock = j > 0 ? B[i][j-1] : B[i][q-1]; // B[i][(j-1) mod q]\n\n // we can assume the PRNG is never done\n const J1J2 = isDataIndependent ? PRNG.next().value : prevBlock; // .subarray(0, 8) not required since we only pass the byteOffset to wasm\n // The block indices l and z are determined for each i, j differently for Argon2d, Argon2i, and Argon2id.\n wasmLZ(lz.byteOffset, J1J2.byteOffset, i, ctx.lanes, pass, sl, segmentOffset, SL, segmentLength)\n const l = lz[0]; const z = lz[1];\n // for (let i = 0; i < p; i++ )\n // B[i][j] = G(B[i][j-1], B[l][z])\n // The block indices l and z are determined for each i, j differently for Argon2d, Argon2i, and Argon2id.\n if (pass === 0) initBlock(i, j);\n G(wasmContext, prevBlock, B[l][z], pass > 0 ? newBlock : B[i][j]);\n\n // 6. If the number of passes t is larger than 1, we repeat step 5. However, blocks are computed differently as the old value is XORed with the new one\n if (pass > 0) XOR(wasmContext, B[i][j], newBlock, B[i][j])\n }\n }\n }\n }\n\n // 7. After t steps have been iterated, the final block C is computed as the XOR of the last column:\n // C = B[0][q-1] XOR B[1][q-1] XOR ... XOR B[p-1][q-1]\n const C = B[0][q-1];\n for(let i = 1; i < ctx.lanes; i++) {\n XOR(wasmContext, C, C, B[i][q-1])\n }\n\n const tag = H_(ctx.tagLength, C, new Uint8Array(ctx.tagLength));\n // clear memory since the module might be cached\n allocatedMemory.fill(0) // clear sensitive contents\n memory.grow(0) // allow deallocation\n // 8. The output tag is computed as H'^T(C).\n return tag;\n\n}\n\nfunction getH0(ctx) {\n const H = blake2b(ARGON2_PREHASH_DIGEST_LENGTH);\n const ZERO32 = new Uint8Array(4);\n const params = new Uint8Array(24);\n LE32(params, ctx.lanes, 0);\n LE32(params, ctx.tagLength, 4);\n LE32(params, ctx.memorySize, 8);\n LE32(params, ctx.passes, 12);\n LE32(params, ctx.version, 16);\n LE32(params, ctx.type, 20);\n\n const toHash = [params];\n if (ctx.password) {\n toHash.push(LE32(new Uint8Array(4), ctx.password.length, 0))\n toHash.push(ctx.password)\n } else {\n toHash.push(ZERO32) // context.password.length\n }\n\n if (ctx.salt) {\n toHash.push(LE32(new Uint8Array(4), ctx.salt.length, 0))\n toHash.push(ctx.salt)\n } else {\n toHash.push(ZERO32) // context.salt.length\n }\n\n if (ctx.secret) {\n toHash.push(LE32(new Uint8Array(4), ctx.secret.length, 0))\n toHash.push(ctx.secret)\n // todo clear secret?\n } else {\n toHash.push(ZERO32) // context.secret.length\n }\n\n if (ctx.ad) {\n toHash.push(LE32(new Uint8Array(4), ctx.ad.length, 0))\n toHash.push(ctx.ad)\n } else {\n toHash.push(ZERO32) // context.ad.length\n }\n H.update(concatArrays(toHash))\n\n const outputBuffer = H.digest();\n return new Uint8Array(outputBuffer);\n}\n\nfunction concatArrays(arrays) {\n if (arrays.length === 1) return arrays[0];\n\n let totalLength = 0;\n for (let i = 0; i < arrays.length; i++) {\n if (!(arrays[i] instanceof Uint8Array)) {\n throw new Error('concatArrays: Data must be in the form of a Uint8Array');\n }\n\n totalLength += arrays[i].length;\n }\n\n const result = new Uint8Array(totalLength);\n let pos = 0;\n arrays.forEach((element) => {\n result.set(element, pos);\n pos += element.length;\n });\n\n return result;\n}\n","import argon2id from \"./argon2id.js\";\n\nlet isSIMDSupported;\nasync function wasmLoader(memory, getSIMD, getNonSIMD) {\n const importObject = { env: { memory } };\n if (isSIMDSupported === undefined) {\n try {\n const loaded = await getSIMD(importObject);\n isSIMDSupported = true;\n return loaded;\n } catch(e) {\n isSIMDSupported = false;\n }\n }\n\n const loader = isSIMDSupported ? getSIMD : getNonSIMD;\n return loader(importObject);\n}\n\nexport default async function setupWasm(getSIMD, getNonSIMD) {\n const memory = new WebAssembly.Memory({\n // in pages of 64KiB each\n // these values need to be compatible with those declared when building in `build-wasm`\n initial: 1040, // 65MB\n maximum: 65536, // 4GB\n });\n const wasmModule = await wasmLoader(memory, getSIMD, getNonSIMD);\n\n /**\n * Argon2id hash function\n * @callback computeHash\n * @param {Object} params\n * @param {Uint8Array} params.password - password\n * @param {Uint8Array} params.salt - salt\n * @param {Integer} params.parallelism\n * @param {Integer} params.passes\n * @param {Integer} params.memorySize - in kibibytes\n * @param {Integer} params.tagLength - output tag length\n * @param {Uint8Array} [params.ad] - associated data (optional)\n * @param {Uint8Array} [params.secret] - secret data (optional)\n * @return {Uint8Array} argon2id hash\n */\n const computeHash = (params) => argon2id(params, { instance: wasmModule.instance, memory });\n\n return computeHash;\n}\n","import setupWasm from './lib/setup.js';\nimport wasmSIMD from './dist/simd.wasm';\nimport wasmNonSIMD from './dist/no-simd.wasm';\n\nconst loadWasm = async () => setupWasm(\n (instanceObject) => wasmSIMD(instanceObject),\n (instanceObject) => wasmNonSIMD(instanceObject),\n);\n\nexport default loadWasm;\n"],"names":["ADD64","a","i","b","j","INC64","c","G","v","m","d","ix","iy","xor0","xor1","BLAKE2B_IV32","Uint32Array","SIGMA","Uint8Array","map","x","compress","S","last","buffer","byteOffset","h","t0","f0","i16","Blake2b","constructor","outlen","key","salt","personal","params","this","BLOCKBYTES","OUTBYTES_MAX","length","set","params32","BYTES_PER_ELEMENT","block","update","input","Error","left","subarray","fill","Math","min","digest","prealloc","out","createHash","KEYBYTES_MAX","SALTBYTES","PERSONALBYTES","TYPE","VERSION","TAGBYTES_MAX","TAGBYTES_MIN","SALTBYTES_MAX","SALTBYTES_MIN","passwordBYTES_MAX","passwordBYTES_MIN","MEMBYTES_MAX","ADBYTES_MAX","SECRETBYTES_MAX","ARGON2_BLOCK_SIZE","ARGON2_PREHASH_DIGEST_LENGTH","isLittleEndian","Uint16Array","LE32","buf","n","LE64","Number","MAX_SAFE_INTEGER","remainder","offset","H_","X","res","V","V1_in","blake2b","r","ceil","V_r1","XOR","wasmContext","xs","ys","fn","Y","R","refs","gZ","G2","makePRNG","pass","lane","slice","m_","totalPasses","segmentLength","segmentOffset","prngTmp","Z","g2","ZERO1024","prngR","k","KB","WASM_PAGE_SIZE","argon2id","memory","instance","wasmInstance","ctx","type","version","tagLength","password","ad","secret","parallelism","memorySize","passes","assertLength","name","value","max","lanes","validateParams","wasmG","wasmG2","xor","wasmXOR","getLZ","wasmLZ","exports","wasmRefs","wasmFn","floor","requiredMemory","byteLength","missing","grow","lz","newBlock","blockMemory","allocatedMemory","H0","H","ZERO32","toHash","push","arrays","totalLength","result","pos","forEach","element","concatArrays","outputBuffer","getH0","q","B","Array","initBlock","tmp","sl","isDataIndependent","PRNG","prevBlock","J1J2","next","l","z","C","tag","isSIMDSupported","async","setupWasm","getSIMD","getNonSIMD","WebAssembly","Memory","initial","maximum","wasmModule","importObject","env","undefined","loaded","e","wasmLoader","loadWasm","instanceObject"],"mappings":";6GAUA,SAASA,EAAOC,EAAGC,EAAGC,EAAGC,GACvBH,EAAEC,IAAMC,EAAEC,GACVH,EAAEC,EAAE,IAAMC,EAAEC,EAAE,IAAMH,EAAEC,GAAKC,EAAEC,GAC/B,CAIA,SAASC,EAAOJ,EAAGK,GACjBL,EAAE,IAAMK,EACRL,EAAE,IAAOA,EAAE,GAAKK,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AGE,GAC7BG,EAAEsF,EAAaqF,EAAWP,EAAEU,GAAGC,GAAI/E,EAAO,EAAIkD,EAAWkB,EAAEzK,GAAGE,IAG1DmG,EAAO,GAAGX,EAAIC,EAAa8E,EAAEzK,GAAGE,GAAIqJ,EAAUkB,EAAEzK,GAAGE,GACxD,CACF,CACF,CAKH,MAAMmL,EAAIZ,EAAE,GAAGD,EAAE,GACjB,IAAI,IAAIxK,EAAI,EAAGA,EAAIwH,EAAIc,MAAOtI,IAC5B0F,EAAIC,EAAa0F,EAAGA,EAAGZ,EAAEzK,GAAGwK,EAAE,IAGhC,MAAMc,EAAMrG,EAAGuC,EAAIG,UAAW0D,EAAG,IAAIrK,WAAWwG,EAAIG,YAKpD,OAHA8B,EAAgBzG,KAAK,GACrBqE,EAAOgC,KAAK,GAELiC,CAET,CC3RA,IAAIC,EAiBWC,eAAeC,EAAUC,EAASC,GAC/C,MAAMtE,EAAS,IAAIuE,YAAYC,OAAO,CAGpCC,QAAS,KACTC,QAAS,QAELC,QAvBRR,eAA0BnE,EAAQqE,EAASC,GACzC,MAAMM,EAAe,CAAEC,IAAK,CAAE7E,WAC9B,QAAwB8E,IAApBZ,EACF,IACE,MAAMa,QAAeV,EAAQO,GAE7B,OADAV,GAAkB,EACXa,CACR,CAAC,MAAMC,GACNd,GAAkB,CACnB,CAIH,OADeA,EAAkBG,EAAUC,GAC7BM,EAChB,CAS2BK,CAAWjF,EAAQqE,EAASC,GAkBrD,OAFqBzJ,GAAWkF,EAASlF,EAAQ,CAAEoF,SAAU0E,EAAW1E,SAAUD,UAGpF,maCzCK,MAACkF,EAAWf,SAAYC,GAC1Be,+wLAA4BA,KAC5BA,2yJAA+BA","x_google_ignoreList":[0,1,2,3]}
@@ -1,4 +1,4 @@
1
- /*! OpenPGP.js v6.0.0-alpha.0 - 2023-12-12 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
1
+ /*! OpenPGP.js v6.0.0-alpha.1.patch.0 - 2024-03-01 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
2
2
  const globalThis = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
3
3
 
4
4
  // Adapted from the reference implementation in RFC7693
@@ -1,3 +1,3 @@
1
- /*! OpenPGP.js v6.0.0-alpha.0 - 2023-12-12 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
2
- "undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;import{B as e}from"./bn.min.mjs";import{B as t}from"./interface.min.mjs";class i extends t{constructor(t){if(super(),void 0===t)throw Error("Invalid BigInteger input");const i=("string"==typeof t||t instanceof String)&&t.startsWith("0x");this.value=i?new e(t.substring(2),16):new e(t)}clone(){return new i(this.value.clone())}iinc(){return this.value.iadd(new e(1)),this}inc(){return this.clone().iinc()}idec(){return this.value.isub(new e(1)),this}dec(){return this.clone().idec()}iadd(e){return this.value.iadd(e.value),this}add(e){return this.clone().iadd(e)}isub(e){return this.value.isub(e.value),this}sub(e){return this.clone().isub(e)}imul(e){return this.value.imul(e.value),this}mul(e){return this.clone().imul(e)}imod(e){return this.value=this.value.umod(e.value),this}mod(e){return this.clone().imod(e)}modExp(t,i){const r=i.isEven()?e.red(i.value):e.mont(i.value),n=this.clone();return n.value=n.value.toRed(r).redPow(t.value).fromRed(),n}modInv(e){if(!this.gcd(e).isOne())throw Error("Inverse does not exist");return new i(this.value.invm(e.value))}idiv(e){return this.value=this.value.div(e.value),this}div(e){return this.clone().idiv(e)}gcd(e){return new i(this.value.gcd(e.value))}ileftShift(e){return e.isNegative()?this.irightShift(e.negate()):(this.value.ishln(e.value.toNumber()),this)}leftShift(e){return this.clone().ileftShift(e)}irightShift(e){return e.isNegative()?this.ileftShift(e.negate()):(this.value.ishrn(e.value.toNumber()),this)}rightShift(e){return this.clone().irightShift(e)}ixor(e){return this.value.ixor(e.value),this}xor(e){return this.clone().ixor(e)}ibitwiseAnd(e){return this.value.iand(e.value),this}bitwiseAnd(e){return this.clone().ibitwiseAnd(e)}ibitwiseOr(e){return this.value.ior(e.value),this}equal(e){return this.value.eq(e.value)}lt(e){return this.value.lt(e.value)}lte(e){return this.value.lte(e.value)}gt(e){return this.value.gt(e.value)}gte(e){return this.value.gte(e.value)}isZero(){return this.value.isZero()}isOne(){return this.value.eq(new e(1))}isNegative(){return this.value.isNeg()}isEven(){return this.value.isEven()}abs(){const e=this.clone();return e.value=e.value.abs(),e}negate(){const e=this.clone();return e.value.ineg(),e}toString(){return this.value.toString()}toNumber(){return this.value.toNumber()}getBit(e){return this.value.testn(e)?1:0}bitLength(){return this.value.bitLength()}byteLength(){return this.value.byteLength()}toUint8Array(e="be",t){return this.value.toArrayLike(Uint8Array,e,t)}}export{i as default};
1
+ /*! OpenPGP.js v6.0.0-alpha.1.patch.0 - 2024-03-01 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
2
+ const t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};import{B as i}from"./interface.min.mjs";function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e={exports:{}};!function(t,i){function r(t,i){if(!t)throw Error(i||"Assertion failed")}function e(t,i){t.super_=i;var r=function(){};r.prototype=i.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,i,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==i&&"be"!==i||(r=i,i=10),this._init(t||0,i||10,r||"be"))}var h;"object"==typeof t?t.exports=n:i.BN=n,n.BN=n,n.wordSize=26;try{h="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require("buffer").Buffer}catch(t){}function s(t,i){var r=t.charCodeAt(i);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function o(t,i,r){var e=s(t,r);return r-1>=i&&(e|=s(t,r-1)<<4),e}function u(t,i,r,e){for(var n=0,h=Math.min(t.length,r),s=i;s<h;s++){var o=t.charCodeAt(s)-48;n*=e,n+=o>=49?o-49+10:o>=17?o-17+10:o}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,i){return t.cmp(i)>0?t:i},n.min=function(t,i){return t.cmp(i)<0?t:i},n.prototype._init=function(t,i,e){if("number"==typeof t)return this._initNumber(t,i,e);if("object"==typeof t)return this._initArray(t,i,e);"hex"===i&&(i=16),r(i===(0|i)&&i>=2&&i<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===i?this._parseHex(t,n,e):(this._parseBase(t,i,n),"le"===e&&this._initArray(this.toArray(),i,e)))},n.prototype._initNumber=function(t,i,e){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===e&&this._initArray(this.toArray(),i,e)},n.prototype._initArray=function(t,i,e){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var h,s,o=0;if("be"===e)for(n=t.length-1,h=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[h]|=s<<o&67108863,this.words[h+1]=s>>>26-o&67108863,(o+=24)>=26&&(o-=26,h++);else if("le"===e)for(n=0,h=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[h]|=s<<o&67108863,this.words[h+1]=s>>>26-o&67108863,(o+=24)>=26&&(o-=26,h++);return this.strip()},n.prototype._parseHex=function(t,i,r){this.length=Math.ceil((t.length-i)/6),this.words=Array(this.length);for(var e=0;e<this.length;e++)this.words[e]=0;var n,h=0,s=0;if("be"===r)for(e=t.length-1;e>=i;e-=2)n=o(t,i,e)<<h,this.words[s]|=67108863&n,h>=18?(h-=18,s+=1,this.words[s]|=n>>>26):h+=8;else for(e=(t.length-i)%2==0?i+1:i;e<t.length;e+=2)n=o(t,i,e)<<h,this.words[s]|=67108863&n,h>=18?(h-=18,s+=1,this.words[s]|=n>>>26):h+=8;this.strip()},n.prototype._parseBase=function(t,i,r){this.words=[0],this.length=1;for(var e=0,n=1;n<=67108863;n*=i)e++;e--,n=n/i|0;for(var h=t.length-r,s=h%e,o=Math.min(h,h-s)+r,a=0,l=r;l<o;l+=e)a=u(t,l,l+e,i),this.imuln(n),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(0!==s){var m=1;for(a=u(t,l,t.length,i),l=0;l<s;l++)m*=i;this.imuln(m),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}this.strip()},n.prototype.copy=function(t){t.words=Array(this.length);for(var i=0;i<this.length;i++)t.words[i]=this.words[i];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var a=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],m=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(t,i,r){r.negative=i.negative^t.negative;var e=t.length+i.length|0;r.length=e,e=e-1|0;var n=0|t.words[0],h=0|i.words[0],s=n*h,o=67108863&s,u=s/67108864|0;r.words[0]=o;for(var a=1;a<e;a++){for(var l=u>>>26,m=67108863&u,f=Math.min(a,i.length-1),d=Math.max(0,a-t.length+1);d<=f;d++){var p=a-d|0;l+=(s=(n=0|t.words[p])*(h=0|i.words[d])+m)/67108864|0,m=67108863&s}r.words[a]=0|m,u=0|l}return 0!==u?r.words[a]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,i){var e;if(i=0|i||1,16===(t=t||10)||"hex"===t){e="";for(var n=0,h=0,s=0;s<this.length;s++){var o=this.words[s],u=(16777215&(o<<n|h)).toString(16);e=0!=(h=o>>>24-n&16777215)||s!==this.length-1?a[6-u.length]+u+e:u+e,(n+=2)>=26&&(n-=26,s--)}for(0!==h&&(e=h.toString(16)+e);e.length%i!=0;)e="0"+e;return 0!==this.negative&&(e="-"+e),e}if(t===(0|t)&&t>=2&&t<=36){var f=l[t],d=m[t];e="";var p=this.clone();for(p.negative=0;!p.isZero();){var v=p.modn(d).toString(t);e=(p=p.idivn(d)).isZero()?v+e:a[f-v.length]+v+e}for(this.isZero()&&(e="0"+e);e.length%i!=0;)e="0"+e;return 0!==this.negative&&(e="-"+e),e}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,i){return r(void 0!==h),this.toArrayLike(h,t,i)},n.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},n.prototype.toArrayLike=function(t,i,e){var n=this.byteLength(),h=e||Math.max(1,n);r(n<=h,"byte array longer than desired length"),r(h>0,"Requested array length <= 0"),this.strip();var s,o,u="le"===i,a=new t(h),l=this.clone();if(u){for(o=0;!l.isZero();o++)s=l.andln(255),l.iushrn(8),a[o]=s;for(;o<h;o++)a[o]=0}else{for(o=0;o<h-n;o++)a[o]=0;for(o=0;!l.isZero();o++)s=l.andln(255),l.iushrn(8),a[h-o-1]=s}return a},n.prototype._countBits=Math.clz32?function(t){return 32-Math.clz32(t)}:function(t){var i=t,r=0;return i>=4096&&(r+=13,i>>>=13),i>=64&&(r+=7,i>>>=7),i>=8&&(r+=4,i>>>=4),i>=2&&(r+=2,i>>>=2),r+i},n.prototype._zeroBits=function(t){if(0===t)return 26;var i=t,r=0;return 0==(8191&i)&&(r+=13,i>>>=13),0==(127&i)&&(r+=7,i>>>=7),0==(15&i)&&(r+=4,i>>>=4),0==(3&i)&&(r+=2,i>>>=2),0==(1&i)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;i<this.length;i++){var r=this._zeroBits(this.words[i]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]|t.words[i];return this.strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var i;i=this.length>t.length?t:this;for(var r=0;r<i.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=i.length,this.strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var i,r;this.length>t.length?(i=this,r=t):(i=t,r=this);for(var e=0;e<r.length;e++)this.words[e]=i.words[e]^r.words[e];if(this!==i)for(;e<i.length;e++)this.words[e]=i.words[e];return this.length=i.length,this.strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),e=t%26;this._expand(i),e>0&&i--;for(var n=0;n<i;n++)this.words[n]=67108863&~this.words[n];return e>0&&(this.words[n]=~this.words[n]&67108863>>26-e),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,i){r("number"==typeof t&&t>=0);var e=t/26|0,n=t%26;return this._expand(e+1),this.words[e]=i?this.words[e]|1<<n:this.words[e]&~(1<<n),this.strip()},n.prototype.iadd=function(t){var i,r,e;if(0!==this.negative&&0===t.negative)return this.negative=0,i=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,i=this.isub(t),t.negative=1,i._normSign();this.length>t.length?(r=this,e=t):(r=t,e=this);for(var n=0,h=0;h<e.length;h++)i=(0|r.words[h])+(0|e.words[h])+n,this.words[h]=67108863&i,n=i>>>26;for(;0!==n&&h<r.length;h++)i=(0|r.words[h])+n,this.words[h]=67108863&i,n=i>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;h<r.length;h++)this.words[h]=r.words[h];return this},n.prototype.add=function(t){var i;return 0!==t.negative&&0===this.negative?(t.negative=0,i=this.sub(t),t.negative^=1,i):0===t.negative&&0!==this.negative?(this.negative=0,i=t.sub(this),this.negative=1,i):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,e,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,e=t):(r=t,e=this);for(var h=0,s=0;s<e.length;s++)h=(i=(0|r.words[s])-(0|e.words[s])+h)>>26,this.words[s]=67108863&i;for(;0!==h&&s<r.length;s++)h=(i=(0|r.words[s])+h)>>26,this.words[s]=67108863&i;if(0===h&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,i,r){var e,n,h,s=t.words,o=i.words,u=r.words,a=0,l=0|s[0],m=8191&l,f=l>>>13,d=0|s[1],p=8191&d,v=d>>>13,M=0|s[2],g=8191&M,c=M>>>13,w=0|s[3],y=8191&w,b=w>>>13,_=0|s[4],A=8191&_,k=_>>>13,x=0|s[5],S=8191&x,q=x>>>13,Z=0|s[6],B=8191&Z,R=Z>>>13,N=0|s[7],L=8191&N,I=N>>>13,E=0|s[8],O=8191&E,z=E>>>13,T=0|s[9],j=8191&T,P=T>>>13,K=0|o[0],F=8191&K,U=K>>>13,C=0|o[1],D=8191&C,H=C>>>13,J=0|o[2],W=8191&J,G=J>>>13,Q=0|o[3],V=8191&Q,X=Q>>>13,Y=0|o[4],$=8191&Y,tt=Y>>>13,it=0|o[5],rt=8191&it,et=it>>>13,nt=0|o[6],ht=8191&nt,st=nt>>>13,ot=0|o[7],ut=8191&ot,at=ot>>>13,lt=0|o[8],mt=8191&lt,ft=lt>>>13,dt=0|o[9],pt=8191&dt,vt=dt>>>13;r.negative=t.negative^i.negative,r.length=19;var Mt=(a+(e=Math.imul(m,F))|0)+((8191&(n=(n=Math.imul(m,U))+Math.imul(f,F)|0))<<13)|0;a=((h=Math.imul(f,U))+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,e=Math.imul(p,F),n=(n=Math.imul(p,U))+Math.imul(v,F)|0,h=Math.imul(v,U);var gt=(a+(e=e+Math.imul(m,D)|0)|0)+((8191&(n=(n=n+Math.imul(m,H)|0)+Math.imul(f,D)|0))<<13)|0;a=((h=h+Math.imul(f,H)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,e=Math.imul(g,F),n=(n=Math.imul(g,U))+Math.imul(c,F)|0,h=Math.imul(c,U),e=e+Math.imul(p,D)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(v,D)|0,h=h+Math.imul(v,H)|0;var ct=(a+(e=e+Math.imul(m,W)|0)|0)+((8191&(n=(n=n+Math.imul(m,G)|0)+Math.imul(f,W)|0))<<13)|0;a=((h=h+Math.imul(f,G)|0)+(n>>>13)|0)+(ct>>>26)|0,ct&=67108863,e=Math.imul(y,F),n=(n=Math.imul(y,U))+Math.imul(b,F)|0,h=Math.imul(b,U),e=e+Math.imul(g,D)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(c,D)|0,h=h+Math.imul(c,H)|0,e=e+Math.imul(p,W)|0,n=(n=n+Math.imul(p,G)|0)+Math.imul(v,W)|0,h=h+Math.imul(v,G)|0;var wt=(a+(e=e+Math.imul(m,V)|0)|0)+((8191&(n=(n=n+Math.imul(m,X)|0)+Math.imul(f,V)|0))<<13)|0;a=((h=h+Math.imul(f,X)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,e=Math.imul(A,F),n=(n=Math.imul(A,U))+Math.imul(k,F)|0,h=Math.imul(k,U),e=e+Math.imul(y,D)|0,n=(n=n+Math.imul(y,H)|0)+Math.imul(b,D)|0,h=h+Math.imul(b,H)|0,e=e+Math.imul(g,W)|0,n=(n=n+Math.imul(g,G)|0)+Math.imul(c,W)|0,h=h+Math.imul(c,G)|0,e=e+Math.imul(p,V)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(v,V)|0,h=h+Math.imul(v,X)|0;var yt=(a+(e=e+Math.imul(m,$)|0)|0)+((8191&(n=(n=n+Math.imul(m,tt)|0)+Math.imul(f,$)|0))<<13)|0;a=((h=h+Math.imul(f,tt)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,e=Math.imul(S,F),n=(n=Math.imul(S,U))+Math.imul(q,F)|0,h=Math.imul(q,U),e=e+Math.imul(A,D)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(k,D)|0,h=h+Math.imul(k,H)|0,e=e+Math.imul(y,W)|0,n=(n=n+Math.imul(y,G)|0)+Math.imul(b,W)|0,h=h+Math.imul(b,G)|0,e=e+Math.imul(g,V)|0,n=(n=n+Math.imul(g,X)|0)+Math.imul(c,V)|0,h=h+Math.imul(c,X)|0,e=e+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(v,$)|0,h=h+Math.imul(v,tt)|0;var bt=(a+(e=e+Math.imul(m,rt)|0)|0)+((8191&(n=(n=n+Math.imul(m,et)|0)+Math.imul(f,rt)|0))<<13)|0;a=((h=h+Math.imul(f,et)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,e=Math.imul(B,F),n=(n=Math.imul(B,U))+Math.imul(R,F)|0,h=Math.imul(R,U),e=e+Math.imul(S,D)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(q,D)|0,h=h+Math.imul(q,H)|0,e=e+Math.imul(A,W)|0,n=(n=n+Math.imul(A,G)|0)+Math.imul(k,W)|0,h=h+Math.imul(k,G)|0,e=e+Math.imul(y,V)|0,n=(n=n+Math.imul(y,X)|0)+Math.imul(b,V)|0,h=h+Math.imul(b,X)|0,e=e+Math.imul(g,$)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(c,$)|0,h=h+Math.imul(c,tt)|0,e=e+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,et)|0)+Math.imul(v,rt)|0,h=h+Math.imul(v,et)|0;var _t=(a+(e=e+Math.imul(m,ht)|0)|0)+((8191&(n=(n=n+Math.imul(m,st)|0)+Math.imul(f,ht)|0))<<13)|0;a=((h=h+Math.imul(f,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,e=Math.imul(L,F),n=(n=Math.imul(L,U))+Math.imul(I,F)|0,h=Math.imul(I,U),e=e+Math.imul(B,D)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(R,D)|0,h=h+Math.imul(R,H)|0,e=e+Math.imul(S,W)|0,n=(n=n+Math.imul(S,G)|0)+Math.imul(q,W)|0,h=h+Math.imul(q,G)|0,e=e+Math.imul(A,V)|0,n=(n=n+Math.imul(A,X)|0)+Math.imul(k,V)|0,h=h+Math.imul(k,X)|0,e=e+Math.imul(y,$)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(b,$)|0,h=h+Math.imul(b,tt)|0,e=e+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,et)|0)+Math.imul(c,rt)|0,h=h+Math.imul(c,et)|0,e=e+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,st)|0)+Math.imul(v,ht)|0,h=h+Math.imul(v,st)|0;var At=(a+(e=e+Math.imul(m,ut)|0)|0)+((8191&(n=(n=n+Math.imul(m,at)|0)+Math.imul(f,ut)|0))<<13)|0;a=((h=h+Math.imul(f,at)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,e=Math.imul(O,F),n=(n=Math.imul(O,U))+Math.imul(z,F)|0,h=Math.imul(z,U),e=e+Math.imul(L,D)|0,n=(n=n+Math.imul(L,H)|0)+Math.imul(I,D)|0,h=h+Math.imul(I,H)|0,e=e+Math.imul(B,W)|0,n=(n=n+Math.imul(B,G)|0)+Math.imul(R,W)|0,h=h+Math.imul(R,G)|0,e=e+Math.imul(S,V)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(q,V)|0,h=h+Math.imul(q,X)|0,e=e+Math.imul(A,$)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(k,$)|0,h=h+Math.imul(k,tt)|0,e=e+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,et)|0)+Math.imul(b,rt)|0,h=h+Math.imul(b,et)|0,e=e+Math.imul(g,ht)|0,n=(n=n+Math.imul(g,st)|0)+Math.imul(c,ht)|0,h=h+Math.imul(c,st)|0,e=e+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,at)|0)+Math.imul(v,ut)|0,h=h+Math.imul(v,at)|0;var kt=(a+(e=e+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,ft)|0)+Math.imul(f,mt)|0))<<13)|0;a=((h=h+Math.imul(f,ft)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,e=Math.imul(j,F),n=(n=Math.imul(j,U))+Math.imul(P,F)|0,h=Math.imul(P,U),e=e+Math.imul(O,D)|0,n=(n=n+Math.imul(O,H)|0)+Math.imul(z,D)|0,h=h+Math.imul(z,H)|0,e=e+Math.imul(L,W)|0,n=(n=n+Math.imul(L,G)|0)+Math.imul(I,W)|0,h=h+Math.imul(I,G)|0,e=e+Math.imul(B,V)|0,n=(n=n+Math.imul(B,X)|0)+Math.imul(R,V)|0,h=h+Math.imul(R,X)|0,e=e+Math.imul(S,$)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(q,$)|0,h=h+Math.imul(q,tt)|0,e=e+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,et)|0)+Math.imul(k,rt)|0,h=h+Math.imul(k,et)|0,e=e+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(b,ht)|0,h=h+Math.imul(b,st)|0,e=e+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,at)|0)+Math.imul(c,ut)|0,h=h+Math.imul(c,at)|0,e=e+Math.imul(p,mt)|0,n=(n=n+Math.imul(p,ft)|0)+Math.imul(v,mt)|0,h=h+Math.imul(v,ft)|0;var xt=(a+(e=e+Math.imul(m,pt)|0)|0)+((8191&(n=(n=n+Math.imul(m,vt)|0)+Math.imul(f,pt)|0))<<13)|0;a=((h=h+Math.imul(f,vt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,e=Math.imul(j,D),n=(n=Math.imul(j,H))+Math.imul(P,D)|0,h=Math.imul(P,H),e=e+Math.imul(O,W)|0,n=(n=n+Math.imul(O,G)|0)+Math.imul(z,W)|0,h=h+Math.imul(z,G)|0,e=e+Math.imul(L,V)|0,n=(n=n+Math.imul(L,X)|0)+Math.imul(I,V)|0,h=h+Math.imul(I,X)|0,e=e+Math.imul(B,$)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(R,$)|0,h=h+Math.imul(R,tt)|0,e=e+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,et)|0)+Math.imul(q,rt)|0,h=h+Math.imul(q,et)|0,e=e+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,st)|0)+Math.imul(k,ht)|0,h=h+Math.imul(k,st)|0,e=e+Math.imul(y,ut)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(b,ut)|0,h=h+Math.imul(b,at)|0,e=e+Math.imul(g,mt)|0,n=(n=n+Math.imul(g,ft)|0)+Math.imul(c,mt)|0,h=h+Math.imul(c,ft)|0;var St=(a+(e=e+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,vt)|0)+Math.imul(v,pt)|0))<<13)|0;a=((h=h+Math.imul(v,vt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,e=Math.imul(j,W),n=(n=Math.imul(j,G))+Math.imul(P,W)|0,h=Math.imul(P,G),e=e+Math.imul(O,V)|0,n=(n=n+Math.imul(O,X)|0)+Math.imul(z,V)|0,h=h+Math.imul(z,X)|0,e=e+Math.imul(L,$)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(I,$)|0,h=h+Math.imul(I,tt)|0,e=e+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,et)|0)+Math.imul(R,rt)|0,h=h+Math.imul(R,et)|0,e=e+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(q,ht)|0,h=h+Math.imul(q,st)|0,e=e+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,at)|0)+Math.imul(k,ut)|0,h=h+Math.imul(k,at)|0,e=e+Math.imul(y,mt)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(b,mt)|0,h=h+Math.imul(b,ft)|0;var qt=(a+(e=e+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,vt)|0)+Math.imul(c,pt)|0))<<13)|0;a=((h=h+Math.imul(c,vt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,e=Math.imul(j,V),n=(n=Math.imul(j,X))+Math.imul(P,V)|0,h=Math.imul(P,X),e=e+Math.imul(O,$)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(z,$)|0,h=h+Math.imul(z,tt)|0,e=e+Math.imul(L,rt)|0,n=(n=n+Math.imul(L,et)|0)+Math.imul(I,rt)|0,h=h+Math.imul(I,et)|0,e=e+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul(R,ht)|0,h=h+Math.imul(R,st)|0,e=e+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul(q,ut)|0,h=h+Math.imul(q,at)|0,e=e+Math.imul(A,mt)|0,n=(n=n+Math.imul(A,ft)|0)+Math.imul(k,mt)|0,h=h+Math.imul(k,ft)|0;var Zt=(a+(e=e+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,vt)|0)+Math.imul(b,pt)|0))<<13)|0;a=((h=h+Math.imul(b,vt)|0)+(n>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,e=Math.imul(j,$),n=(n=Math.imul(j,tt))+Math.imul(P,$)|0,h=Math.imul(P,tt),e=e+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,et)|0)+Math.imul(z,rt)|0,h=h+Math.imul(z,et)|0,e=e+Math.imul(L,ht)|0,n=(n=n+Math.imul(L,st)|0)+Math.imul(I,ht)|0,h=h+Math.imul(I,st)|0,e=e+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,at)|0)+Math.imul(R,ut)|0,h=h+Math.imul(R,at)|0,e=e+Math.imul(S,mt)|0,n=(n=n+Math.imul(S,ft)|0)+Math.imul(q,mt)|0,h=h+Math.imul(q,ft)|0;var Bt=(a+(e=e+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,vt)|0)+Math.imul(k,pt)|0))<<13)|0;a=((h=h+Math.imul(k,vt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,e=Math.imul(j,rt),n=(n=Math.imul(j,et))+Math.imul(P,rt)|0,h=Math.imul(P,et),e=e+Math.imul(O,ht)|0,n=(n=n+Math.imul(O,st)|0)+Math.imul(z,ht)|0,h=h+Math.imul(z,st)|0,e=e+Math.imul(L,ut)|0,n=(n=n+Math.imul(L,at)|0)+Math.imul(I,ut)|0,h=h+Math.imul(I,at)|0,e=e+Math.imul(B,mt)|0,n=(n=n+Math.imul(B,ft)|0)+Math.imul(R,mt)|0,h=h+Math.imul(R,ft)|0;var Rt=(a+(e=e+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,vt)|0)+Math.imul(q,pt)|0))<<13)|0;a=((h=h+Math.imul(q,vt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,e=Math.imul(j,ht),n=(n=Math.imul(j,st))+Math.imul(P,ht)|0,h=Math.imul(P,st),e=e+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(z,ut)|0,h=h+Math.imul(z,at)|0,e=e+Math.imul(L,mt)|0,n=(n=n+Math.imul(L,ft)|0)+Math.imul(I,mt)|0,h=h+Math.imul(I,ft)|0;var Nt=(a+(e=e+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,vt)|0)+Math.imul(R,pt)|0))<<13)|0;a=((h=h+Math.imul(R,vt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,e=Math.imul(j,ut),n=(n=Math.imul(j,at))+Math.imul(P,ut)|0,h=Math.imul(P,at),e=e+Math.imul(O,mt)|0,n=(n=n+Math.imul(O,ft)|0)+Math.imul(z,mt)|0,h=h+Math.imul(z,ft)|0;var Lt=(a+(e=e+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,vt)|0)+Math.imul(I,pt)|0))<<13)|0;a=((h=h+Math.imul(I,vt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,e=Math.imul(j,mt),n=(n=Math.imul(j,ft))+Math.imul(P,mt)|0,h=Math.imul(P,ft);var It=(a+(e=e+Math.imul(O,pt)|0)|0)+((8191&(n=(n=n+Math.imul(O,vt)|0)+Math.imul(z,pt)|0))<<13)|0;a=((h=h+Math.imul(z,vt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863;var Et=(a+(e=Math.imul(j,pt))|0)+((8191&(n=(n=Math.imul(j,vt))+Math.imul(P,pt)|0))<<13)|0;return a=((h=Math.imul(P,vt))+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,u[0]=Mt,u[1]=gt,u[2]=ct,u[3]=wt,u[4]=yt,u[5]=bt,u[6]=_t,u[7]=At,u[8]=kt,u[9]=xt,u[10]=St,u[11]=qt,u[12]=Zt,u[13]=Bt,u[14]=Rt,u[15]=Nt,u[16]=Lt,u[17]=It,u[18]=Et,0!==a&&(u[19]=a,r.length++),r};function p(t,i,r){return(new v).mulp(t,i,r)}function v(t,i){this.x=t,this.y=i}Math.imul||(d=f),n.prototype.mulTo=function(t,i){var r,e=this.length+t.length;return r=10===this.length&&10===t.length?d(this,t,i):e<63?f(this,t,i):e<1024?function(t,i,r){r.negative=i.negative^t.negative,r.length=t.length+i.length;for(var e=0,n=0,h=0;h<r.length-1;h++){var s=n;n=0;for(var o=67108863&e,u=Math.min(h,i.length-1),a=Math.max(0,h-t.length+1);a<=u;a++){var l=h-a,m=(0|t.words[l])*(0|i.words[a]),f=67108863&m;o=67108863&(f=f+o|0),n+=(s=(s=s+(m/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[h]=o,e=s,s=n}return 0!==e?r.words[h]=e:r.length--,r.strip()}(this,t,i):p(this,t,i),r},v.prototype.makeRBT=function(t){for(var i=Array(t),r=n.prototype._countBits(t)-1,e=0;e<t;e++)i[e]=this.revBin(e,r,t);return i},v.prototype.revBin=function(t,i,r){if(0===t||t===r-1)return t;for(var e=0,n=0;n<i;n++)e|=(1&t)<<i-n-1,t>>=1;return e},v.prototype.permute=function(t,i,r,e,n,h){for(var s=0;s<h;s++)e[s]=i[t[s]],n[s]=r[t[s]]},v.prototype.transform=function(t,i,r,e,n,h){this.permute(h,t,i,r,e,n);for(var s=1;s<n;s<<=1)for(var o=s<<1,u=Math.cos(2*Math.PI/o),a=Math.sin(2*Math.PI/o),l=0;l<n;l+=o)for(var m=u,f=a,d=0;d<s;d++){var p=r[l+d],v=e[l+d],M=r[l+d+s],g=e[l+d+s],c=m*M-f*g;g=m*g+f*M,M=c,r[l+d]=p+M,e[l+d]=v+g,r[l+d+s]=p-M,e[l+d+s]=v-g,d!==o&&(c=u*m-a*f,f=u*f+a*m,m=c)}},v.prototype.guessLen13b=function(t,i){var r=1|Math.max(i,t),e=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+e},v.prototype.conjugate=function(t,i,r){if(!(r<=1))for(var e=0;e<r/2;e++){var n=t[e];t[e]=t[r-e-1],t[r-e-1]=n,n=i[e],i[e]=-i[r-e-1],i[r-e-1]=-n}},v.prototype.normalize13b=function(t,i){for(var r=0,e=0;e<i/2;e++){var n=8192*Math.round(t[2*e+1]/i)+Math.round(t[2*e]/i)+r;t[e]=67108863&n,r=n<67108864?0:n/67108864|0}return t},v.prototype.convert13b=function(t,i,e,n){for(var h=0,s=0;s<i;s++)h+=0|t[s],e[2*s]=8191&h,h>>>=13,e[2*s+1]=8191&h,h>>>=13;for(s=2*i;s<n;++s)e[s]=0;r(0===h),r(0==(-8192&h))},v.prototype.stub=function(t){for(var i=Array(t),r=0;r<t;r++)i[r]=0;return i},v.prototype.mulp=function(t,i,r){var e=2*this.guessLen13b(t.length,i.length),n=this.makeRBT(e),h=this.stub(e),s=Array(e),o=Array(e),u=Array(e),a=Array(e),l=Array(e),m=Array(e),f=r.words;f.length=e,this.convert13b(t.words,t.length,s,e),this.convert13b(i.words,i.length,a,e),this.transform(s,h,o,u,e,n),this.transform(a,h,l,m,e,n);for(var d=0;d<e;d++){var p=o[d]*l[d]-u[d]*m[d];u[d]=o[d]*m[d]+u[d]*l[d],o[d]=p}return this.conjugate(o,u,e),this.transform(o,u,f,h,e,n),this.conjugate(f,h,e),this.normalize13b(f,e),r.negative=t.negative^i.negative,r.length=t.length+i.length,r.strip()},n.prototype.mul=function(t){var i=new n(null);return i.words=Array(this.length+t.length),this.mulTo(t,i)},n.prototype.mulf=function(t){var i=new n(null);return i.words=Array(this.length+t.length),p(this,t,i)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var i=0,e=0;e<this.length;e++){var n=(0|this.words[e])*t,h=(67108863&n)+(67108863&i);i>>=26,i+=n/67108864|0,i+=h>>>26,this.words[e]=67108863&h}return 0!==i&&(this.words[e]=i,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var i=function(t){for(var i=Array(t.bitLength()),r=0;r<i.length;r++){var e=r/26|0,n=r%26;i[r]=(t.words[e]&1<<n)>>>n}return i}(t);if(0===i.length)return new n(1);for(var r=this,e=0;e<i.length&&0===i[e];e++,r=r.sqr());if(++e<i.length)for(var h=r.sqr();e<i.length;e++,h=h.sqr())0!==i[e]&&(r=r.mul(h));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var i,e=t%26,n=(t-e)/26,h=67108863>>>26-e<<26-e;if(0!==e){var s=0;for(i=0;i<this.length;i++){var o=this.words[i]&h,u=(0|this.words[i])-o<<e;this.words[i]=u|s,s=o>>>26-e}s&&(this.words[i]=s,this.length++)}if(0!==n){for(i=this.length-1;i>=0;i--)this.words[i+n]=this.words[i];for(i=0;i<n;i++)this.words[i]=0;this.length+=n}return this.strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,i,e){var n;r("number"==typeof t&&t>=0),n=i?(i-i%26)/26:0;var h=t%26,s=Math.min((t-h)/26,this.length),o=67108863^67108863>>>h<<h,u=e;if(n=Math.max(0,n-=s),u){for(var a=0;a<s;a++)u.words[a]=this.words[a];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,a=0;a<this.length;a++)this.words[a]=this.words[a+s];else this.words[0]=0,this.length=1;var l=0;for(a=this.length-1;a>=0&&(0!==l||a>=n);a--){var m=0|this.words[a];this.words[a]=l<<26-h|m>>>h,l=m&o}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,i,e){return r(0===this.negative),this.iushrn(t,i,e)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var i=t%26,e=(t-i)/26,n=1<<i;return!(this.length<=e||!(this.words[e]&n))},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var i=t%26,e=(t-i)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=e)return this;if(0!==i&&e++,this.length=Math.min(e,this.length),0!==i){var n=67108863^67108863>>>i<<i;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var i=0;i<this.length&&this.words[i]>=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i<this.length&&this.words[i]<0;i++)this.words[i]+=67108864,this.words[i+1]-=1;return this.strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,i,e){var n,h,s=t.length+e;this._expand(s);var o=0;for(n=0;n<t.length;n++){h=(0|this.words[n+e])+o;var u=(0|t.words[n])*i;o=((h-=67108863&u)>>26)-(u/67108864|0),this.words[n+e]=67108863&h}for(;n<this.length-e;n++)o=(h=(0|this.words[n+e])+o)>>26,this.words[n+e]=67108863&h;if(0===o)return this.strip();for(r(-1===o),o=0,n=0;n<this.length;n++)o=(h=-(0|this.words[n])+o)>>26,this.words[n]=67108863&h;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,i){var r=(this.length,t.length),e=this.clone(),h=t,s=0|h.words[h.length-1];0!=(r=26-this._countBits(s))&&(h=h.ushln(r),e.iushln(r),s=0|h.words[h.length-1]);var o,u=e.length-h.length;if("mod"!==i){(o=new n(null)).length=u+1,o.words=Array(o.length);for(var a=0;a<o.length;a++)o.words[a]=0}var l=e.clone()._ishlnsubmul(h,1,u);0===l.negative&&(e=l,o&&(o.words[u]=1));for(var m=u-1;m>=0;m--){var f=67108864*(0|e.words[h.length+m])+(0|e.words[h.length+m-1]);for(f=Math.min(f/s|0,67108863),e._ishlnsubmul(h,f,m);0!==e.negative;)f--,e.negative=0,e._ishlnsubmul(h,1,m),e.isZero()||(e.negative^=1);o&&(o.words[m]=f)}return o&&o.strip(),e.strip(),"div"!==i&&0!==r&&e.iushrn(r),{div:o||null,mod:e}},n.prototype.divmod=function(t,i,e){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(o=this.neg().divmod(t,i),"mod"!==i&&(h=o.div.neg()),"div"!==i&&(s=o.mod.neg(),e&&0!==s.negative&&s.iadd(t)),{div:h,mod:s}):0===this.negative&&0!==t.negative?(o=this.divmod(t.neg(),i),"mod"!==i&&(h=o.div.neg()),{div:h,mod:o.mod}):0!=(this.negative&t.negative)?(o=this.neg().divmod(t.neg(),i),"div"!==i&&(s=o.mod.neg(),e&&0!==s.negative&&s.isub(t)),{div:o.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,i);var h,s,o},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var r=0!==i.div.negative?i.mod.isub(t):i.mod,e=t.ushrn(1),n=t.andln(1),h=r.cmp(e);return h<0||1===n&&0===h?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},n.prototype.modn=function(t){r(t<=67108863);for(var i=(1<<26)%t,e=0,n=this.length-1;n>=0;n--)e=(i*e+(0|this.words[n]))%t;return e},n.prototype.idivn=function(t){r(t<=67108863);for(var i=0,e=this.length-1;e>=0;e--){var n=(0|this.words[e])+67108864*i;this.words[e]=n/t|0,i=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var i=this,e=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var h=new n(1),s=new n(0),o=new n(0),u=new n(1),a=0;i.isEven()&&e.isEven();)i.iushrn(1),e.iushrn(1),++a;for(var l=e.clone(),m=i.clone();!i.isZero();){for(var f=0,d=1;0==(i.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(i.iushrn(f);f-- >0;)(h.isOdd()||s.isOdd())&&(h.iadd(l),s.isub(m)),h.iushrn(1),s.iushrn(1);for(var p=0,v=1;0==(e.words[0]&v)&&p<26;++p,v<<=1);if(p>0)for(e.iushrn(p);p-- >0;)(o.isOdd()||u.isOdd())&&(o.iadd(l),u.isub(m)),o.iushrn(1),u.iushrn(1);i.cmp(e)>=0?(i.isub(e),h.isub(o),s.isub(u)):(e.isub(i),o.isub(h),u.isub(s))}return{a:o,b:u,gcd:e.iushln(a)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var i=this,e=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var h,s=new n(1),o=new n(0),u=e.clone();i.cmpn(1)>0&&e.cmpn(1)>0;){for(var a=0,l=1;0==(i.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(i.iushrn(a);a-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var m=0,f=1;0==(e.words[0]&f)&&m<26;++m,f<<=1);if(m>0)for(e.iushrn(m);m-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);i.cmp(e)>=0?(i.isub(e),s.isub(o)):(e.isub(i),o.isub(s))}return(h=0===i.cmpn(1)?s:o).cmpn(0)<0&&h.iadd(t),h},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),r=t.clone();i.negative=0,r.negative=0;for(var e=0;i.isEven()&&r.isEven();e++)i.iushrn(1),r.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=i.cmp(r);if(n<0){var h=i;i=r,r=h}else if(0===n||0===r.cmpn(1))break;i.isub(r)}return r.iushln(e)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var i=t%26,e=(t-i)/26,n=1<<i;if(this.length<=e)return this._expand(e+1),this.words[e]|=n,this;for(var h=n,s=e;0!==h&&s<this.length;s++){var o=0|this.words[s];h=(o+=h)>>>26,o&=67108863,this.words[s]=o}return 0!==h&&(this.words[s]=h,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var i,e=t<0;if(0!==this.negative&&!e)return-1;if(0===this.negative&&e)return 1;if(this.strip(),this.length>1)i=1;else{e&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];i=n===t?0:n<t?-1:1}return 0!==this.negative?0|-i:i},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var i=this.ucmp(t);return 0!==this.negative?0|-i:i},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var i=0,r=this.length-1;r>=0;r--){var e=0|this.words[r],n=0|t.words[r];if(e!==n){e<n?i=-1:e>n&&(i=1);break}}return i},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new _(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var M={k256:null,p224:null,p192:null,p25519:null};function g(t,i){this.name=t,this.p=new n(i,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function c(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function y(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(t){if("string"==typeof t){var i=n._prime(t);this.m=i.p,this.prime=i}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){_.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}g.prototype._tmp=function(){var t=new n(null);return t.words=Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var i,r=t;do{this.split(r,this.tmp),i=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(i>this.n);var e=i<this.n?-1:r.ucmp(this.p);return 0===e?(r.words[0]=0,r.length=1):e>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(t,i){t.iushrn(this.n,0,i)},g.prototype.imulK=function(t){return t.imul(this.k)},e(c,g),c.prototype.split=function(t,i){for(var r=4194303,e=Math.min(t.length,9),n=0;n<e;n++)i.words[n]=t.words[n];if(i.length=e,t.length<=9)return t.words[0]=0,void(t.length=1);var h=t.words[9];for(i.words[i.length++]=h&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|h>>>22,h=s}h>>>=22,t.words[n-10]=h,0===h&&t.length>10?t.length-=10:t.length-=9},c.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,r=0;r<t.length;r++){var e=0|t.words[r];i+=977*e,t.words[r]=67108863&i,i=64*e+(i/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},e(w,g),e(y,g),e(b,g),b.prototype.imulK=function(t){for(var i=0,r=0;r<t.length;r++){var e=19*(0|t.words[r])+i,n=67108863&e;e>>>=26,t.words[r]=n,i=e}return 0!==i&&(t.words[t.length++]=i),t},n._prime=function(t){if(M[t])return M[t];var i;if("k256"===t)i=new c;else if("p224"===t)i=new w;else if("p192"===t)i=new y;else{if("p25519"!==t)throw Error("Unknown prime "+t);i=new b}return M[t]=i,i},_.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},_.prototype._verify2=function(t,i){r(0==(t.negative|i.negative),"red works only with positives"),r(t.red&&t.red===i.red,"red works only with red numbers")},_.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},_.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},_.prototype.add=function(t,i){this._verify2(t,i);var r=t.add(i);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},_.prototype.iadd=function(t,i){this._verify2(t,i);var r=t.iadd(i);return r.cmp(this.m)>=0&&r.isub(this.m),r},_.prototype.sub=function(t,i){this._verify2(t,i);var r=t.sub(i);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(t,i){this._verify2(t,i);var r=t.isub(i);return r.cmpn(0)<0&&r.iadd(this.m),r},_.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},_.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},_.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},_.prototype.isqr=function(t){return this.imul(t,t.clone())},_.prototype.sqr=function(t){return this.mul(t,t)},_.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(r(i%2==1),3===i){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var h=this.m.subn(1),s=0;!h.isZero()&&0===h.andln(1);)s++,h.iushrn(1);r(!h.isZero());var o=new n(1).toRed(this),u=o.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var m=this.pow(l,h),f=this.pow(t,h.addn(1).iushrn(1)),d=this.pow(t,h),p=s;0!==d.cmp(o);){for(var v=d,M=0;0!==v.cmp(o);M++)v=v.redSqr();r(M<p);var g=this.pow(m,new n(1).iushln(p-M-1));f=f.redMul(g),m=g.redSqr(),d=d.redMul(m),p=M}return f},_.prototype.invm=function(t){var i=t._invmp(this.m);return 0!==i.negative?(i.negative=0,this.imod(i).redNeg()):this.imod(i)},_.prototype.pow=function(t,i){if(i.isZero())return new n(1).toRed(this);if(0===i.cmpn(1))return t.clone();var r=Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var e=2;e<r.length;e++)r[e]=this.mul(r[e-1],t);var h=r[0],s=0,o=0,u=i.bitLength()%26;for(0===u&&(u=26),e=i.length-1;e>=0;e--){for(var a=i.words[e],l=u-1;l>=0;l--){var m=a>>l&1;h!==r[0]&&(h=this.sqr(h)),0!==m||0!==s?(s<<=1,s|=m,(4==++o||0===e&&0===l)&&(h=this.mul(h,r[s]),o=0,s=0)):o=0}u=26}return h},_.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},_.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},n.mont=function(t){return new A(t)},e(A,_),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},A.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(i),e=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(e).iushrn(this.shift),h=n;return n.cmp(this.m)>=0?h=n.isub(this.m):n.cmpn(0)<0&&(h=n.iadd(this.m)),h._forceRed(this)},A.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new n(0)._forceRed(this);var r=t.mul(i),e=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=r.isub(e).iushrn(this.shift),s=h;return h.cmp(this.m)>=0?s=h.isub(this.m):h.cmpn(0)<0&&(s=h.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,void 0!==t?t:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{});var n=/*@__PURE__*/r(e.exports);class h extends i{constructor(t){if(super(),void 0===t)throw Error("Invalid BigInteger input");const i=("string"==typeof t||t instanceof String)&&t.startsWith("0x");this.value=i?new n(t.substring(2),16):new n(t)}clone(){return new h(this.value.clone())}iinc(){return this.value.iadd(new n(1)),this}inc(){return this.clone().iinc()}idec(){return this.value.isub(new n(1)),this}dec(){return this.clone().idec()}iadd(t){return this.value.iadd(t.value),this}add(t){return this.clone().iadd(t)}isub(t){return this.value.isub(t.value),this}sub(t){return this.clone().isub(t)}imul(t){return this.value.imul(t.value),this}mul(t){return this.clone().imul(t)}imod(t){return this.value=this.value.umod(t.value),this}mod(t){return this.clone().imod(t)}modExp(t,i){const r=i.isEven()?n.red(i.value):n.mont(i.value),e=this.clone();return e.value=e.value.toRed(r).redPow(t.value).fromRed(),e}modInv(t){if(!this.gcd(t).isOne())throw Error("Inverse does not exist");return new h(this.value.invm(t.value))}idiv(t){return this.value=this.value.div(t.value),this}div(t){return this.clone().idiv(t)}gcd(t){return new h(this.value.gcd(t.value))}ileftShift(t){return t.isNegative()?this.irightShift(t.negate()):(this.value.ishln(t.value.toNumber()),this)}leftShift(t){return this.clone().ileftShift(t)}irightShift(t){return t.isNegative()?this.ileftShift(t.negate()):(this.value.ishrn(t.value.toNumber()),this)}rightShift(t){return this.clone().irightShift(t)}ixor(t){return this.value.ixor(t.value),this}xor(t){return this.clone().ixor(t)}ibitwiseAnd(t){return this.value.iand(t.value),this}bitwiseAnd(t){return this.clone().ibitwiseAnd(t)}ibitwiseOr(t){return this.value.ior(t.value),this}equal(t){return this.value.eq(t.value)}lt(t){return this.value.lt(t.value)}lte(t){return this.value.lte(t.value)}gt(t){return this.value.gt(t.value)}gte(t){return this.value.gte(t.value)}isZero(){return this.value.isZero()}isOne(){return this.value.eq(new n(1))}isNegative(){return this.value.isNeg()}isEven(){return this.value.isEven()}abs(){const t=this.clone();return t.value=t.value.abs(),t}negate(){const t=this.clone();return t.value.ineg(),t}toString(){return this.value.toString()}toNumber(){return this.value.toNumber()}getBit(t){return this.value.testn(t)?1:0}bitLength(){return this.value.bitLength()}byteLength(){return this.value.byteLength()}toUint8Array(t="be",i){return this.value.toArrayLike(Uint8Array,t,i)}}export{h as default};
3
3
  //# sourceMappingURL=bn.interface.min.mjs.map