@protontech/openpgp 6.0.2-patch.0 → 6.1.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.
- package/dist/lightweight/argon2id.min.mjs +1 -1
- package/dist/lightweight/argon2id.mjs +1 -1
- 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 +9 -9
- package/dist/lightweight/noble_curves.min.mjs +1 -1
- package/dist/lightweight/noble_curves.mjs +1 -1
- 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 +85 -3
- package/dist/lightweight/noble_post_quantum.min.mjs +1 -1
- package/dist/lightweight/noble_post_quantum.mjs +1 -1
- package/dist/lightweight/openpgp.min.mjs +4 -4
- package/dist/lightweight/openpgp.min.mjs.map +1 -1
- package/dist/lightweight/openpgp.mjs +7806 -8206
- package/dist/lightweight/seek-bzip.min.mjs +1 -1
- package/dist/lightweight/seek-bzip.mjs +1 -1
- package/dist/lightweight/sha3.min.mjs +1 -1
- package/dist/lightweight/sha3.mjs +1 -1
- package/dist/lightweight/sha512.min.mjs +1 -1
- package/dist/lightweight/sha512.mjs +1 -1
- package/dist/node/openpgp.cjs +8165 -8481
- package/dist/node/openpgp.min.cjs +16 -16
- package/dist/node/openpgp.min.cjs.map +1 -1
- package/dist/node/openpgp.min.mjs +16 -16
- package/dist/node/openpgp.min.mjs.map +1 -1
- package/dist/node/openpgp.mjs +8165 -8481
- package/dist/openpgp.js +8159 -8475
- package/dist/openpgp.min.js +16 -16
- package/dist/openpgp.min.js.map +1 -1
- package/dist/openpgp.min.mjs +16 -16
- package/dist/openpgp.min.mjs.map +1 -1
- package/dist/openpgp.mjs +8159 -8475
- package/openpgp.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
/*! OpenPGP.js v6.
|
|
1
|
+
/*! OpenPGP.js v6.1.0 - 2025-02-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 { enums } from './openpgp.mjs';
|
|
5
|
-
|
|
6
4
|
//Paul Tero, July 2001
|
|
7
5
|
//http://www.tero.co.uk/des/
|
|
8
6
|
//
|
|
@@ -1774,11 +1772,13 @@ BF.blockSize = BF.prototype.blockSize = 8;
|
|
|
1774
1772
|
*/
|
|
1775
1773
|
|
|
1776
1774
|
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1775
|
+
// We avoid importing 'enums' as this module is lazy loaded, and doing so could mess up
|
|
1776
|
+
// chunking for the lightweight build
|
|
1777
|
+
const legacyCiphers = new Map(Object.entries({
|
|
1778
|
+
tripledes: TripleDES,
|
|
1779
|
+
cast5: CAST5,
|
|
1780
|
+
twofish: TF,
|
|
1781
|
+
blowfish: BF
|
|
1782
|
+
}));
|
|
1783
1783
|
|
|
1784
1784
|
export { legacyCiphers };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! OpenPGP.js v6.
|
|
1
|
+
/*! OpenPGP.js v6.1.0 - 2025-02-05 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
|
|
2
2
|
"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;import{s as t,a as e,b as n}from"./sha512.min.mjs";import{H as r,a as f,t as i,b as o,c as s,d as a,r as c,w as d,u,s as l}from"./sha3.min.mjs";class h extends r{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,f(t);const n=i(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,o=new Uint8Array(r);o.set(n.length>r?t.create().update(n).digest():n);for(let t=0;t<o.length;t++)o[t]^=54;this.iHash.update(o),this.oHash=t.create();for(let t=0;t<o.length;t++)o[t]^=106;this.oHash.update(o),o.fill(0)}update(t){return o(this),this.iHash.update(t),this}digestInto(t){o(this),s(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:n,finished:r,destroyed:f,blockLen:i,outputLen:o}=this;return t.finished=r,t.destroyed=f,t.blockLen=i,t.outputLen=o,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const g=(t,e,n)=>new h(t,e).update(n).digest();g.create=(t,e)=>new h(t,e)
|
|
3
3
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */;const b=/* @__PURE__ */BigInt(0),y=/* @__PURE__ */BigInt(1),p=/* @__PURE__ */BigInt(2);function m(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name}function w(t){if(!m(t))throw Error("Uint8Array expected")}function B(t,e){if("boolean"!=typeof e)throw Error(t+" boolean expected, got "+e)}const E=/* @__PURE__ */Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function x(t){w(t);let e="";for(let n=0;n<t.length;n++)e+=E[t[n]];return e}function I(t){const e=t.toString(16);return 1&e.length?"0"+e:e}function v(t){if("string"!=typeof t)throw Error("hex string expected, got "+typeof t);return""===t?b:BigInt("0x"+t)}const S={_0:48,_9:57,A:65,F:70,a:97,f:102};function A(t){return t>=S._0&&t<=S._9?t-S._0:t>=S.A&&t<=S.F?t-(S.A-10):t>=S.a&&t<=S.f?t-(S.a-10):void 0}function O(t){if("string"!=typeof t)throw Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw Error("hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let e=0,f=0;e<n;e++,f+=2){const n=A(t.charCodeAt(f)),i=A(t.charCodeAt(f+1));if(void 0===n||void 0===i){const e=t[f]+t[f+1];throw Error('hex string expected, got non-hex character "'+e+'" at index '+f)}r[e]=16*n+i}return r}function R(t){return v(x(t))}function z(t){return w(t),v(x(Uint8Array.from(t).reverse()))}function q(t,e){return O(t.toString(16).padStart(2*e,"0"))}function P(t,e){return q(t,e).reverse()}function N(t,e,n){let r;if("string"==typeof e)try{r=O(e)}catch(e){throw Error(t+" must be hex string or Uint8Array, cause: "+e)}else{if(!m(e))throw Error(t+" must be hex string or Uint8Array");r=Uint8Array.from(e)}const f=r.length;if("number"==typeof n&&f!==n)throw Error(t+" of length "+n+" expected, got "+f);return r}function H(...t){let e=0;for(let n=0;n<t.length;n++){const r=t[n];w(r),e+=r.length}const n=new Uint8Array(e);for(let e=0,r=0;e<t.length;e++){const f=t[e];n.set(f,r),r+=f.length}return n}const L=t=>"bigint"==typeof t&&b<=t;function T(t,e,n){return L(t)&&L(e)&&L(n)&&e<=t&&t<n}function F(t,e,n,r){if(!T(e,n,r))throw Error("expected valid "+t+": "+n+" <= n < "+r+", got "+e)}function U(t){let e;for(e=0;t>b;t>>=y,e+=1);return e}const Z=t=>(p<<BigInt(t-1))-y,k=t=>new Uint8Array(t),G=t=>Uint8Array.from(t);function C(t,e,n){if("number"!=typeof t||t<2)throw Error("hashLen must be a number");if("number"!=typeof e||e<2)throw Error("qByteLen must be a number");if("function"!=typeof n)throw Error("hmacFn must be a function");let r=k(t),f=k(t),i=0;const o=()=>{r.fill(1),f.fill(0),i=0},s=(...t)=>n(f,r,...t),a=(t=k())=>{f=s(G([0]),t),r=s(),0!==t.length&&(f=s(G([1]),t),r=s())},c=()=>{if(i++>=1e3)throw Error("drbg: tried 1000 values");let t=0;const n=[];for(;t<e;){r=s();const e=r.slice();n.push(e),t+=r.length}return H(...n)};return(t,e)=>{let n;for(o(),a(t);!(n=e(c()));)a();return o(),n}}const j={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||m(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function V(t,e,n={}){const r=(e,n,r)=>{const f=j[n];if("function"!=typeof f)throw Error("invalid validator function");const i=t[e];if(!(r&&void 0===i||f(i,t)))throw Error("param "+e+" is invalid. Expected "+n+", got "+i)};for(const[t,n]of Object.entries(e))r(t,n,!1);for(const[t,e]of Object.entries(n))r(t,e,!0);return t}function _(t){const e=new WeakMap;return(n,...r)=>{const f=e.get(n);if(void 0!==f)return f;const i=t(n,...r);return e.set(n,i),i}}var K=/*#__PURE__*/Object.freeze({__proto__:null,aInRange:F,abool:B,abytes:w,bitGet:function(t,e){return t>>BigInt(e)&y},bitLen:U,bitMask:Z,bitSet:function(t,e,n){return t|(n?y:b)<<BigInt(e)},bytesToHex:x,bytesToNumberBE:R,bytesToNumberLE:z,concatBytes:H,createHmacDrbg:C,ensureBytes:N,equalBytes:function(t,e){if(t.length!==e.length)return!1;let n=0;for(let r=0;r<t.length;r++)n|=t[r]^e[r];return 0===n},hexToBytes:O,hexToNumber:v,inRange:T,isBytes:m,memoized:_,notImplemented:()=>{throw Error("not implemented")},numberToBytesBE:q,numberToBytesLE:P,numberToHexUnpadded:I,numberToVarBytesBE:function(t){return O(I(t))},utf8ToBytes:function(t){if("string"!=typeof t)throw Error("string expected");return new Uint8Array((new TextEncoder).encode(t))},validateObject:V});
|
|
4
4
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Y=BigInt(0),M=BigInt(1),D=/* @__PURE__ */BigInt(2),W=/* @__PURE__ */BigInt(3),J=/* @__PURE__ */BigInt(4),Q=/* @__PURE__ */BigInt(5),X=/* @__PURE__ */BigInt(8);function $(t,e){const n=t%e;return n>=Y?n:e+n}function tt(t,e,n){if(e<Y)throw Error("invalid exponent, negatives unsupported");if(n<=Y)throw Error("invalid modulus");if(n===M)return Y;let r=M;for(;e>Y;)e&M&&(r=r*t%n),t=t*t%n,e>>=M;return r}function et(t,e,n){let r=t;for(;e-- >Y;)r*=r,r%=n;return r}function nt(t,e){if(t===Y)throw Error("invert: expected non-zero number");if(e<=Y)throw Error("invert: expected positive modulus, got "+e);let n=$(t,e),r=e,f=Y,i=M;for(;n!==Y;){const t=r%n,e=f-i*(r/n);r=n,n=t,f=i,i=e}if(r!==M)throw Error("invert: does not exist");return $(f,e)}function rt(t){if(t%J===W){const e=(t+M)/J;return function(t,n){const r=t.pow(n,e);if(!t.eql(t.sqr(r),n))throw Error("Cannot find square root");return r}}if(t%X===Q){const e=(t-Q)/X;return function(t,n){const r=t.mul(n,D),f=t.pow(r,e),i=t.mul(n,f),o=t.mul(t.mul(i,D),f),s=t.mul(i,t.sub(o,t.ONE));if(!t.eql(t.sqr(s),n))throw Error("Cannot find square root");return s}}return function(t){const e=(t-M)/D;let n,r,f;for(n=t-M,r=0;n%D===Y;n/=D,r++);for(f=D;f<t&&tt(f,e,t)!==t-M;f++)if(f>1e3)throw Error("Cannot find square root: likely non-prime P");if(1===r){const e=(t+M)/J;return function(t,n){const r=t.pow(n,e);if(!t.eql(t.sqr(r),n))throw Error("Cannot find square root");return r}}const i=(n+M)/D;return function(t,o){if(t.pow(o,e)===t.neg(t.ONE))throw Error("Cannot find square root");let s=r,a=t.pow(t.mul(t.ONE,f),n),c=t.pow(o,i),d=t.pow(o,n);for(;!t.eql(d,t.ONE);){if(t.eql(d,t.ZERO))return t.ZERO;let e=1;for(let n=t.sqr(d);e<s&&!t.eql(n,t.ONE);e++)n=t.sqr(n);const n=t.pow(a,M<<BigInt(s-e-1));a=t.sqr(n),c=t.mul(c,n),d=t.mul(d,a),s=e}return c}}(t)}const ft=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function it(t,e){const n=void 0!==e?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function ot(t,e,n=!1,r={}){if(t<=Y)throw Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:f,nByteLength:i}=it(t,e);if(i>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let o;const s=Object.freeze({ORDER:t,BITS:f,BYTES:i,MASK:Z(f),ZERO:Y,ONE:M,create:e=>$(e,t),isValid:e=>{if("bigint"!=typeof e)throw Error("invalid field element: expected bigint, got "+typeof e);return Y<=e&&e<t},is0:t=>t===Y,isOdd:t=>(t&M)===M,neg:e=>$(-e,t),eql:(t,e)=>t===e,sqr:e=>$(e*e,t),add:(e,n)=>$(e+n,t),sub:(e,n)=>$(e-n,t),mul:(e,n)=>$(e*n,t),pow:(t,e)=>function(t,e,n){if(n<Y)throw Error("invalid exponent, negatives unsupported");if(n===Y)return t.ONE;if(n===M)return e;let r=t.ONE,f=e;for(;n>Y;)n&M&&(r=t.mul(r,f)),f=t.sqr(f),n>>=M;return r}(s,t,e),div:(e,n)=>$(e*nt(n,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>nt(e,t),sqrt:r.sqrt||(e=>(o||(o=rt(t)),o(s,e))),invertBatch:t=>function(t,e){const n=Array(e.length),r=e.reduce(((e,r,f)=>t.is0(r)?e:(n[f]=e,t.mul(e,r))),t.ONE),f=t.inv(r);return e.reduceRight(((e,r,f)=>t.is0(r)?e:(n[f]=t.mul(e,n[f]),t.mul(e,r))),f),n}(s,t),cmov:(t,e,n)=>n?e:t,toBytes:t=>n?P(t,i):q(t,i),fromBytes:t=>{if(t.length!==i)throw Error("Field.fromBytes: expected "+i+" bytes, got "+t.length);return n?z(t):R(t)}});return Object.freeze(s)}function st(t){if("bigint"!=typeof t)throw Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function at(t){const e=st(t);return e+Math.ceil(e/2)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! OpenPGP.js v6.
|
|
1
|
+
/*! OpenPGP.js v6.1.0 - 2025-02-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
4
|
import { s as sha256, a as sha384, b as sha512 } from './sha512.mjs';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! OpenPGP.js v6.
|
|
2
|
-
"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;import{H as t,C as s,M as h,c as i,s as e,a as
|
|
1
|
+
/*! OpenPGP.js v6.1.0 - 2025-02-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{H as t,C as s,M as h,c as i,s as e,a as r,b as n}from"./sha512.min.mjs";import{w as o,e as a,f as l,g as f}from"./sha3.min.mjs";const c=/* @__PURE__ */new Uint32Array([1732584193,4023233417,2562383102,271733878,3285377520]),p=/* @__PURE__ */new Uint32Array(80);class A extends t{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,i){for(let s=0;s<16;s++,i+=4)p[s]=t.getUint32(i,!1);for(let t=16;t<80;t++)p[t]=a(p[t-3]^p[t-8]^p[t-14]^p[t-16],1);let{A:e,B:r,C:n,D:o,E:l}=this;for(let t=0;t<80;t++){let i,f;t<20?(i=s(r,n,o),f=1518500249):t<40?(i=r^n^o,f=1859775393):t<60?(i=h(r,n,o),f=2400959708):(i=r^n^o,f=3395469782);const c=a(e,5)+i+l+f+p[t]|0;l=o,o=n,n=a(r,30),r=e,e=c}e=e+this.A|0,r=r+this.B|0,n=n+this.C|0,o=o+this.D|0,l=l+this.E|0,this.set(e,r,n,o,l)}roundClean(){p.fill(0)}destroy(){this.set(0,0,0,0,0),this.buffer.fill(0)}}const d=/* @__PURE__ */o((()=>new A)),u=/* @__PURE__ */new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),m=/* @__PURE__ */new Uint8Array(Array(16).fill(0).map(((t,s)=>s)));let w=[m],y=[/* @__PURE__ */m.map((t=>(9*t+5)%16))];for(let t=0;t<4;t++)for(let s of[w,y])s.push(s[t].map((t=>u[t])));const C=/* @__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))),U=/* @__PURE__ */w.map(((t,s)=>t.map((t=>C[s][t])))),g=/* @__PURE__ */y.map(((t,s)=>t.map((t=>C[s][t])))),B=/* @__PURE__ */new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),D=/* @__PURE__ */new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]);function b(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 M extends t{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 h=0|this.h0,i=h,e=0|this.h1,r=e,n=0|this.h2,o=n,l=0|this.h3,f=l,c=0|this.h4,p=c;for(let t=0;t<5;t++){const s=4-t,A=B[t],d=D[t],u=w[t],m=y[t],C=U[t],M=g[t];for(let s=0;s<16;s++){const i=a(h+b(t,e,n,l)+E[u[s]]+A,C[s])+c|0;h=c,c=l,l=0|a(n,10),n=e,e=i}for(let t=0;t<16;t++){const h=a(i+b(s,r,o,f)+E[m[t]]+d,M[t])+p|0;i=p,p=f,f=0|a(o,10),o=r,r=h}}this.set(this.h1+n+f|0,this.h2+l+p|0,this.h3+c+i|0,this.h4+h+r|0,this.h0+e+o|0)}roundClean(){E.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const x=/* @__PURE__ */o((()=>new M)),j=Array.from({length:64},((t,s)=>Math.floor(2**32*Math.abs(Math.sin(s+1))))),_=(t,s,h)=>t&s^~t&h,H=/* @__PURE__ */new Uint32Array([1732584193,4023233417,2562383102,271733878]),O=/* @__PURE__ */new Uint32Array(16);class k extends t{constructor(){super(64,16,8,!0),this.A=0|H[0],this.B=0|H[1],this.C=0|H[2],this.D=0|H[3]}get(){const{A:t,B:s,C:h,D:i}=this;return[t,s,h,i]}set(t,s,h,i){this.A=0|t,this.B=0|s,this.C=0|h,this.D=0|i}process(t,s){for(let h=0;h<16;h++,s+=4)O[h]=t.getUint32(s,!0);let{A:h,B:i,C:e,D:r}=this;for(let t=0;t<64;t++){let s,n,o;t<16?(s=_(i,e,r),n=t,o=[7,12,17,22]):t<32?(s=_(r,i,e),n=(5*t+1)%16,o=[5,9,14,20]):t<48?(s=i^e^r,n=(3*t+5)%16,o=[4,11,16,23]):(s=e^(i|~r),n=7*t%16,o=[6,10,15,21]),s=s+h+j[t]+O[n],h=r,r=e,e=i,i+=a(s,o[t%4])}h=h+this.A|0,i=i+this.B|0,e=e+this.C|0,r=r+this.D|0,this.set(h,i,e,r)}roundClean(){O.fill(0)}destroy(){this.set(0,0,0,0),this.buffer.fill(0)}}const q=new Map(Object.entries({md5:/* @__PURE__ */o((()=>new k)),sha1:d,sha224:i,sha256:e,sha384:r,sha512:n,sha3_256:l,sha3_512:f,ripemd160:x}));export{q as nobleHashes};
|
|
3
3
|
//# sourceMappingURL=noble_hashes.min.mjs.map
|
|
@@ -1 +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). It was cryptographically broken: prefer newer algorithms.\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);\nexport class 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}\n/**\n * SHA1 (RFC 3174) hash function.\n * It was cryptographically broken: prefer newer algorithms.\n * @param message - data that would be hashed\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":";0OAIA,MAAMA,iBAA0B,IAAIC,YAAY,CAC5C,WAAY,WAAY,WAAY,UAAY,aAI9CC,iBAAyB,IAAID,YAAY,IACxC,MAAME,UAAaC,EACtB,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,EACzB,CACI,GAAAa,GACI,MAAML,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,GAAML,KAC1B,MAAO,CAACC,EAAGC,EAAGC,EAAGC,EAAGC,EAC5B,CACI,GAAAE,CAAIN,EAAGC,EAAGC,EAAGC,EAAGC,GACZL,KAAKC,EAAQ,EAAJA,EACTD,KAAKE,EAAQ,EAAJA,EACTF,KAAKG,EAAQ,EAAJA,EACTH,KAAKI,EAAQ,EAAJA,EACTJ,KAAKK,EAAQ,EAAJA,CACjB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C,OAAOC,QAAQ,CAChDtD,OACAuD,SACAC,SACAC,SACAC,SACAC,WACAC,WACAC,yBDgFuC5D,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/md5.ts","../../src/crypto/hash/noble_hashes.js"],"sourcesContent":["import { HashMD, Chi, Maj } from './_md.js';\nimport { rotl, wrapConstructor } from './utils.js';\n// SHA1 (RFC 3174). It was cryptographically broken: prefer newer algorithms.\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);\nexport class 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}\n/**\n * SHA1 (RFC 3174) hash function.\n * It was cryptographically broken: prefer newer algorithms.\n * @param message - data that would be hashed\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","// Copied from https://github.com/paulmillr/noble-hashes/blob/main/test/misc/md5.ts\n\nimport { HashMD } from '@noble/hashes/_md';\nimport { rotl, wrapConstructor } from '@noble/hashes/utils';\n\n// Per-round constants\nconst K = Array.from({ length: 64 }, (_, i) => Math.floor(2 ** 32 * Math.abs(Math.sin(i + 1))));\n// Choice: a ? b : c\nconst Chi = (a: number, b: number, c: number) => (a & b) ^ (~a & c);\n// Initial state (same as sha1, but 4 u32 instead of 5)\nconst IV = /* @__PURE__ */ new Uint32Array([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]);\n// Temporary buffer, not used to store anything between runs\n// Named this way for SHA1 compat\nconst MD5_W = /* @__PURE__ */ new Uint32Array(16);\nclass MD5 extends HashMD<MD5> {\n private A = IV[0] | 0;\n private B = IV[1] | 0;\n private C = IV[2] | 0;\n private D = IV[3] | 0;\n constructor() {\n super(64, 16, 8, true);\n }\n protected get(): [number, number, number, number] {\n const { A, B, C, D } = this;\n return [A, B, C, D];\n }\n protected set(A: number, B: number, C: number, D: number) {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n }\n protected process(view: DataView, offset: number): void {\n for (let i = 0; i < 16; i++, offset += 4) MD5_W[i] = view.getUint32(offset, true);\n // Compression function main loop, 64 rounds\n let { A, B, C, D } = this;\n for (let i = 0; i < 64; i++) {\n // eslint-disable-next-line one-var, one-var-declaration-per-line\n let F, g, s;\n if (i < 16) {\n // eslint-disable-next-line new-cap\n F = Chi(B, C, D);\n g = i;\n s = [7, 12, 17, 22];\n } else if (i < 32) {\n // eslint-disable-next-line new-cap\n F = Chi(D, B, C);\n g = (5 * i + 1) % 16;\n s = [5, 9, 14, 20];\n } else if (i < 48) {\n F = B ^ C ^ D;\n g = (3 * i + 5) % 16;\n s = [4, 11, 16, 23];\n } else {\n F = C ^ (B | ~D);\n g = (7 * i) % 16;\n s = [6, 10, 15, 21];\n }\n F = F + A + K[i] + MD5_W[g];\n A = D;\n D = C;\n C = B;\n B = B + rotl(F, s[i % 4]);\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 this.set(A, B, C, D);\n }\n protected roundClean() {\n MD5_W.fill(0);\n }\n destroy() {\n this.set(0, 0, 0, 0);\n this.buffer.fill(0);\n }\n}\nexport const md5 = /* @__PURE__ */ wrapConstructor(() => new MD5());\n","/**\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';\nimport { md5 } from './md5';\n\nexport const nobleHashes = new Map(Object.entries({\n md5,\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","ripemd160","from","length","Math","floor","abs","sin","a","b","c","IV","MD5_W","MD5","g","s","nobleHashes","Map","Object","entries","md5","sha224","sha256","sha384","sha512","sha3_256","sha3_512"],"mappings":";0OAIA,MAAMA,iBAA0B,IAAIC,YAAY,CAC5C,WAAY,WAAY,WAAY,UAAY,aAI9CC,iBAAyB,IAAID,YAAY,IACxC,MAAME,UAAaC,EACtB,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,EACzB,CACI,GAAAa,GACI,MAAML,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,GAAML,KAC1B,MAAO,CAACC,EAAGC,EAAGC,EAAGC,EAAGC,EAC5B,CACI,GAA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AIG,EAAGyE,EAAGC,EACN7E,EAAI,IAENG,EAAIE,EAAId,EAAGC,EAAGC,GACdmF,EAAI5E,EACJ6E,EAAI,CAAC,EAAG,GAAI,GAAI,KACP7E,EAAI,IAEbG,EAAIE,EAAIZ,EAAGF,EAAGC,GACdoF,GAAK,EAAI5E,EAAI,GAAK,GAClB6E,EAAI,CAAC,EAAG,EAAG,GAAI,KACN7E,EAAI,IACbG,EAAIZ,EAAIC,EAAIC,EACZmF,GAAK,EAAI5E,EAAI,GAAK,GAClB6E,EAAI,CAAC,EAAG,GAAI,GAAI,MAEhB1E,EAAIX,GAAKD,GAAKE,GACdmF,EAAK,EAAI5E,EAAK,GACd6E,EAAI,CAAC,EAAG,GAAI,GAAI,KAElB1E,EAAIA,EAAIb,EAAIc,EAAEJ,GAAK0E,EAAME,GACzBtF,EAAIG,EACJA,EAAID,EACJA,EAAID,EACJA,GAAQW,EAAKC,EAAG0E,EAAE7E,EAAI,IAGxBV,EAAKA,EAAID,KAAKC,EAAK,EACnBC,EAAKA,EAAIF,KAAKE,EAAK,EACnBC,EAAKA,EAAIH,KAAKG,EAAK,EACnBC,EAAKA,EAAIJ,KAAKI,EAAK,EACnBJ,KAAKO,IAAIN,EAAGC,EAAGC,EAAGC,GAEV,UAAAe,GACRkE,EAAMjE,KAAK,GAEb,OAAAC,GACErB,KAAKO,IAAI,EAAG,EAAG,EAAG,GAClBP,KAAKsB,OAAOF,KAAK,IAGd,MClEMqE,EAAc,IAAIC,IAAIC,OAAOC,QAAQ,CAChDC,mBDiEiCrE,GAAgB,IAAM,IAAI8D,IChE3D/D,OACAuE,SACAC,SACAC,SACAC,SACAC,WACAC,WACAzB","x_google_ignoreList":[0,1]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! OpenPGP.js v6.
|
|
1
|
+
/*! OpenPGP.js v6.1.0 - 2025-02-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 { H as HashMD, C as Chi, M as Maj, c as sha224, s as sha256, a as sha384, b as sha512 } from './sha512.mjs';
|
|
4
|
+
import { H as HashMD, C as Chi$1, M as Maj, c as sha224, s as sha256, a as sha384, b as sha512 } from './sha512.mjs';
|
|
5
5
|
import { w as wrapConstructor, e as rotl, f as sha3_256, g as sha3_512 } from './sha3.mjs';
|
|
6
6
|
|
|
7
7
|
// SHA1 (RFC 3174). It was cryptographically broken: prefer newer algorithms.
|
|
@@ -42,7 +42,7 @@ class SHA1 extends HashMD {
|
|
|
42
42
|
for (let i = 0; i < 80; i++) {
|
|
43
43
|
let F, K;
|
|
44
44
|
if (i < 20) {
|
|
45
|
-
F = Chi(B, C, D);
|
|
45
|
+
F = Chi$1(B, C, D);
|
|
46
46
|
K = 0x5a827999;
|
|
47
47
|
}
|
|
48
48
|
else if (i < 40) {
|
|
@@ -187,6 +187,87 @@ class RIPEMD160 extends HashMD {
|
|
|
187
187
|
*/
|
|
188
188
|
const ripemd160 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160());
|
|
189
189
|
|
|
190
|
+
// Copied from https://github.com/paulmillr/noble-hashes/blob/main/test/misc/md5.ts
|
|
191
|
+
// Per-round constants
|
|
192
|
+
const K = Array.from({ length: 64 }, (_, i) => Math.floor(2 ** 32 * Math.abs(Math.sin(i + 1))));
|
|
193
|
+
// Choice: a ? b : c
|
|
194
|
+
const Chi = (a, b, c) => (a & b) ^ (~a & c);
|
|
195
|
+
// Initial state (same as sha1, but 4 u32 instead of 5)
|
|
196
|
+
const IV = /* @__PURE__ */ new Uint32Array([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]);
|
|
197
|
+
// Temporary buffer, not used to store anything between runs
|
|
198
|
+
// Named this way for SHA1 compat
|
|
199
|
+
const MD5_W = /* @__PURE__ */ new Uint32Array(16);
|
|
200
|
+
class MD5 extends HashMD {
|
|
201
|
+
constructor() {
|
|
202
|
+
super(64, 16, 8, true);
|
|
203
|
+
this.A = IV[0] | 0;
|
|
204
|
+
this.B = IV[1] | 0;
|
|
205
|
+
this.C = IV[2] | 0;
|
|
206
|
+
this.D = IV[3] | 0;
|
|
207
|
+
}
|
|
208
|
+
get() {
|
|
209
|
+
const { A, B, C, D } = this;
|
|
210
|
+
return [A, B, C, D];
|
|
211
|
+
}
|
|
212
|
+
set(A, B, C, D) {
|
|
213
|
+
this.A = A | 0;
|
|
214
|
+
this.B = B | 0;
|
|
215
|
+
this.C = C | 0;
|
|
216
|
+
this.D = D | 0;
|
|
217
|
+
}
|
|
218
|
+
process(view, offset) {
|
|
219
|
+
for (let i = 0; i < 16; i++, offset += 4)
|
|
220
|
+
MD5_W[i] = view.getUint32(offset, true);
|
|
221
|
+
// Compression function main loop, 64 rounds
|
|
222
|
+
let { A, B, C, D } = this;
|
|
223
|
+
for (let i = 0; i < 64; i++) {
|
|
224
|
+
// eslint-disable-next-line one-var, one-var-declaration-per-line
|
|
225
|
+
let F, g, s;
|
|
226
|
+
if (i < 16) {
|
|
227
|
+
// eslint-disable-next-line new-cap
|
|
228
|
+
F = Chi(B, C, D);
|
|
229
|
+
g = i;
|
|
230
|
+
s = [7, 12, 17, 22];
|
|
231
|
+
}
|
|
232
|
+
else if (i < 32) {
|
|
233
|
+
// eslint-disable-next-line new-cap
|
|
234
|
+
F = Chi(D, B, C);
|
|
235
|
+
g = (5 * i + 1) % 16;
|
|
236
|
+
s = [5, 9, 14, 20];
|
|
237
|
+
}
|
|
238
|
+
else if (i < 48) {
|
|
239
|
+
F = B ^ C ^ D;
|
|
240
|
+
g = (3 * i + 5) % 16;
|
|
241
|
+
s = [4, 11, 16, 23];
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
F = C ^ (B | ~D);
|
|
245
|
+
g = (7 * i) % 16;
|
|
246
|
+
s = [6, 10, 15, 21];
|
|
247
|
+
}
|
|
248
|
+
F = F + A + K[i] + MD5_W[g];
|
|
249
|
+
A = D;
|
|
250
|
+
D = C;
|
|
251
|
+
C = B;
|
|
252
|
+
B = B + rotl(F, s[i % 4]);
|
|
253
|
+
}
|
|
254
|
+
// Add the compressed chunk to the current hash value
|
|
255
|
+
A = (A + this.A) | 0;
|
|
256
|
+
B = (B + this.B) | 0;
|
|
257
|
+
C = (C + this.C) | 0;
|
|
258
|
+
D = (D + this.D) | 0;
|
|
259
|
+
this.set(A, B, C, D);
|
|
260
|
+
}
|
|
261
|
+
roundClean() {
|
|
262
|
+
MD5_W.fill(0);
|
|
263
|
+
}
|
|
264
|
+
destroy() {
|
|
265
|
+
this.set(0, 0, 0, 0);
|
|
266
|
+
this.buffer.fill(0);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
const md5 = /* @__PURE__ */ wrapConstructor(() => new MD5());
|
|
270
|
+
|
|
190
271
|
/**
|
|
191
272
|
* This file is needed to dynamic import the noble-hashes.
|
|
192
273
|
* Separate dynamic imports are not convenient as they result in too many chunks,
|
|
@@ -195,6 +276,7 @@ const ripemd160 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160());
|
|
|
195
276
|
|
|
196
277
|
|
|
197
278
|
const nobleHashes = new Map(Object.entries({
|
|
279
|
+
md5,
|
|
198
280
|
sha1,
|
|
199
281
|
sha224,
|
|
200
282
|
sha256,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! OpenPGP.js v6.
|
|
1
|
+
/*! OpenPGP.js v6.1.0 - 2025-02-05 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
|
|
2
2
|
"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;import{c as e,r as t,l as n,s as r,f as o,g as c,m as s,d}from"./sha3.min.mjs";
|
|
3
3
|
/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */const l=e,u=t;function f(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return 0===n}function i(...e){const t=e=>"number"==typeof e?e:e.bytesLen,n=e.reduce(((e,n)=>e+t(n)),0);return{bytesLen:n,encode:r=>{const o=new Uint8Array(n);for(let n=0,c=0;n<e.length;n++){const s=e[n],d=t(s),u="number"==typeof s?r[n]:s.encode(r[n]);l(u,d),o.set(u,c),"number"!=typeof s&&u.fill(0),c+=d}return o},decode:r=>{l(r,n);const o=[];for(const n of e){const e=t(n),c=r.subarray(0,e);o.push("number"==typeof n?c:n.decode(c)),r=r.subarray(e)}return o}}}function a(e,t){const n=t*e.bytesLen;return{bytesLen:n,encode:r=>{if(r.length!==t)throw Error(`vecCoder.encode: wrong length=${r.length}. Expected: ${t}`);const o=new Uint8Array(n);for(let t=0,n=0;t<r.length;t++){const c=e.encode(r[t]);o.set(c,n),c.fill(0),n+=c.length}return o},decode:t=>{l(t,n);const r=[];for(let n=0;n<t.length;n+=e.bytesLen)r.push(e.decode(t.subarray(n,n+e.bytesLen)));return r}}}function y(...e){for(const t of e)if(Array.isArray(t))for(const e of t)e.fill(0);else t.fill(0)}function p(e){return(1<<e)-1}
|
|
4
4
|
/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */function h(e,t=8){const n=e.toString(2).padStart(8,"0").slice(-t).padStart(7,"0").split("").reverse().join("");return Number.parseInt(n,2)}const g=e=>{const{newPoly:t,N:n,Q:r,F:o,ROOT_OF_UNITY:c,brvBits:s,isKyber:d}=e,l=(e,t=r)=>{const n=e%t|0;return 0|(n>=0?n:t+n)};const u=function(){const e=t(n);for(let t=0;t<n;t++){const n=h(t,s),o=BigInt(c)**BigInt(n)%BigInt(r);e[t]=0|Number(o)}return e}(),f=d?128:n,i=d?1:0,a={encode:e=>{for(let t=1,r=128;r>i;r>>=1)for(let o=0;o<n;o+=2*r){const n=u[t++];for(let t=o;t<o+r;t++){const o=l(n*e[t+r]);e[t+r]=0|l(e[t]-o),e[t]=0|l(e[t]+o)}}return e},decode:e=>{for(let t=f-1,r=1+i;r<f+i;r<<=1)for(let o=0;o<n;o+=2*r){const n=u[t--];for(let t=o;t<o+r;t++){const o=e[t];e[t]=l(o+e[t+r]),e[t+r]=l(n*(e[t+r]-o))}}for(let t=0;t<e.length;t++)e[t]=l(o*e[t]);return e}};return{mod:l,smod:(e,t=r)=>{const n=0|l(e,t);return 0|(n>t>>1?n-t:n)},nttZetas:u,NTT:a,bitsCoder:(e,r)=>{const o=p(e),c=e*(n/8);return{bytesLen:c,encode:t=>{const n=new Uint8Array(c);for(let c=0,s=0,d=0,l=0;c<t.length;c++)for(s|=(r.encode(t[c])&o)<<d,d+=e;d>=8;d-=8,s>>=8)n[l++]=s&p(d);return n},decode:c=>{const s=t(n);for(let t=0,n=0,d=0,l=0;t<c.length;t++)for(n|=c[t]<<d,d+=8;d>=e;d-=e,n>>=e)s[l++]=r.decode(n&o);return s}}}}},b=e=>(t,n)=>{n||(n=e.blockLen);const r=new Uint8Array(t.length+2);r.set(t);const o=t.length,c=new Uint8Array(n);let s=e.create({}),d=0,l=0;return{stats:()=>({calls:d,xofs:l}),get:(t,n)=>(r[o+0]=t,r[o+1]=n,s.destroy(),s=e.create({}).update(r),d++,()=>(l++,s.xofInto(c))),clean:()=>{s.destroy(),c.fill(0),r.fill(0)}}},A=/* @__PURE__ */b(n),L=/* @__PURE__ */b(r),w=256,T=3329,{mod:E,nttZetas:m,NTT:K,bitsCoder:U}=g({N:w,Q:T,F:3303,ROOT_OF_UNITY:17,newPoly:e=>new Uint16Array(e),brvBits:7,isKyber:!0}),k=e=>U(e,(e=>{if(e>=12)return{encode:e=>e,decode:e=>e};const t=2**(e-1);return{encode:t=>((t<<e)+T/2)/T,decode:n=>n*T+t>>>e}})(e));function M(e,t){for(let n=0;n<w;n++)e[n]=E(e[n]+t[n])}function B(e,t){for(let s=0;s<128;s++){let d=m[64+(s>>1)];1&s&&(d=-d);const{c0:l,c1:u}=(n=e[2*s+0],r=e[2*s+1],o=t[2*s+0],c=t[2*s+1],{c0:E(r*c*d+n*o),c1:E(n*c+r*o)});e[2*s+0]=l,e[2*s+1]=u}var n,r,o,c;return e}function O(e){const t=new Uint16Array(w);for(let n=0;n<w;){const r=e();if(r.length%3)throw Error("SampleNTT: unaligned block");for(let e=0;n<w&&e+3<=r.length;e+=3){const o=4095&(r[e+0]|r[e+1]<<8),c=4095&(r[e+1]>>4|r[e+2]<<4);o<T&&(t[n++]=o),n<w&&c<T&&(t[n++]=c)}}return t}function F(e,t,n,r){const o=e(r*w/4,t,n),c=new Uint16Array(w),d=s(o);let l=0;for(let e=0,t=0,n=0,o=0;e<d.length;e++){let s=d[e];for(let e=0;e<32;e++)n+=1&s,s>>=1,l+=1,l===r?(o=n,n=0):l===2*r&&(c[t++]=E(o-n),n=0,l=0)}if(l)throw Error("sampleCBD: leftover bits: "+l);return c}const S=e=>{const{K:t,PRF:n,XOF:r,HASH512:o,ETA1:c,ETA2:s,du:d,dv:l}=e,u=k(1),f=k(l),p=k(d),h=i(a(k(12),t),32),g=a(k(12),t),b=i(a(p,t),f),A=i(32,32);return{secretCoder:g,secretKeyLen:g.bytesLen,publicKeyLen:h.bytesLen,cipherTextLen:b.bytesLen,keygen:e=>{const s=new Uint8Array(33);s.set(e),s[32]=t;const d=o(s),[l,u]=A.decode(d),f=[],i=[];for(let e=0;e<t;e++)f.push(K.encode(F(n,u,e,c)));const a=r(l);for(let e=0;e<t;e++){const r=K.encode(F(n,u,t+e,c));for(let n=0;n<t;n++){M(r,B(O(a.get(n,e)),f[n]))}i.push(r)}a.clean();const p={publicKey:h.encode([i,l]),secretKey:g.encode(f)};return y(l,u,f,i,s,d),p},encrypt:(e,o,d)=>{const[l,f]=h.decode(e),i=[];for(let e=0;e<t;e++)i.push(K.encode(F(n,d,e,c)));const a=r(f),p=new Uint16Array(w),g=[];for(let e=0;e<t;e++){const r=F(n,d,t+e,s),o=new Uint16Array(w);for(let n=0;n<t;n++){M(o,B(O(a.get(e,n)),i[n]))}M(r,K.decode(o)),g.push(r),M(p,B(l[e],i[e])),o.fill(0)}a.clean();const A=F(n,d,2*t,s);M(A,K.decode(p));const L=u.decode(o);return M(L,A),y(l,i,p,A),b.encode([g,L])},decrypt:(e,n)=>{const[r,o]=b.decode(e),c=g.decode(n),s=new Uint16Array(w);for(let e=0;e<t;e++)M(s,B(c[e],K.encode(r[e])));return function(e,t){for(let n=0;n<w;n++)e[n]=E(e[n]-t[n])}(o,K.decode(s)),y(s,c,r),u.encode(o)}}};function v(e){const t=S(e),{HASH256:n,HASH512:r,KDF:o}=e,{secretCoder:c,cipherTextLen:s}=t,d=t.publicKeyLen,a=i(t.secretKeyLen,t.publicKeyLen,32,32),p=a.bytesLen;return{publicKeyLen:d,msgLen:32,keygen:(e=u(64))=>{l(e,64);const{publicKey:r,secretKey:o}=t.keygen(e.subarray(0,32)),c=n(r),s=a.encode([o,r,c,e.subarray(32)]);return y(o,c),{publicKey:r,secretKey:s}},encapsulate:(o,s=u(32))=>{l(o,d),l(s,32);const i=o.subarray(0,384*e.K),a=c.encode(c.decode(i.slice()));if(!f(a,i))throw y(a),Error("ML-KEM.encapsulate: wrong publicKey modulus");y(a);const p=r.create().update(s).update(n(o)).digest(),h=t.encrypt(o,s,p.subarray(32,64));return p.subarray(32).fill(0),{cipherText:h,sharedSecret:p.subarray(0,32)}},decapsulate:(e,n)=>{l(n,p),l(e,s);const[c,d,u,i]=a.decode(n),h=t.decrypt(e,c),g=r.create().update(h).update(u).digest(),b=g.subarray(0,32),A=t.encrypt(d,h,g.subarray(32,64)),L=f(e,A),w=o.create({dkLen:32}).update(i).update(e).digest();return y(h,A,L?w:b),L?b:w}}}const N=/* @__PURE__ */v({...{HASH256:o,HASH512:c,KDF:r,XOF:A,PRF:function(e,t,n){return r.create({dkLen:e}).update(t).update(new Uint8Array([n])).digest()}},...{N:w,Q:T,K:3,ETA1:2,ETA2:2,du:10,dv:4,RBGstrength:192}}),R=256,_=8380417,I=13,H=0|Math.floor((_-1)/88),C=0|Math.floor((_-1)/32),x={K:6,L:5,D:I,GAMMA1:2**19,GAMMA2:C,TAU:49,ETA:4,OMEGA:55},G=e=>new Int32Array(e),{mod:Y,smod:D,NTT:P,bitsCoder:X}=g({N:R,Q:_,F:8347681,ROOT_OF_UNITY:1753,newPoly:G,isKyber:!1,brvBits:8}),$=e=>e,Q=(e,t=$,n=$)=>X(e,{encode:e=>t(n(e)),decode:e=>n(t(e))}),j=(e,t)=>{for(let n=0;n<e.length;n++)e[n]=Y(e[n]+t[n]);return e},W=(e,t)=>{for(let n=0;n<e.length;n++)e[n]=Y(e[n]-t[n]);return e},Z=e=>{for(let t=0;t<R;t++)e[t]<<=I;return e},q=(e,t)=>{for(let n=0;n<R;n++)if(Math.abs(D(e[n]))>=t)return!0;return!1},z=(e,t)=>{const n=G(R);for(let r=0;r<e.length;r++)n[r]=Y(e[r]*t[r]);return n};function J(e){const t=G(R);for(let n=0;n<R;){const r=e();if(r.length%3)throw Error("RejNTTPoly: unaligned block");for(let e=0;n<R&&e<=r.length-3;e+=3){const o=8388607&(r[e+0]|r[e+1]<<8|r[e+2]<<16);o<_&&(t[n++]=o)}}return t}const V=new Uint8Array(0);function ee(e){const{K:t,L:n,GAMMA1:o,GAMMA2:c,TAU:s,ETA:p,OMEGA:h}=e,{CRH_BYTES:g,TR_BYTES:b,C_TILDE_BYTES:A,XOF128:L,XOF256:w}=e;if(![2,4].includes(p))throw Error("Wrong ETA");if(![1<<17,1<<19].includes(o))throw Error("Wrong GAMMA1");if(![H,C].includes(c))throw Error("Wrong GAMMA2");const T=s*p,E=e=>{const t=Y(e),n=0|D(t,2*c);if(t-n==_-1)return{r1:0,r0:n-1|0};return{r1:0|Math.floor((t-n)/(2*c)),r0:n}},m=e=>E(e).r1,K=e=>E(e).r0,U=(e,t)=>{const n=Math.floor((_-1)/(2*c)),{r1:r,r0:o}=E(t);return 1===e?o>0?0|Y(r+1,n):0|Y(r-1,n):0|r},k=e=>{const t=Y(e),n=0|D(t,8192);return{r1:0|Math.floor((t-n)/8192),r0:n}},M={bytesLen:h+t,encode:e=>{if(!1===e)throw Error("hint.encode: hint is false");const n=new Uint8Array(h+t);for(let r=0,o=0;r<t;r++){for(let t=0;t<R;t++)0!==e[r][t]&&(n[o++]=t);n[h+r]=o}return n},decode:e=>{const n=[];let r=0;for(let o=0;o<t;o++){const t=G(R);if(e[h+o]<r||e[h+o]>h)return!1;for(let n=r;n<e[h+o];n++){if(n>r&&e[n]<=e[n-1])return!1;t[e[n]]=1}r=e[h+o],n.push(t)}for(let t=r;t<h;t++)if(0!==e[t])return!1;return n}},B=Q(2===p?3:4,(e=>p-e),(e=>{if(!(-p<=e&&e<=p))throw Error(`malformed key s1/s3 ${e} outside of ETA range [${-p}, ${p}]`);return e})),O=Q(13,(e=>4096-e)),F=Q(10),S=Q(o===1<<17?18:20,(e=>D(o-e))),v=a(Q(c===H?6:4),t),N=i(32,a(F,t)),I=i(32,32,b,a(B,n),a(B,t),a(O,t)),x=i(A,a(S,n),M),X=2===p?e=>e<15&&2-e%5:e=>e<9&&4-e;function $(e){const t=G(R);for(let n=0;n<R;){const r=e();for(let e=0;n<R&&e<r.length;e+=1){const o=X(15&r[e]),c=X(r[e]>>4&15);!1!==o&&(t[n++]=o),n<R&&!1!==c&&(t[n++]=c)}}return t}const ee=e=>{const t=G(R),n=r.create({}).update(e),o=new Uint8Array(r.blockLen);n.xofInto(o);const c=o.slice(0,8);for(let e=R-s,d=8,l=0,u=0;e<R;e++){let s=e+1;for(;s>e;)s=o[d++],d<r.blockLen||(n.xofInto(o),d=0);t[e]=t[s],t[s]=1-((c[l]>>u++&1)<<1),u>=8&&(l++,u=0)}return t},te=e=>{const t=G(R),n=G(R);for(let r=0;r<e.length;r++){const{r0:o,r1:c}=k(e[r]);t[r]=o,n[r]=c}return{r0:t,r1:n}},ne=(e,t)=>{for(let n=0;n<R;n++)e[n]=U(t[n],e[n]);return e},re=(e,t)=>{const n=G(R);let r=0;for(let d=0;d<R;d++){const l=(o=e[d],s=t[d],o<=c||o>_-c||o===_-c&&0===s?0:1);n[d]=l,r+=l}var o,s;return{v:n,cnt:r}},oe=i(32,64,32),ce={signRandBytes:32,keygen:(e=u(32))=>{const o=new Uint8Array(34);o.set(e),o[32]=t,o[33]=n;const[c,s,d]=oe.decode(r(o,{dkLen:oe.bytesLen})),l=w(s),f=[];for(let e=0;e<n;e++)f.push($(l.get(255&e,e>>8&255)));const i=[];for(let e=n;e<n+t;e++)i.push($(l.get(255&e,e>>8&255)));const a=f.map((e=>P.encode(e.slice()))),p=[],h=[],g=L(c),A=G(R);for(let e=0;e<t;e++){A.fill(0);for(let t=0;t<n;t++){const n=J(g.get(t,e));j(A,z(n,a[t]))}P.decode(A);const{r0:t,r1:r}=te(j(A,i[e]));p.push(t),h.push(r)}const T=N.encode([c,h]),E=r(T,{dkLen:b}),m=I.encode([c,d,E,f,i,p]);return g.clean(),l.clean(),y(c,s,d,f,i,a,A,p,h,E,o),{publicKey:T,secretKey:m}},sign:(e,s,d)=>{const[u,f,i,a,p,b]=I.decode(e),E=[],U=L(u);for(let e=0;e<t;e++){const t=[];for(let r=0;r<n;r++)t.push(J(U.get(r,e)));E.push(t)}U.clean();for(let e=0;e<n;e++)P.encode(a[e]);for(let e=0;e<t;e++)P.encode(p[e]),P.encode(b[e]);const k=r.create({dkLen:g}).update(i).update(s).digest(),M=d||new Uint8Array(32);l(M);const B=r.create({dkLen:g}).update(f).update(M).update(k).digest();l(B,g);const O=w(B,S.bytesLen);e:for(let e=0;;){const s=[];for(let t=0;t<n;t++,e++)s.push(S.decode(O.get(255&e,e>>8)()));const d=s.map((e=>P.encode(e.slice()))),l=[];for(let e=0;e<t;e++){const t=G(R);for(let r=0;r<n;r++)j(t,z(E[e][r],d[r]));P.decode(t),l.push(t)}const u=l.map((e=>e.map(m))),f=r.create({dkLen:A}).update(k).update(v.encode(u)).digest(),i=P.encode(ee(f)),g=a.map((e=>z(e,i)));for(let e=0;e<n;e++)if(j(P.decode(g[e]),s[e]),q(g[e],o-T))continue e;let L=0;const w=[];for(let e=0;e<t;e++){const t=P.decode(z(p[e],i)),n=W(l[e],t).map(K);if(q(n,c-T))continue e;const r=P.decode(z(b[e],i));if(q(r,c))continue e;j(n,r);const o=re(n,u[e]);w.push(o.v),L+=o.cnt}if(L>h)continue;O.clean();const U=x.encode([f,g,w]);return y(f,g,w,i,u,l,d,s,B,k,a,p,b,...E),U}throw Error("Unreachable code path reached, report this error")},verify:(e,c,s)=>{const[d,l]=N.decode(e),u=r(e,{dkLen:b});if(s.length!==x.bytesLen)return!1;const[i,a,y]=x.decode(s);if(!1===y)return!1;for(let e=0;e<n;e++)if(q(a[e],o-T))return!1;const p=r.create({dkLen:g}).update(u).update(c).digest(),w=P.encode(ee(i)),E=a.map((e=>e.slice()));for(let e=0;e<n;e++)P.encode(E[e]);const m=[],K=L(d);for(let e=0;e<t;e++){const t=z(P.encode(Z(l[e])),w),r=G(R);for(let t=0;t<n;t++){const n=J(K.get(t,e));j(r,z(n,E[t]))}const o=P.decode(W(r,t));m.push(ne(o,y[e]))}K.clean();const U=r.create({dkLen:A}).update(p).update(v.encode(m)).digest();for(const e of y){if(!(e.reduce(((e,t)=>e+t),0)<=h))return!1}for(const e of a)if(q(e,o-T))return!1;return f(i,U)}},se=(e,t=V)=>{if(l(e),l(t),t.length>255)throw Error("context should be less than 255 bytes");return d(new Uint8Array([0,t.length]),t,e)};return{internal:ce,keygen:ce.keygen,signRandBytes:ce.signRandBytes,sign:(e,t,n=V,r)=>{const o=se(t,n),c=ce.sign(e,o,r);return o.fill(0),c},verify:(e,t,n,r=V)=>ce.verify(e,se(t,r),n)}}const te=/* @__PURE__ */ee({...x,CRH_BYTES:64,TR_BYTES:64,C_TILDE_BYTES:48,XOF128:A,XOF256:L});export{te as ml_dsa65,N as ml_kem768};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! OpenPGP.js v6.
|
|
1
|
+
/*! OpenPGP.js v6.1.0 - 2025-02-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
4
|
import { c as abytes, r as randomBytes$1, l as shake128, s as shake256, f as sha3_256, g as sha3_512, m as u32, d as concatBytes } from './sha3.mjs';
|