@protontech/openpgp 6.0.0-beta.0.patch.0 → 6.0.0-beta.2
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.
- package/README.md +2 -2
- package/dist/lightweight/argon2id.min.mjs +2 -2
- package/dist/lightweight/argon2id.min.mjs.map +1 -1
- package/dist/lightweight/argon2id.mjs +5 -28
- package/dist/lightweight/legacy_ciphers.min.mjs +2 -2
- package/dist/lightweight/legacy_ciphers.min.mjs.map +1 -1
- package/dist/lightweight/legacy_ciphers.mjs +6 -51
- package/dist/lightweight/noble_curves.min.mjs +11 -11
- package/dist/lightweight/noble_curves.min.mjs.map +1 -1
- package/dist/lightweight/noble_curves.mjs +477 -465
- package/dist/lightweight/noble_hashes.min.mjs +2 -2
- package/dist/lightweight/noble_hashes.min.mjs.map +1 -1
- package/dist/lightweight/noble_hashes.mjs +19 -31
- package/dist/lightweight/openpgp.min.mjs +3 -2
- package/dist/lightweight/openpgp.min.mjs.map +1 -1
- package/dist/lightweight/openpgp.mjs +1529 -552
- package/dist/lightweight/sha3.min.mjs +3 -3
- package/dist/lightweight/sha3.min.mjs.map +1 -1
- package/dist/lightweight/sha3.mjs +80 -80
- package/dist/node/openpgp.cjs +2199 -5545
- package/dist/node/openpgp.min.cjs +12 -12
- package/dist/node/openpgp.min.cjs.map +1 -1
- package/dist/node/openpgp.min.mjs +12 -12
- package/dist/node/openpgp.min.mjs.map +1 -1
- package/dist/node/openpgp.mjs +2198 -5545
- package/dist/openpgp.js +2188 -5542
- package/dist/openpgp.min.js +12 -12
- package/dist/openpgp.min.js.map +1 -1
- package/dist/openpgp.min.mjs +12 -12
- package/dist/openpgp.min.mjs.map +1 -1
- package/dist/openpgp.mjs +2188 -5542
- package/openpgp.d.ts +69 -61
- package/package.json +20 -13
- package/dist/lightweight/bn.interface.min.mjs +0 -3
- package/dist/lightweight/bn.interface.min.mjs.map +0 -1
- package/dist/lightweight/bn.interface.mjs +0 -3807
- package/dist/lightweight/interface.min.mjs +0 -3
- package/dist/lightweight/interface.min.mjs.map +0 -1
- package/dist/lightweight/interface.mjs +0 -16
- package/dist/lightweight/native.interface.min.mjs +0 -3
- package/dist/lightweight/native.interface.min.mjs.map +0 -1
- package/dist/lightweight/native.interface.mjs +0 -456
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! OpenPGP.js v6.0.0-beta.
|
|
2
|
-
"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;import{w as t,
|
|
1
|
+
/*! OpenPGP.js v6.0.0-beta.2 - 2024-07-05 - 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{w as t,g as s,i as h,C as i,M as e,j as n,s as r,a,d as o,k as l,l as f}from"./sha3.min.mjs";const c=/* @__PURE__ */new Uint32Array([1732584193,4023233417,2562383102,271733878,3285377520]),p=/* @__PURE__ */new Uint32Array(80);class d extends s{constructor(){super(64,20,8,!1),this.A=0|c[0],this.B=0|c[1],this.C=0|c[2],this.D=0|c[3],this.E=0|c[4]}get(){const{A:t,B:s,C:h,D:i,E:e}=this;return[t,s,h,i,e]}set(t,s,h,i,e){this.A=0|t,this.B=0|s,this.C=0|h,this.D=0|i,this.E=0|e}process(t,s){for(let h=0;h<16;h++,s+=4)p[h]=t.getUint32(s,!1);for(let t=16;t<80;t++)p[t]=h(p[t-3]^p[t-8]^p[t-14]^p[t-16],1);let{A:n,B:r,C:a,D:o,E:l}=this;for(let t=0;t<80;t++){let s,f;t<20?(s=i(r,a,o),f=1518500249):t<40?(s=r^a^o,f=1859775393):t<60?(s=e(r,a,o),f=2400959708):(s=r^a^o,f=3395469782);const c=h(n,5)+s+l+f+p[t]|0;l=o,o=a,a=h(r,30),r=n,n=c}n=n+this.A|0,r=r+this.B|0,a=a+this.C|0,o=o+this.D|0,l=l+this.E|0,this.set(n,r,a,o,l)}roundClean(){p.fill(0)}destroy(){this.set(0,0,0,0,0),this.buffer.fill(0)}}const u=/* @__PURE__ */t((()=>new d)),w=/* @__PURE__ */new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),y=/* @__PURE__ */new Uint8Array(Array(16).fill(0).map(((t,s)=>s)));let A=[y],m=[/* @__PURE__ */y.map((t=>(9*t+5)%16))];for(let t=0;t<4;t++)for(let s of[A,m])s.push(s[t].map((t=>w[t])));const U=/* @__PURE__ */[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map((t=>new Uint8Array(t))),C=/* @__PURE__ */A.map(((t,s)=>t.map((t=>U[s][t])))),g=/* @__PURE__ */m.map(((t,s)=>t.map((t=>U[s][t])))),b=/* @__PURE__ */new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),B=/* @__PURE__ */new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]);function D(t,s,h,i){return 0===t?s^h^i:1===t?s&h|~s&i:2===t?(s|~h)^i:3===t?s&i|h&~i:s^(h|~i)}const E=/* @__PURE__ */new Uint32Array(16);class j extends s{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:t,h1:s,h2:h,h3:i,h4:e}=this;return[t,s,h,i,e]}set(t,s,h,i,e){this.h0=0|t,this.h1=0|s,this.h2=0|h,this.h3=0|i,this.h4=0|e}process(t,s){for(let h=0;h<16;h++,s+=4)E[h]=t.getUint32(s,!0);let i=0|this.h0,e=i,n=0|this.h1,r=n,a=0|this.h2,o=a,l=0|this.h3,f=l,c=0|this.h4,p=c;for(let t=0;t<5;t++){const s=4-t,d=b[t],u=B[t],w=A[t],y=m[t],U=C[t],j=g[t];for(let s=0;s<16;s++){const e=h(i+D(t,n,a,l)+E[w[s]]+d,U[s])+c|0;i=c,c=l,l=0|h(a,10),a=n,n=e}for(let t=0;t<16;t++){const i=h(e+D(s,r,o,f)+E[y[t]]+u,j[t])+p|0;e=p,p=f,f=0|h(o,10),o=r,r=i}}this.set(this.h1+a+f|0,this.h2+l+p|0,this.h3+c+e|0,this.h4+i+r|0,this.h0+n+o|0)}roundClean(){E.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const x=new Map(Object.entries({sha1:u,sha224:n,sha256:r,sha384:a,sha512:o,sha3_256:l,sha3_512:f,ripemd160:/* @__PURE__ */t((()=>new j))}));export{x as nobleHashes};
|
|
3
3
|
//# sourceMappingURL=noble_hashes.min.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noble_hashes.min.mjs","sources":["../../node_modules/@openpgp/noble-hashes/esm/sha1.js","../../node_modules/@openpgp/noble-hashes/esm/ripemd160.js","../../src/crypto/hash/noble_hashes.js"],"sourcesContent":["import { SHA2 } from './_sha2.js';\nimport { wrapConstructor } from './utils.js';\n// SHA1 was cryptographically broken.\n// It is still widely used in legacy apps. Don't use it for a new protocol.\n// RFC 3174\nconst rotl = (word, shift) => (word << shift) | ((word >>> (32 - shift)) >>> 0);\n// Choice: a ? b : c\nconst Chi = (a, b, c) => (a & b) ^ (~a & c);\n// Majority function, true if any two inpust is true\nconst Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c);\n// Initial state\nconst IV = /* @__PURE__ */ new Uint32Array([\n 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0,\n]);\n// Temporary buffer, not used to store anything between runs\n// Named this way because it matches specification.\nconst SHA1_W = /* @__PURE__ */ new Uint32Array(80);\nclass SHA1 extends SHA2 {\n constructor() {\n super(64, 20, 8, false);\n this.A = IV[0] | 0;\n this.B = IV[1] | 0;\n this.C = IV[2] | 0;\n this.D = IV[3] | 0;\n this.E = IV[4] | 0;\n }\n get() {\n const { A, B, C, D, E } = this;\n return [A, B, C, D, E];\n }\n set(A, B, C, D, E) {\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 }\n process(view, offset) {\n for (let i = 0; i < 16; i++, offset += 4)\n SHA1_W[i] = view.getUint32(offset, false);\n for (let i = 16; i < 80; i++)\n SHA1_W[i] = rotl(SHA1_W[i - 3] ^ SHA1_W[i - 8] ^ SHA1_W[i - 14] ^ SHA1_W[i - 16], 1);\n // Compression function main loop, 80 rounds\n let { A, B, C, D, E } = this;\n for (let i = 0; i < 80; i++) {\n let F, K;\n if (i < 20) {\n F = Chi(B, C, D);\n K = 0x5a827999;\n }\n else if (i < 40) {\n F = B ^ C ^ D;\n K = 0x6ed9eba1;\n }\n else if (i < 60) {\n F = Maj(B, C, D);\n K = 0x8f1bbcdc;\n }\n else {\n F = B ^ C ^ D;\n K = 0xca62c1d6;\n }\n const T = (rotl(A, 5) + F + E + K + SHA1_W[i]) | 0;\n E = D;\n D = C;\n C = rotl(B, 30);\n B = A;\n A = T;\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 this.set(A, B, C, D, E);\n }\n roundClean() {\n SHA1_W.fill(0);\n }\n destroy() {\n this.set(0, 0, 0, 0, 0);\n this.buffer.fill(0);\n }\n}\nexport const sha1 = /* @__PURE__ */ wrapConstructor(() => new SHA1());\n//# sourceMappingURL=sha1.js.map","import { SHA2 } from './_sha2.js';\nimport { wrapConstructor } from './utils.js';\n// https://homes.esat.kuleuven.be/~bosselae/ripemd160.html\n// https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf\nconst Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]);\nconst Id = /* @__PURE__ */ new Uint8Array(new Array(16).fill(0).map((_, i) => i));\nconst Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16);\nlet idxL = [Id];\nlet idxR = [Pi];\nfor (let i = 0; i < 4; i++)\n for (let j of [idxL, idxR])\n j.push(j[i].map((k) => Rho[k]));\nconst shifts = /* @__PURE__ */ [\n [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],\n [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],\n [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],\n [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],\n [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5],\n].map((i) => new Uint8Array(i));\nconst shiftsL = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts[i][j]));\nconst shiftsR = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts[i][j]));\nconst Kl = /* @__PURE__ */ new Uint32Array([\n 0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e,\n]);\nconst Kr = /* @__PURE__ */ new Uint32Array([\n 0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000,\n]);\n// The rotate left (circular left shift) operation for uint32\nconst rotl = (word, shift) => (word << shift) | (word >>> (32 - shift));\n// It's called f() in spec.\nfunction f(group, x, y, z) {\n if (group === 0)\n return x ^ y ^ z;\n else if (group === 1)\n return (x & y) | (~x & z);\n else if (group === 2)\n return (x | ~y) ^ z;\n else if (group === 3)\n return (x & z) | (y & ~z);\n else\n return x ^ (y | ~z);\n}\n// Temporary buffer, not used to store anything between runs\nconst BUF = /* @__PURE__ */ new Uint32Array(16);\nexport class RIPEMD160 extends SHA2 {\n constructor() {\n super(64, 20, 8, true);\n this.h0 = 0x67452301 | 0;\n this.h1 = 0xefcdab89 | 0;\n this.h2 = 0x98badcfe | 0;\n this.h3 = 0x10325476 | 0;\n this.h4 = 0xc3d2e1f0 | 0;\n }\n get() {\n const { h0, h1, h2, h3, h4 } = this;\n return [h0, h1, h2, h3, h4];\n }\n set(h0, h1, h2, h3, h4) {\n this.h0 = h0 | 0;\n this.h1 = h1 | 0;\n this.h2 = h2 | 0;\n this.h3 = h3 | 0;\n this.h4 = h4 | 0;\n }\n process(view, offset) {\n for (let i = 0; i < 16; i++, offset += 4)\n BUF[i] = view.getUint32(offset, true);\n // prettier-ignore\n let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el;\n // Instead of iterating 0 to 80, we split it into 5 groups\n // And use the groups in constants, functions, etc. Much simpler\n for (let group = 0; group < 5; group++) {\n const rGroup = 4 - group;\n const hbl = Kl[group], hbr = Kr[group]; // prettier-ignore\n const rl = idxL[group], rr = idxR[group]; // prettier-ignore\n const sl = shiftsL[group], sr = shiftsR[group]; // prettier-ignore\n for (let i = 0; i < 16; i++) {\n const tl = (rotl(al + f(group, bl, cl, dl) + BUF[rl[i]] + hbl, sl[i]) + el) | 0;\n al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore\n }\n // 2 loops are 10% faster\n for (let i = 0; i < 16; i++) {\n const tr = (rotl(ar + f(rGroup, br, cr, dr) + BUF[rr[i]] + hbr, sr[i]) + er) | 0;\n ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; // prettier-ignore\n }\n }\n // Add the compressed chunk to the current hash value\n this.set((this.h1 + cl + dr) | 0, (this.h2 + dl + er) | 0, (this.h3 + el + ar) | 0, (this.h4 + al + br) | 0, (this.h0 + bl + cr) | 0);\n }\n roundClean() {\n BUF.fill(0);\n }\n destroy() {\n this.destroyed = true;\n this.buffer.fill(0);\n this.set(0, 0, 0, 0, 0);\n }\n}\n/**\n * RIPEMD-160 - a hash function from 1990s.\n * @param message - msg that would be hashed\n */\nexport const ripemd160 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160());\n//# sourceMappingURL=ripemd160.js.map","/**\n * This file is needed to dynamic import the noble-hashes.\n * Separate dynamic imports are not convenient as they result in too many chunks,\n * which share a lot of code anyway.\n */\n\nimport { sha1 } from '@openpgp/noble-hashes/sha1';\nimport { sha224, sha256 } from '@openpgp/noble-hashes/sha256';\nimport { sha384, sha512 } from '@openpgp/noble-hashes/sha512';\nimport { sha3_256, sha3_512 } from '@openpgp/noble-hashes/sha3';\nimport { ripemd160 } from '@openpgp/noble-hashes/ripemd160';\n\nexport const nobleHashes = new Map(Object.entries({\n sha1,\n sha224,\n sha256,\n sha384,\n sha512,\n sha3_256,\n sha3_512,\n ripemd160\n}));\n"],"names":["rotl","word","shift","Maj","a","b","c","IV","Uint32Array","SHA1_W","SHA1","SHA2","constructor","super","this","A","B","C","D","E","get","set","process","view","offset","i","getUint32","F","K","T","roundClean","fill","destroy","buffer","sha1","wrapConstructor","Rho","Uint8Array","Id","Array","map","_","idxL","idxR","j","push","k","shifts","shiftsL","idx","shiftsR","Kl","Kr","f","group","x","y","z","BUF","RIPEMD160","h0","h1","h2","h3","h4","al","ar","bl","br","cl","cr","dl","dr","el","er","rGroup","hbl","hbr","rl","rr","sl","sr","tl","tr","destroyed","nobleHashes","Map","Object","entries","sha224","sha256","sha384","sha512","sha3_256","sha3_512","ripemd160"],"mappings":";qRAKA,MAAMA,EAAO,CAACC,EAAMC,IAAWD,GAAQC,EAAWD,IAAU,GAAKC,IAAY,EAIvEC,EAAM,CAACC,EAAGC,EAAGC,IAAOF,EAAIC,EAAMD,EAAIE,EAAMD,EAAIC,EAE5CC,iBAAqB,IAAIC,YAAY,CACvC,WAAY,WAAY,WAAY,UAAY,aAI9CC,iBAAyB,IAAID,YAAY,IAC/C,MAAME,UAAaC,EACf,WAAAC,GACIC,MAAM,GAAI,GAAI,GAAG,GACjBC,KAA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AAMd,EAAIqB,EAAGtD,IAAMoD,EAAKI,EAAGxD,IAAMiD,EAAM,EAC/ER,EAAKQ,EAAIA,EAAKF,EAAIA,EAAoB,EAAfxE,EAAKsE,EAAI,IAASA,EAAKF,EAAIA,EAAKe,CAC1D,CACJ,CAEDrE,KAAKO,IAAKP,KAAK+C,GAAKQ,EAAKG,EAAM,EAAI1D,KAAKgD,GAAKS,EAAKG,EAAM,EAAI5D,KAAKiD,GAAKU,EAAKP,EAAM,EAAIpD,KAAKkD,GAAKC,EAAKG,EAAM,EAAItD,KAAK8C,GAAKO,EAAKG,EAAM,EACtI,CACD,UAAAxC,GACI4B,EAAI3B,KAAK,EACZ,CACD,OAAAC,GACIlB,KAAKsE,WAAY,EACjBtE,KAAKmB,OAAOF,KAAK,GACjBjB,KAAKO,IAAI,EAAG,EAAG,EAAG,EAAG,EACxB,EAME,MC1FMgE,EAAc,IAAIC,IAAIC,OAAOC,QAAQ,CAChDtD,OACAuD,SACAC,SACAC,SACAC,SACAC,WACAC,WACAC,yBDkFuC5D,GAAgB,IAAM,IAAIwB","x_google_ignoreList":[0,1]}
|
|
1
|
+
{"version":3,"file":"noble_hashes.min.mjs","sources":["../../node_modules/@noble/hashes/esm/sha1.js","../../node_modules/@noble/hashes/esm/ripemd160.js","../../src/crypto/hash/noble_hashes.js"],"sourcesContent":["import { HashMD, Chi, Maj } from './_md.js';\nimport { rotl, wrapConstructor } from './utils.js';\n// SHA1 (RFC 3174) was cryptographically broken. It's still used. Don't use it for a new protocol.\n// Initial state\nconst SHA1_IV = /* @__PURE__ */ new Uint32Array([\n 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0,\n]);\n// Temporary buffer, not used to store anything between runs\n// Named this way because it matches specification.\nconst SHA1_W = /* @__PURE__ */ new Uint32Array(80);\nclass SHA1 extends HashMD {\n constructor() {\n super(64, 20, 8, false);\n this.A = SHA1_IV[0] | 0;\n this.B = SHA1_IV[1] | 0;\n this.C = SHA1_IV[2] | 0;\n this.D = SHA1_IV[3] | 0;\n this.E = SHA1_IV[4] | 0;\n }\n get() {\n const { A, B, C, D, E } = this;\n return [A, B, C, D, E];\n }\n set(A, B, C, D, E) {\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 }\n process(view, offset) {\n for (let i = 0; i < 16; i++, offset += 4)\n SHA1_W[i] = view.getUint32(offset, false);\n for (let i = 16; i < 80; i++)\n SHA1_W[i] = rotl(SHA1_W[i - 3] ^ SHA1_W[i - 8] ^ SHA1_W[i - 14] ^ SHA1_W[i - 16], 1);\n // Compression function main loop, 80 rounds\n let { A, B, C, D, E } = this;\n for (let i = 0; i < 80; i++) {\n let F, K;\n if (i < 20) {\n F = Chi(B, C, D);\n K = 0x5a827999;\n }\n else if (i < 40) {\n F = B ^ C ^ D;\n K = 0x6ed9eba1;\n }\n else if (i < 60) {\n F = Maj(B, C, D);\n K = 0x8f1bbcdc;\n }\n else {\n F = B ^ C ^ D;\n K = 0xca62c1d6;\n }\n const T = (rotl(A, 5) + F + E + K + SHA1_W[i]) | 0;\n E = D;\n D = C;\n C = rotl(B, 30);\n B = A;\n A = T;\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 this.set(A, B, C, D, E);\n }\n roundClean() {\n SHA1_W.fill(0);\n }\n destroy() {\n this.set(0, 0, 0, 0, 0);\n this.buffer.fill(0);\n }\n}\nexport const sha1 = /* @__PURE__ */ wrapConstructor(() => new SHA1());\n//# sourceMappingURL=sha1.js.map","import { HashMD } from './_md.js';\nimport { rotl, wrapConstructor } from './utils.js';\n// https://homes.esat.kuleuven.be/~bosselae/ripemd160.html\n// https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf\nconst Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]);\nconst Id = /* @__PURE__ */ new Uint8Array(new Array(16).fill(0).map((_, i) => i));\nconst Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16);\nlet idxL = [Id];\nlet idxR = [Pi];\nfor (let i = 0; i < 4; i++)\n for (let j of [idxL, idxR])\n j.push(j[i].map((k) => Rho[k]));\nconst shifts = /* @__PURE__ */ [\n [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],\n [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],\n [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],\n [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],\n [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5],\n].map((i) => new Uint8Array(i));\nconst shiftsL = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts[i][j]));\nconst shiftsR = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts[i][j]));\nconst Kl = /* @__PURE__ */ new Uint32Array([\n 0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e,\n]);\nconst Kr = /* @__PURE__ */ new Uint32Array([\n 0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000,\n]);\n// It's called f() in spec.\nfunction f(group, x, y, z) {\n if (group === 0)\n return x ^ y ^ z;\n else if (group === 1)\n return (x & y) | (~x & z);\n else if (group === 2)\n return (x | ~y) ^ z;\n else if (group === 3)\n return (x & z) | (y & ~z);\n else\n return x ^ (y | ~z);\n}\n// Temporary buffer, not used to store anything between runs\nconst R_BUF = /* @__PURE__ */ new Uint32Array(16);\nexport class RIPEMD160 extends HashMD {\n constructor() {\n super(64, 20, 8, true);\n this.h0 = 0x67452301 | 0;\n this.h1 = 0xefcdab89 | 0;\n this.h2 = 0x98badcfe | 0;\n this.h3 = 0x10325476 | 0;\n this.h4 = 0xc3d2e1f0 | 0;\n }\n get() {\n const { h0, h1, h2, h3, h4 } = this;\n return [h0, h1, h2, h3, h4];\n }\n set(h0, h1, h2, h3, h4) {\n this.h0 = h0 | 0;\n this.h1 = h1 | 0;\n this.h2 = h2 | 0;\n this.h3 = h3 | 0;\n this.h4 = h4 | 0;\n }\n process(view, offset) {\n for (let i = 0; i < 16; i++, offset += 4)\n R_BUF[i] = view.getUint32(offset, true);\n // prettier-ignore\n let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el;\n // Instead of iterating 0 to 80, we split it into 5 groups\n // And use the groups in constants, functions, etc. Much simpler\n for (let group = 0; group < 5; group++) {\n const rGroup = 4 - group;\n const hbl = Kl[group], hbr = Kr[group]; // prettier-ignore\n const rl = idxL[group], rr = idxR[group]; // prettier-ignore\n const sl = shiftsL[group], sr = shiftsR[group]; // prettier-ignore\n for (let i = 0; i < 16; i++) {\n const tl = (rotl(al + f(group, bl, cl, dl) + R_BUF[rl[i]] + hbl, sl[i]) + el) | 0;\n al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore\n }\n // 2 loops are 10% faster\n for (let i = 0; i < 16; i++) {\n const tr = (rotl(ar + f(rGroup, br, cr, dr) + R_BUF[rr[i]] + hbr, sr[i]) + er) | 0;\n ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; // prettier-ignore\n }\n }\n // Add the compressed chunk to the current hash value\n this.set((this.h1 + cl + dr) | 0, (this.h2 + dl + er) | 0, (this.h3 + el + ar) | 0, (this.h4 + al + br) | 0, (this.h0 + bl + cr) | 0);\n }\n roundClean() {\n R_BUF.fill(0);\n }\n destroy() {\n this.destroyed = true;\n this.buffer.fill(0);\n this.set(0, 0, 0, 0, 0);\n }\n}\n/**\n * RIPEMD-160 - a hash function from 1990s.\n * @param message - msg that would be hashed\n */\nexport const ripemd160 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160());\n//# sourceMappingURL=ripemd160.js.map","/**\n * This file is needed to dynamic import the noble-hashes.\n * Separate dynamic imports are not convenient as they result in too many chunks,\n * which share a lot of code anyway.\n */\n\nimport { sha1 } from '@noble/hashes/sha1';\nimport { sha224, sha256 } from '@noble/hashes/sha256';\nimport { sha384, sha512 } from '@noble/hashes/sha512';\nimport { sha3_256, sha3_512 } from '@noble/hashes/sha3';\nimport { ripemd160 } from '@noble/hashes/ripemd160';\n\nexport const nobleHashes = new Map(Object.entries({\n sha1,\n sha224,\n sha256,\n sha384,\n sha512,\n sha3_256,\n sha3_512,\n ripemd160\n}));\n"],"names":["SHA1_IV","Uint32Array","SHA1_W","SHA1","HashMD","constructor","super","this","A","B","C","D","E","get","set","process","view","offset","i","getUint32","rotl","F","K","Chi","Maj","T","roundClean","fill","destroy","buffer","sha1","wrapConstructor","Rho","Uint8Array","Id","Array","map","_","idxL","idxR","j","push","k","shifts","shiftsL","idx","shiftsR","Kl","Kr","f","group","x","y","z","R_BUF","RIPEMD160","h0","h1","h2","h3","h4","al","ar","bl","br","cl","cr","dl","dr","el","er","rGroup","hbl","hbr","rl","rr","sl","sr","tl","tr","destroyed","nobleHashes","Map","Object","entries","sha224","sha256","sha384","sha512","sha3_256","sha3_512","ripemd160"],"mappings":";uMAIA,MAAMA,iBAA0B,IAAIC,YAAY,CAC5C,WAAY,WAAY,WAAY,UAAY,aAI9CC,iBAAyB,IAAID,YAAY,IAC/C,MAAME,UAAaC,EACf,WAAAC,GACIC,MAAM,GAAI,GAAI,GAAG,GACjBC,KAAKC,EAAiB,EAAbR,EAAQ,GACjBO,KAAKE,EAAiB,EAAbT,EAAQ,GACjBO,KAAKG,EAAiB,EAAbV,EAAQ,GACjBO,KAAKI,EAAiB,EAAbX,EAAQ,GACjBO,KAAKK,EAAiB,EAAbZ,EAAQ,EACpB,CACD,GAAAa,GACI,MAAML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,EAAI/D,KAAKoD,GAAKU,EAAKP,EAAM,EAAIvD,KAAKqD,GAAKC,EAAKG,EAAM,EAAIzD,KAAKiD,GAAKO,EAAKG,EAAM,EACtI,CACD,UAAAxC,GACI4B,EAAM3B,KAAK,EACd,CACD,OAAAC,GACIrB,KAAKyE,WAAY,EACjBzE,KAAKsB,OAAOF,KAAK,GACjBpB,KAAKO,IAAI,EAAG,EAAG,EAAG,EAAG,EACxB,EAME,MCxFMmE,EAAc,IAAIC,IAAIC,OAAOC,QAAQ,CAChDtD,OACAuD,SACAC,SACAC,SACAC,SACAC,WACAC,WACAC,yBDgFuC5D,GAAgB,IAAM,IAAIwB","x_google_ignoreList":[0,1]}
|
|
@@ -1,34 +1,24 @@
|
|
|
1
|
-
/*! OpenPGP.js v6.0.0-beta.
|
|
1
|
+
/*! OpenPGP.js v6.0.0-beta.2 - 2024-07-05 - 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
|
-
import { w as wrapConstructor,
|
|
5
|
-
import './interface.mjs';
|
|
6
|
-
import './native.interface.mjs';
|
|
7
|
-
import './bn.interface.mjs';
|
|
4
|
+
import { w as wrapConstructor, g as HashMD, i as rotl, C as Chi, M as Maj, j as sha224, s as sha256, a as sha384, d as sha512, k as sha3_256, l as sha3_512 } from './sha3.mjs';
|
|
8
5
|
|
|
9
|
-
// SHA1 was cryptographically broken.
|
|
10
|
-
// It is still widely used in legacy apps. Don't use it for a new protocol.
|
|
11
|
-
// RFC 3174
|
|
12
|
-
const rotl$1 = (word, shift) => (word << shift) | ((word >>> (32 - shift)) >>> 0);
|
|
13
|
-
// Choice: a ? b : c
|
|
14
|
-
const Chi = (a, b, c) => (a & b) ^ (~a & c);
|
|
15
|
-
// Majority function, true if any two inpust is true
|
|
16
|
-
const Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c);
|
|
6
|
+
// SHA1 (RFC 3174) was cryptographically broken. It's still used. Don't use it for a new protocol.
|
|
17
7
|
// Initial state
|
|
18
|
-
const
|
|
8
|
+
const SHA1_IV = /* @__PURE__ */ new Uint32Array([
|
|
19
9
|
0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0,
|
|
20
10
|
]);
|
|
21
11
|
// Temporary buffer, not used to store anything between runs
|
|
22
12
|
// Named this way because it matches specification.
|
|
23
13
|
const SHA1_W = /* @__PURE__ */ new Uint32Array(80);
|
|
24
|
-
class SHA1 extends
|
|
14
|
+
class SHA1 extends HashMD {
|
|
25
15
|
constructor() {
|
|
26
16
|
super(64, 20, 8, false);
|
|
27
|
-
this.A =
|
|
28
|
-
this.B =
|
|
29
|
-
this.C =
|
|
30
|
-
this.D =
|
|
31
|
-
this.E =
|
|
17
|
+
this.A = SHA1_IV[0] | 0;
|
|
18
|
+
this.B = SHA1_IV[1] | 0;
|
|
19
|
+
this.C = SHA1_IV[2] | 0;
|
|
20
|
+
this.D = SHA1_IV[3] | 0;
|
|
21
|
+
this.E = SHA1_IV[4] | 0;
|
|
32
22
|
}
|
|
33
23
|
get() {
|
|
34
24
|
const { A, B, C, D, E } = this;
|
|
@@ -45,7 +35,7 @@ class SHA1 extends SHA2 {
|
|
|
45
35
|
for (let i = 0; i < 16; i++, offset += 4)
|
|
46
36
|
SHA1_W[i] = view.getUint32(offset, false);
|
|
47
37
|
for (let i = 16; i < 80; i++)
|
|
48
|
-
SHA1_W[i] = rotl
|
|
38
|
+
SHA1_W[i] = rotl(SHA1_W[i - 3] ^ SHA1_W[i - 8] ^ SHA1_W[i - 14] ^ SHA1_W[i - 16], 1);
|
|
49
39
|
// Compression function main loop, 80 rounds
|
|
50
40
|
let { A, B, C, D, E } = this;
|
|
51
41
|
for (let i = 0; i < 80; i++) {
|
|
@@ -66,10 +56,10 @@ class SHA1 extends SHA2 {
|
|
|
66
56
|
F = B ^ C ^ D;
|
|
67
57
|
K = 0xca62c1d6;
|
|
68
58
|
}
|
|
69
|
-
const T = (rotl
|
|
59
|
+
const T = (rotl(A, 5) + F + E + K + SHA1_W[i]) | 0;
|
|
70
60
|
E = D;
|
|
71
61
|
D = C;
|
|
72
|
-
C = rotl
|
|
62
|
+
C = rotl(B, 30);
|
|
73
63
|
B = A;
|
|
74
64
|
A = T;
|
|
75
65
|
}
|
|
@@ -116,8 +106,6 @@ const Kl = /* @__PURE__ */ new Uint32Array([
|
|
|
116
106
|
const Kr = /* @__PURE__ */ new Uint32Array([
|
|
117
107
|
0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000,
|
|
118
108
|
]);
|
|
119
|
-
// The rotate left (circular left shift) operation for uint32
|
|
120
|
-
const rotl = (word, shift) => (word << shift) | (word >>> (32 - shift));
|
|
121
109
|
// It's called f() in spec.
|
|
122
110
|
function f(group, x, y, z) {
|
|
123
111
|
if (group === 0)
|
|
@@ -132,8 +120,8 @@ function f(group, x, y, z) {
|
|
|
132
120
|
return x ^ (y | ~z);
|
|
133
121
|
}
|
|
134
122
|
// Temporary buffer, not used to store anything between runs
|
|
135
|
-
const
|
|
136
|
-
class RIPEMD160 extends
|
|
123
|
+
const R_BUF = /* @__PURE__ */ new Uint32Array(16);
|
|
124
|
+
class RIPEMD160 extends HashMD {
|
|
137
125
|
constructor() {
|
|
138
126
|
super(64, 20, 8, true);
|
|
139
127
|
this.h0 = 0x67452301 | 0;
|
|
@@ -155,7 +143,7 @@ class RIPEMD160 extends SHA2 {
|
|
|
155
143
|
}
|
|
156
144
|
process(view, offset) {
|
|
157
145
|
for (let i = 0; i < 16; i++, offset += 4)
|
|
158
|
-
|
|
146
|
+
R_BUF[i] = view.getUint32(offset, true);
|
|
159
147
|
// prettier-ignore
|
|
160
148
|
let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el;
|
|
161
149
|
// Instead of iterating 0 to 80, we split it into 5 groups
|
|
@@ -166,12 +154,12 @@ class RIPEMD160 extends SHA2 {
|
|
|
166
154
|
const rl = idxL[group], rr = idxR[group]; // prettier-ignore
|
|
167
155
|
const sl = shiftsL[group], sr = shiftsR[group]; // prettier-ignore
|
|
168
156
|
for (let i = 0; i < 16; i++) {
|
|
169
|
-
const tl = (rotl(al + f(group, bl, cl, dl) +
|
|
157
|
+
const tl = (rotl(al + f(group, bl, cl, dl) + R_BUF[rl[i]] + hbl, sl[i]) + el) | 0;
|
|
170
158
|
al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore
|
|
171
159
|
}
|
|
172
160
|
// 2 loops are 10% faster
|
|
173
161
|
for (let i = 0; i < 16; i++) {
|
|
174
|
-
const tr = (rotl(ar + f(rGroup, br, cr, dr) +
|
|
162
|
+
const tr = (rotl(ar + f(rGroup, br, cr, dr) + R_BUF[rr[i]] + hbr, sr[i]) + er) | 0;
|
|
175
163
|
ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; // prettier-ignore
|
|
176
164
|
}
|
|
177
165
|
}
|
|
@@ -179,7 +167,7 @@ class RIPEMD160 extends SHA2 {
|
|
|
179
167
|
this.set((this.h1 + cl + dr) | 0, (this.h2 + dl + er) | 0, (this.h3 + el + ar) | 0, (this.h4 + al + br) | 0, (this.h0 + bl + cr) | 0);
|
|
180
168
|
}
|
|
181
169
|
roundClean() {
|
|
182
|
-
|
|
170
|
+
R_BUF.fill(0);
|
|
183
171
|
}
|
|
184
172
|
destroy() {
|
|
185
173
|
this.destroyed = true;
|