@protontech/openpgp 6.0.0-beta.3.patch.1 → 6.0.1

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 (42) hide show
  1. package/README.md +34 -37
  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/legacy_ciphers.min.mjs +1 -1
  6. package/dist/lightweight/legacy_ciphers.min.mjs.map +1 -1
  7. package/dist/lightweight/legacy_ciphers.mjs +1 -1
  8. package/dist/lightweight/noble_curves.min.mjs +11 -11
  9. package/dist/lightweight/noble_curves.min.mjs.map +1 -1
  10. package/dist/lightweight/noble_curves.mjs +260 -158
  11. package/dist/lightweight/noble_hashes.min.mjs +2 -2
  12. package/dist/lightweight/noble_hashes.min.mjs.map +1 -1
  13. package/dist/lightweight/noble_hashes.mjs +3 -2
  14. package/dist/lightweight/noble_post_quantum.min.mjs +5 -0
  15. package/dist/lightweight/noble_post_quantum.min.mjs.map +1 -0
  16. package/dist/lightweight/noble_post_quantum.mjs +1002 -0
  17. package/dist/lightweight/openpgp.min.mjs +4 -4
  18. package/dist/lightweight/openpgp.min.mjs.map +1 -1
  19. package/dist/lightweight/openpgp.mjs +863 -1056
  20. package/dist/lightweight/seek-bzip.min.mjs +3 -0
  21. package/dist/lightweight/seek-bzip.min.mjs.map +1 -0
  22. package/dist/lightweight/seek-bzip.mjs +866 -0
  23. package/dist/lightweight/sha3.min.mjs +3 -3
  24. package/dist/lightweight/sha3.min.mjs.map +1 -1
  25. package/dist/lightweight/sha3.mjs +27 -456
  26. package/dist/lightweight/sha512.min.mjs +3 -0
  27. package/dist/lightweight/sha512.min.mjs.map +1 -0
  28. package/dist/lightweight/sha512.mjs +436 -0
  29. package/dist/node/openpgp.cjs +14499 -12719
  30. package/dist/node/openpgp.min.cjs +16 -14
  31. package/dist/node/openpgp.min.cjs.map +1 -1
  32. package/dist/node/openpgp.min.mjs +16 -14
  33. package/dist/node/openpgp.min.mjs.map +1 -1
  34. package/dist/node/openpgp.mjs +11878 -10098
  35. package/dist/openpgp.js +11909 -10129
  36. package/dist/openpgp.min.js +16 -14
  37. package/dist/openpgp.min.js.map +1 -1
  38. package/dist/openpgp.min.mjs +16 -14
  39. package/dist/openpgp.min.mjs.map +1 -1
  40. package/dist/openpgp.mjs +11909 -10129
  41. package/openpgp.d.ts +3 -9
  42. package/package.json +27 -26
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sha512.min.mjs","sources":["../../node_modules/@noble/hashes/esm/_md.js","../../node_modules/@noble/hashes/esm/sha256.js","../../node_modules/@noble/hashes/esm/sha512.js"],"sourcesContent":["import { aexists, aoutput } from './_assert.js';\nimport { Hash, createView, toBytes } from './utils.js';\n/**\n * Polyfill for Safari 14\n */\nfunction setBigUint64(view, byteOffset, value, isLE) {\n if (typeof view.setBigUint64 === 'function')\n return view.setBigUint64(byteOffset, value, isLE);\n const _32n = BigInt(32);\n const _u32_max = BigInt(0xffffffff);\n const wh = Number((value >> _32n) & _u32_max);\n const wl = Number(value & _u32_max);\n const h = isLE ? 4 : 0;\n const l = isLE ? 0 : 4;\n view.setUint32(byteOffset + h, wh, isLE);\n view.setUint32(byteOffset + l, wl, isLE);\n}\n/**\n * Choice: a ? b : c\n */\nexport const Chi = (a, b, c) => (a & b) ^ (~a & c);\n/**\n * Majority function, true if any two inputs is true\n */\nexport const Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c);\n/**\n * Merkle-Damgard hash construction base class.\n * Could be used to create MD5, RIPEMD, SHA1, SHA2.\n */\nexport class HashMD extends Hash {\n constructor(blockLen, outputLen, padOffset, isLE) {\n super();\n this.blockLen = blockLen;\n this.outputLen = outputLen;\n this.padOffset = padOffset;\n this.isLE = isLE;\n this.finished = false;\n this.length = 0;\n this.pos = 0;\n this.destroyed = false;\n this.buffer = new Uint8Array(blockLen);\n this.view = createView(this.buffer);\n }\n update(data) {\n aexists(this);\n const { view, buffer, blockLen } = this;\n data = toBytes(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path: we have at least one block in input, cast it to view and process\n if (take === blockLen) {\n const dataView = createView(data);\n for (; blockLen <= len - pos; pos += blockLen)\n this.process(dataView, pos);\n continue;\n }\n buffer.set(data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(view, 0);\n this.pos = 0;\n }\n }\n this.length += data.length;\n this.roundClean();\n return this;\n }\n digestInto(out) {\n aexists(this);\n aoutput(out, this);\n this.finished = true;\n // Padding\n // We can avoid allocation of buffer for padding completely if it\n // was previously not allocated here. But it won't change performance.\n const { buffer, view, blockLen, isLE } = this;\n let { pos } = this;\n // append the bit '1' to the message\n buffer[pos++] = 0b10000000;\n this.buffer.subarray(pos).fill(0);\n // we have less than padOffset left in buffer, so we cannot put length in\n // current block, need process it and pad again\n if (this.padOffset > blockLen - pos) {\n this.process(view, 0);\n pos = 0;\n }\n // Pad until full block byte with zeros\n for (let i = pos; i < blockLen; i++)\n buffer[i] = 0;\n // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that\n // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.\n // So we just write lowest 64 bits of that value.\n setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);\n this.process(view, 0);\n const oview = createView(out);\n const len = this.outputLen;\n // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT\n if (len % 4)\n throw new Error('_sha2: outputLen should be aligned to 32bit');\n const outLen = len / 4;\n const state = this.get();\n if (outLen > state.length)\n throw new Error('_sha2: outputLen bigger than state');\n for (let i = 0; i < outLen; i++)\n oview.setUint32(4 * i, state[i], isLE);\n }\n digest() {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n _cloneInto(to) {\n to || (to = new this.constructor());\n to.set(...this.get());\n const { blockLen, buffer, length, finished, destroyed, pos } = this;\n to.length = length;\n to.pos = pos;\n to.finished = finished;\n to.destroyed = destroyed;\n if (length % blockLen)\n to.buffer.set(buffer);\n return to;\n }\n}\n//# sourceMappingURL=_md.js.map","import { HashMD, Chi, Maj } from './_md.js';\nimport { rotr, wrapConstructor } from './utils.js';\n// SHA2-256 need to try 2^128 hashes to execute birthday attack.\n// BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per late 2024.\n// Round constants:\n// first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311)\n// prettier-ignore\nconst SHA256_K = /* @__PURE__ */ new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n]);\n// Initial state:\n// first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19\n// prettier-ignore\nconst SHA256_IV = /* @__PURE__ */ new Uint32Array([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19\n]);\n// Temporary buffer, not used to store anything between runs\n// Named this way because it matches specification.\nconst SHA256_W = /* @__PURE__ */ new Uint32Array(64);\nexport class SHA256 extends HashMD {\n constructor() {\n super(64, 32, 8, false);\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n this.A = SHA256_IV[0] | 0;\n this.B = SHA256_IV[1] | 0;\n this.C = SHA256_IV[2] | 0;\n this.D = SHA256_IV[3] | 0;\n this.E = SHA256_IV[4] | 0;\n this.F = SHA256_IV[5] | 0;\n this.G = SHA256_IV[6] | 0;\n this.H = SHA256_IV[7] | 0;\n }\n get() {\n const { A, B, C, D, E, F, G, H } = this;\n return [A, B, C, D, E, F, G, H];\n }\n // prettier-ignore\n set(A, B, C, D, E, F, G, H) {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n this.E = E | 0;\n this.F = F | 0;\n this.G = G | 0;\n this.H = H | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4)\n SHA256_W[i] = view.getUint32(offset, false);\n for (let i = 16; i < 64; i++) {\n const W15 = SHA256_W[i - 15];\n const W2 = SHA256_W[i - 2];\n const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);\n const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);\n SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;\n }\n // Compression function main loop, 64 rounds\n let { A, B, C, D, E, F, G, H } = this;\n for (let i = 0; i < 64; i++) {\n const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);\n const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);\n const T2 = (sigma0 + Maj(A, B, C)) | 0;\n H = G;\n G = F;\n F = E;\n E = (D + T1) | 0;\n D = C;\n C = B;\n B = A;\n A = (T1 + T2) | 0;\n }\n // Add the compressed chunk to the current hash value\n A = (A + this.A) | 0;\n B = (B + this.B) | 0;\n C = (C + this.C) | 0;\n D = (D + this.D) | 0;\n E = (E + this.E) | 0;\n F = (F + this.F) | 0;\n G = (G + this.G) | 0;\n H = (H + this.H) | 0;\n this.set(A, B, C, D, E, F, G, H);\n }\n roundClean() {\n SHA256_W.fill(0);\n }\n destroy() {\n this.set(0, 0, 0, 0, 0, 0, 0, 0);\n this.buffer.fill(0);\n }\n}\n// Constants from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf\nclass SHA224 extends SHA256 {\n constructor() {\n super();\n this.A = 0xc1059ed8 | 0;\n this.B = 0x367cd507 | 0;\n this.C = 0x3070dd17 | 0;\n this.D = 0xf70e5939 | 0;\n this.E = 0xffc00b31 | 0;\n this.F = 0x68581511 | 0;\n this.G = 0x64f98fa7 | 0;\n this.H = 0xbefa4fa4 | 0;\n this.outputLen = 28;\n }\n}\n/**\n * SHA2-256 hash function\n * @param message - data that would be hashed\n */\nexport const sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256());\n/**\n * SHA2-224 hash function\n */\nexport const sha224 = /* @__PURE__ */ wrapConstructor(() => new SHA224());\n//# sourceMappingURL=sha256.js.map","import { HashMD } from './_md.js';\nimport u64 from './_u64.js';\nimport { wrapConstructor } from './utils.js';\n// Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409):\n// prettier-ignore\nconst [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => u64.split([\n '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',\n '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',\n '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',\n '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',\n '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',\n '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',\n '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',\n '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',\n '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',\n '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',\n '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',\n '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',\n '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',\n '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',\n '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',\n '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',\n '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',\n '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',\n '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',\n '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'\n].map(n => BigInt(n))))();\n// Temporary buffer, not used to store anything between runs\nconst SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);\nconst SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);\nexport class SHA512 extends HashMD {\n constructor() {\n super(128, 64, 16, false);\n // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers.\n // Also looks cleaner and easier to verify with spec.\n // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x6a09e667 | 0;\n this.Al = 0xf3bcc908 | 0;\n this.Bh = 0xbb67ae85 | 0;\n this.Bl = 0x84caa73b | 0;\n this.Ch = 0x3c6ef372 | 0;\n this.Cl = 0xfe94f82b | 0;\n this.Dh = 0xa54ff53a | 0;\n this.Dl = 0x5f1d36f1 | 0;\n this.Eh = 0x510e527f | 0;\n this.El = 0xade682d1 | 0;\n this.Fh = 0x9b05688c | 0;\n this.Fl = 0x2b3e6c1f | 0;\n this.Gh = 0x1f83d9ab | 0;\n this.Gl = 0xfb41bd6b | 0;\n this.Hh = 0x5be0cd19 | 0;\n this.Hl = 0x137e2179 | 0;\n }\n // prettier-ignore\n get() {\n const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];\n }\n // prettier-ignore\n set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {\n this.Ah = Ah | 0;\n this.Al = Al | 0;\n this.Bh = Bh | 0;\n this.Bl = Bl | 0;\n this.Ch = Ch | 0;\n this.Cl = Cl | 0;\n this.Dh = Dh | 0;\n this.Dl = Dl | 0;\n this.Eh = Eh | 0;\n this.El = El | 0;\n this.Fh = Fh | 0;\n this.Fl = Fl | 0;\n this.Gh = Gh | 0;\n this.Gl = Gl | 0;\n this.Hh = Hh | 0;\n this.Hl = Hl | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) {\n SHA512_W_H[i] = view.getUint32(offset);\n SHA512_W_L[i] = view.getUint32((offset += 4));\n }\n for (let i = 16; i < 80; i++) {\n // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)\n const W15h = SHA512_W_H[i - 15] | 0;\n const W15l = SHA512_W_L[i - 15] | 0;\n const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);\n const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);\n // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)\n const W2h = SHA512_W_H[i - 2] | 0;\n const W2l = SHA512_W_L[i - 2] | 0;\n const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);\n const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);\n // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];\n const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);\n const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);\n SHA512_W_H[i] = SUMh | 0;\n SHA512_W_L[i] = SUMl | 0;\n }\n let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n // Compression function main loop, 80 rounds\n for (let i = 0; i < 80; i++) {\n // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)\n const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);\n const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);\n //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const CHIh = (Eh & Fh) ^ (~Eh & Gh);\n const CHIl = (El & Fl) ^ (~El & Gl);\n // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]\n // prettier-ignore\n const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);\n const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);\n const T1l = T1ll | 0;\n // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)\n const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);\n const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);\n const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);\n const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);\n Hh = Gh | 0;\n Hl = Gl | 0;\n Gh = Fh | 0;\n Gl = Fl | 0;\n Fh = Eh | 0;\n Fl = El | 0;\n ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));\n Dh = Ch | 0;\n Dl = Cl | 0;\n Ch = Bh | 0;\n Cl = Bl | 0;\n Bh = Ah | 0;\n Bl = Al | 0;\n const All = u64.add3L(T1l, sigma0l, MAJl);\n Ah = u64.add3H(All, T1h, sigma0h, MAJh);\n Al = All | 0;\n }\n // Add the compressed chunk to the current hash value\n ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));\n ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));\n ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));\n ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));\n ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));\n ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));\n ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));\n ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));\n this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);\n }\n roundClean() {\n SHA512_W_H.fill(0);\n SHA512_W_L.fill(0);\n }\n destroy() {\n this.buffer.fill(0);\n this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n }\n}\nexport class SHA512_224 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x8c3d37c8 | 0;\n this.Al = 0x19544da2 | 0;\n this.Bh = 0x73e19966 | 0;\n this.Bl = 0x89dcd4d6 | 0;\n this.Ch = 0x1dfab7ae | 0;\n this.Cl = 0x32ff9c82 | 0;\n this.Dh = 0x679dd514 | 0;\n this.Dl = 0x582f9fcf | 0;\n this.Eh = 0x0f6d2b69 | 0;\n this.El = 0x7bd44da8 | 0;\n this.Fh = 0x77e36f73 | 0;\n this.Fl = 0x04c48942 | 0;\n this.Gh = 0x3f9d85a8 | 0;\n this.Gl = 0x6a1d36c8 | 0;\n this.Hh = 0x1112e6ad | 0;\n this.Hl = 0x91d692a1 | 0;\n this.outputLen = 28;\n }\n}\nexport class SHA512_256 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x22312194 | 0;\n this.Al = 0xfc2bf72c | 0;\n this.Bh = 0x9f555fa3 | 0;\n this.Bl = 0xc84c64c2 | 0;\n this.Ch = 0x2393b86b | 0;\n this.Cl = 0x6f53b151 | 0;\n this.Dh = 0x96387719 | 0;\n this.Dl = 0x5940eabd | 0;\n this.Eh = 0x96283ee2 | 0;\n this.El = 0xa88effe3 | 0;\n this.Fh = 0xbe5e1e25 | 0;\n this.Fl = 0x53863992 | 0;\n this.Gh = 0x2b0199fc | 0;\n this.Gl = 0x2c85b8aa | 0;\n this.Hh = 0x0eb72ddc | 0;\n this.Hl = 0x81c52ca2 | 0;\n this.outputLen = 32;\n }\n}\nexport class SHA384 extends SHA512 {\n constructor() {\n super();\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0xcbbb9d5d | 0;\n this.Al = 0xc1059ed8 | 0;\n this.Bh = 0x629a292a | 0;\n this.Bl = 0x367cd507 | 0;\n this.Ch = 0x9159015a | 0;\n this.Cl = 0x3070dd17 | 0;\n this.Dh = 0x152fecd8 | 0;\n this.Dl = 0xf70e5939 | 0;\n this.Eh = 0x67332667 | 0;\n this.El = 0xffc00b31 | 0;\n this.Fh = 0x8eb44a87 | 0;\n this.Fl = 0x68581511 | 0;\n this.Gh = 0xdb0c2e0d | 0;\n this.Gl = 0x64f98fa7 | 0;\n this.Hh = 0x47b5481d | 0;\n this.Hl = 0xbefa4fa4 | 0;\n this.outputLen = 48;\n }\n}\nexport const sha512 = /* @__PURE__ */ wrapConstructor(() => new SHA512());\nexport const sha512_224 = /* @__PURE__ */ wrapConstructor(() => new SHA512_224());\nexport const sha512_256 = /* @__PURE__ */ wrapConstructor(() => new SHA512_256());\nexport const sha384 = /* @__PURE__ */ wrapConstructor(() => new SHA384());\n//# sourceMappingURL=sha512.js.map"],"names":["Chi","a","b","c","Maj","HashMD","Hash","constructor","blockLen","outputLen","padOffset","isLE","super","this","finished","length","pos","destroyed","buffer","Uint8Array","view","createView","update","data","aexists","len","toBytes","take","Math","min","set","subarray","process","dataView","roundClean","digestInto","out","aoutput","fill","i","byteOffset","value","setBigUint64","_32n","BigInt","_u32_max","wh","Number","wl","h","l","setUint32","oview","Error","outLen","state","get","digest","res","slice","destroy","_cloneInto","to","SHA256_K","Uint32Array","SHA256_IV","SHA256_W","SHA256","A","B","C","D","E","F","G","H","offset","getUint32","W15","W2","s0","rotr","s1","T1","T2","SHA224","sha256","wrapConstructor","sha224","SHA512_Kh","SHA512_Kl","u64","split","map","n","SHA512_W_H","SHA512_W_L","SHA512","Ah","Al","Bh","Bl","Ch","Cl","Dh","Dl","Eh","El","Fh","Fl","Gh","Gl","Hh","Hl","W15h","W15l","s0h","rotrSH","shrSH","s0l","rotrSL","shrSL","W2h","W2l","s1h","rotrBH","s1l","rotrBL","SUMl","add4L","SUMh","add4H","sigma1h","sigma1l","CHIh","CHIl","T1ll","add5L","T1h","add5H","T1l","sigma0h","sigma0l","MAJh","MAJl","add","All","add3L","add3H","SHA384","sha512","sha384"],"mappings":";kLAoBY,MAACA,EAAM,CAACC,EAAGC,EAAGC,IAAOF,EAAIC,GAAOD,EAAIE,EAInCC,EAAM,CAACH,EAAGC,EAAGC,IAAOF,EAAIC,EAAMD,EAAIE,EAAMD,EAAIC,EAKlD,MAAME,UAAeC,EACxB,WAAAC,CAAYC,EAAUC,EAAWC,EAAWC,GACxCC,QACAC,KAAKL,SAAWA,EAChBK,KAAKJ,UAAYA,EACjBI,KAAKH,UAAYA,EACjBG,KAAKF,KAAOA,EACZE,KAAKC,UAAW,EAChBD,KAAKE,OAAS,EACdF,KAAKG,IAAM,EACXH,KAAKI,WAAY,EACjBJ,KAAKK,OAAS,IAAIC,WAAWX,GAC7BK,KAAKO,KAAOC,EAAWR,KAAKK,OACpC,CACI,MAAAI,CAAOC,GACHC,EA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,MAAC6I,iBAAyB/D,GAAgB,IAAM,IAAIU,IAGnDsD,iBAAyBhE,GAAgB,IAAM,IAAI8D","x_google_ignoreList":[0,1,2]}
@@ -0,0 +1,436 @@
1
+ /*! OpenPGP.js v6.0.1 - 2024-11-25 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
2
+ const globalThis = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
3
+
4
+ import { H as Hash, h as createView, b as aexists, t as toBytes, i as aoutput, w as wrapConstructor, j as rotr, k as u64 } from './sha3.mjs';
5
+
6
+ /**
7
+ * Polyfill for Safari 14
8
+ */
9
+ function setBigUint64(view, byteOffset, value, isLE) {
10
+ if (typeof view.setBigUint64 === 'function')
11
+ return view.setBigUint64(byteOffset, value, isLE);
12
+ const _32n = BigInt(32);
13
+ const _u32_max = BigInt(0xffffffff);
14
+ const wh = Number((value >> _32n) & _u32_max);
15
+ const wl = Number(value & _u32_max);
16
+ const h = isLE ? 4 : 0;
17
+ const l = isLE ? 0 : 4;
18
+ view.setUint32(byteOffset + h, wh, isLE);
19
+ view.setUint32(byteOffset + l, wl, isLE);
20
+ }
21
+ /**
22
+ * Choice: a ? b : c
23
+ */
24
+ const Chi = (a, b, c) => (a & b) ^ (~a & c);
25
+ /**
26
+ * Majority function, true if any two inputs is true
27
+ */
28
+ const Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c);
29
+ /**
30
+ * Merkle-Damgard hash construction base class.
31
+ * Could be used to create MD5, RIPEMD, SHA1, SHA2.
32
+ */
33
+ class HashMD extends Hash {
34
+ constructor(blockLen, outputLen, padOffset, isLE) {
35
+ super();
36
+ this.blockLen = blockLen;
37
+ this.outputLen = outputLen;
38
+ this.padOffset = padOffset;
39
+ this.isLE = isLE;
40
+ this.finished = false;
41
+ this.length = 0;
42
+ this.pos = 0;
43
+ this.destroyed = false;
44
+ this.buffer = new Uint8Array(blockLen);
45
+ this.view = createView(this.buffer);
46
+ }
47
+ update(data) {
48
+ aexists(this);
49
+ const { view, buffer, blockLen } = this;
50
+ data = toBytes(data);
51
+ const len = data.length;
52
+ for (let pos = 0; pos < len;) {
53
+ const take = Math.min(blockLen - this.pos, len - pos);
54
+ // Fast path: we have at least one block in input, cast it to view and process
55
+ if (take === blockLen) {
56
+ const dataView = createView(data);
57
+ for (; blockLen <= len - pos; pos += blockLen)
58
+ this.process(dataView, pos);
59
+ continue;
60
+ }
61
+ buffer.set(data.subarray(pos, pos + take), this.pos);
62
+ this.pos += take;
63
+ pos += take;
64
+ if (this.pos === blockLen) {
65
+ this.process(view, 0);
66
+ this.pos = 0;
67
+ }
68
+ }
69
+ this.length += data.length;
70
+ this.roundClean();
71
+ return this;
72
+ }
73
+ digestInto(out) {
74
+ aexists(this);
75
+ aoutput(out, this);
76
+ this.finished = true;
77
+ // Padding
78
+ // We can avoid allocation of buffer for padding completely if it
79
+ // was previously not allocated here. But it won't change performance.
80
+ const { buffer, view, blockLen, isLE } = this;
81
+ let { pos } = this;
82
+ // append the bit '1' to the message
83
+ buffer[pos++] = 0b10000000;
84
+ this.buffer.subarray(pos).fill(0);
85
+ // we have less than padOffset left in buffer, so we cannot put length in
86
+ // current block, need process it and pad again
87
+ if (this.padOffset > blockLen - pos) {
88
+ this.process(view, 0);
89
+ pos = 0;
90
+ }
91
+ // Pad until full block byte with zeros
92
+ for (let i = pos; i < blockLen; i++)
93
+ buffer[i] = 0;
94
+ // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that
95
+ // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.
96
+ // So we just write lowest 64 bits of that value.
97
+ setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
98
+ this.process(view, 0);
99
+ const oview = createView(out);
100
+ const len = this.outputLen;
101
+ // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT
102
+ if (len % 4)
103
+ throw new Error('_sha2: outputLen should be aligned to 32bit');
104
+ const outLen = len / 4;
105
+ const state = this.get();
106
+ if (outLen > state.length)
107
+ throw new Error('_sha2: outputLen bigger than state');
108
+ for (let i = 0; i < outLen; i++)
109
+ oview.setUint32(4 * i, state[i], isLE);
110
+ }
111
+ digest() {
112
+ const { buffer, outputLen } = this;
113
+ this.digestInto(buffer);
114
+ const res = buffer.slice(0, outputLen);
115
+ this.destroy();
116
+ return res;
117
+ }
118
+ _cloneInto(to) {
119
+ to || (to = new this.constructor());
120
+ to.set(...this.get());
121
+ const { blockLen, buffer, length, finished, destroyed, pos } = this;
122
+ to.length = length;
123
+ to.pos = pos;
124
+ to.finished = finished;
125
+ to.destroyed = destroyed;
126
+ if (length % blockLen)
127
+ to.buffer.set(buffer);
128
+ return to;
129
+ }
130
+ }
131
+
132
+ // SHA2-256 need to try 2^128 hashes to execute birthday attack.
133
+ // BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per late 2024.
134
+ // Round constants:
135
+ // first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311)
136
+ // prettier-ignore
137
+ const SHA256_K = /* @__PURE__ */ new Uint32Array([
138
+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
139
+ 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
140
+ 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
141
+ 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
142
+ 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
143
+ 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
144
+ 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
145
+ 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
146
+ ]);
147
+ // Initial state:
148
+ // first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19
149
+ // prettier-ignore
150
+ const SHA256_IV = /* @__PURE__ */ new Uint32Array([
151
+ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
152
+ ]);
153
+ // Temporary buffer, not used to store anything between runs
154
+ // Named this way because it matches specification.
155
+ const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
156
+ class SHA256 extends HashMD {
157
+ constructor() {
158
+ super(64, 32, 8, false);
159
+ // We cannot use array here since array allows indexing by variable
160
+ // which means optimizer/compiler cannot use registers.
161
+ this.A = SHA256_IV[0] | 0;
162
+ this.B = SHA256_IV[1] | 0;
163
+ this.C = SHA256_IV[2] | 0;
164
+ this.D = SHA256_IV[3] | 0;
165
+ this.E = SHA256_IV[4] | 0;
166
+ this.F = SHA256_IV[5] | 0;
167
+ this.G = SHA256_IV[6] | 0;
168
+ this.H = SHA256_IV[7] | 0;
169
+ }
170
+ get() {
171
+ const { A, B, C, D, E, F, G, H } = this;
172
+ return [A, B, C, D, E, F, G, H];
173
+ }
174
+ // prettier-ignore
175
+ set(A, B, C, D, E, F, G, H) {
176
+ this.A = A | 0;
177
+ this.B = B | 0;
178
+ this.C = C | 0;
179
+ this.D = D | 0;
180
+ this.E = E | 0;
181
+ this.F = F | 0;
182
+ this.G = G | 0;
183
+ this.H = H | 0;
184
+ }
185
+ process(view, offset) {
186
+ // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array
187
+ for (let i = 0; i < 16; i++, offset += 4)
188
+ SHA256_W[i] = view.getUint32(offset, false);
189
+ for (let i = 16; i < 64; i++) {
190
+ const W15 = SHA256_W[i - 15];
191
+ const W2 = SHA256_W[i - 2];
192
+ const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);
193
+ const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);
194
+ SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;
195
+ }
196
+ // Compression function main loop, 64 rounds
197
+ let { A, B, C, D, E, F, G, H } = this;
198
+ for (let i = 0; i < 64; i++) {
199
+ const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
200
+ const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;
201
+ const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
202
+ const T2 = (sigma0 + Maj(A, B, C)) | 0;
203
+ H = G;
204
+ G = F;
205
+ F = E;
206
+ E = (D + T1) | 0;
207
+ D = C;
208
+ C = B;
209
+ B = A;
210
+ A = (T1 + T2) | 0;
211
+ }
212
+ // Add the compressed chunk to the current hash value
213
+ A = (A + this.A) | 0;
214
+ B = (B + this.B) | 0;
215
+ C = (C + this.C) | 0;
216
+ D = (D + this.D) | 0;
217
+ E = (E + this.E) | 0;
218
+ F = (F + this.F) | 0;
219
+ G = (G + this.G) | 0;
220
+ H = (H + this.H) | 0;
221
+ this.set(A, B, C, D, E, F, G, H);
222
+ }
223
+ roundClean() {
224
+ SHA256_W.fill(0);
225
+ }
226
+ destroy() {
227
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
228
+ this.buffer.fill(0);
229
+ }
230
+ }
231
+ // Constants from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf
232
+ class SHA224 extends SHA256 {
233
+ constructor() {
234
+ super();
235
+ this.A = 0xc1059ed8 | 0;
236
+ this.B = 0x367cd507 | 0;
237
+ this.C = 0x3070dd17 | 0;
238
+ this.D = 0xf70e5939 | 0;
239
+ this.E = 0xffc00b31 | 0;
240
+ this.F = 0x68581511 | 0;
241
+ this.G = 0x64f98fa7 | 0;
242
+ this.H = 0xbefa4fa4 | 0;
243
+ this.outputLen = 28;
244
+ }
245
+ }
246
+ /**
247
+ * SHA2-256 hash function
248
+ * @param message - data that would be hashed
249
+ */
250
+ const sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256());
251
+ /**
252
+ * SHA2-224 hash function
253
+ */
254
+ const sha224 = /* @__PURE__ */ wrapConstructor(() => new SHA224());
255
+
256
+ // Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409):
257
+ // prettier-ignore
258
+ const [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => u64.split([
259
+ '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',
260
+ '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',
261
+ '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',
262
+ '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',
263
+ '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',
264
+ '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',
265
+ '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',
266
+ '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',
267
+ '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',
268
+ '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',
269
+ '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',
270
+ '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',
271
+ '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',
272
+ '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',
273
+ '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',
274
+ '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',
275
+ '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',
276
+ '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',
277
+ '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',
278
+ '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'
279
+ ].map(n => BigInt(n))))();
280
+ // Temporary buffer, not used to store anything between runs
281
+ const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);
282
+ const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);
283
+ class SHA512 extends HashMD {
284
+ constructor() {
285
+ super(128, 64, 16, false);
286
+ // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers.
287
+ // Also looks cleaner and easier to verify with spec.
288
+ // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):
289
+ // h -- high 32 bits, l -- low 32 bits
290
+ this.Ah = 0x6a09e667 | 0;
291
+ this.Al = 0xf3bcc908 | 0;
292
+ this.Bh = 0xbb67ae85 | 0;
293
+ this.Bl = 0x84caa73b | 0;
294
+ this.Ch = 0x3c6ef372 | 0;
295
+ this.Cl = 0xfe94f82b | 0;
296
+ this.Dh = 0xa54ff53a | 0;
297
+ this.Dl = 0x5f1d36f1 | 0;
298
+ this.Eh = 0x510e527f | 0;
299
+ this.El = 0xade682d1 | 0;
300
+ this.Fh = 0x9b05688c | 0;
301
+ this.Fl = 0x2b3e6c1f | 0;
302
+ this.Gh = 0x1f83d9ab | 0;
303
+ this.Gl = 0xfb41bd6b | 0;
304
+ this.Hh = 0x5be0cd19 | 0;
305
+ this.Hl = 0x137e2179 | 0;
306
+ }
307
+ // prettier-ignore
308
+ get() {
309
+ const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
310
+ return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];
311
+ }
312
+ // prettier-ignore
313
+ set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {
314
+ this.Ah = Ah | 0;
315
+ this.Al = Al | 0;
316
+ this.Bh = Bh | 0;
317
+ this.Bl = Bl | 0;
318
+ this.Ch = Ch | 0;
319
+ this.Cl = Cl | 0;
320
+ this.Dh = Dh | 0;
321
+ this.Dl = Dl | 0;
322
+ this.Eh = Eh | 0;
323
+ this.El = El | 0;
324
+ this.Fh = Fh | 0;
325
+ this.Fl = Fl | 0;
326
+ this.Gh = Gh | 0;
327
+ this.Gl = Gl | 0;
328
+ this.Hh = Hh | 0;
329
+ this.Hl = Hl | 0;
330
+ }
331
+ process(view, offset) {
332
+ // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array
333
+ for (let i = 0; i < 16; i++, offset += 4) {
334
+ SHA512_W_H[i] = view.getUint32(offset);
335
+ SHA512_W_L[i] = view.getUint32((offset += 4));
336
+ }
337
+ for (let i = 16; i < 80; i++) {
338
+ // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)
339
+ const W15h = SHA512_W_H[i - 15] | 0;
340
+ const W15l = SHA512_W_L[i - 15] | 0;
341
+ const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);
342
+ const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);
343
+ // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)
344
+ const W2h = SHA512_W_H[i - 2] | 0;
345
+ const W2l = SHA512_W_L[i - 2] | 0;
346
+ const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);
347
+ const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);
348
+ // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];
349
+ const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);
350
+ const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);
351
+ SHA512_W_H[i] = SUMh | 0;
352
+ SHA512_W_L[i] = SUMl | 0;
353
+ }
354
+ let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
355
+ // Compression function main loop, 80 rounds
356
+ for (let i = 0; i < 80; i++) {
357
+ // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)
358
+ const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);
359
+ const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);
360
+ //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;
361
+ const CHIh = (Eh & Fh) ^ (~Eh & Gh);
362
+ const CHIl = (El & Fl) ^ (~El & Gl);
363
+ // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]
364
+ // prettier-ignore
365
+ const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);
366
+ const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);
367
+ const T1l = T1ll | 0;
368
+ // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)
369
+ const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);
370
+ const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);
371
+ const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);
372
+ const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);
373
+ Hh = Gh | 0;
374
+ Hl = Gl | 0;
375
+ Gh = Fh | 0;
376
+ Gl = Fl | 0;
377
+ Fh = Eh | 0;
378
+ Fl = El | 0;
379
+ ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
380
+ Dh = Ch | 0;
381
+ Dl = Cl | 0;
382
+ Ch = Bh | 0;
383
+ Cl = Bl | 0;
384
+ Bh = Ah | 0;
385
+ Bl = Al | 0;
386
+ const All = u64.add3L(T1l, sigma0l, MAJl);
387
+ Ah = u64.add3H(All, T1h, sigma0h, MAJh);
388
+ Al = All | 0;
389
+ }
390
+ // Add the compressed chunk to the current hash value
391
+ ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
392
+ ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
393
+ ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));
394
+ ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
395
+ ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
396
+ ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
397
+ ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
398
+ ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
399
+ this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
400
+ }
401
+ roundClean() {
402
+ SHA512_W_H.fill(0);
403
+ SHA512_W_L.fill(0);
404
+ }
405
+ destroy() {
406
+ this.buffer.fill(0);
407
+ this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
408
+ }
409
+ }
410
+ class SHA384 extends SHA512 {
411
+ constructor() {
412
+ super();
413
+ // h -- high 32 bits, l -- low 32 bits
414
+ this.Ah = 0xcbbb9d5d | 0;
415
+ this.Al = 0xc1059ed8 | 0;
416
+ this.Bh = 0x629a292a | 0;
417
+ this.Bl = 0x367cd507 | 0;
418
+ this.Ch = 0x9159015a | 0;
419
+ this.Cl = 0x3070dd17 | 0;
420
+ this.Dh = 0x152fecd8 | 0;
421
+ this.Dl = 0xf70e5939 | 0;
422
+ this.Eh = 0x67332667 | 0;
423
+ this.El = 0xffc00b31 | 0;
424
+ this.Fh = 0x8eb44a87 | 0;
425
+ this.Fl = 0x68581511 | 0;
426
+ this.Gh = 0xdb0c2e0d | 0;
427
+ this.Gl = 0x64f98fa7 | 0;
428
+ this.Hh = 0x47b5481d | 0;
429
+ this.Hl = 0xbefa4fa4 | 0;
430
+ this.outputLen = 48;
431
+ }
432
+ }
433
+ const sha512 = /* @__PURE__ */ wrapConstructor(() => new SHA512());
434
+ const sha384 = /* @__PURE__ */ wrapConstructor(() => new SHA384());
435
+
436
+ export { Chi as C, HashMD as H, Maj as M, sha384 as a, sha512 as b, sha224 as c, sha256 as s };