@protontech/openpgp 6.1.1-patch.4 → 6.2.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.
- package/README.md +13 -2
- package/dist/lightweight/argon2id.min.mjs +2 -2
- package/dist/lightweight/argon2id.min.mjs.map +1 -1
- package/dist/lightweight/argon2id.mjs +4 -4
- package/dist/lightweight/legacy_ciphers.min.mjs +1 -1
- package/dist/lightweight/legacy_ciphers.min.mjs.map +1 -1
- package/dist/lightweight/legacy_ciphers.mjs +10 -10
- package/dist/lightweight/nacl-fast.min.mjs +3 -0
- package/dist/lightweight/nacl-fast.min.mjs.map +1 -0
- package/dist/lightweight/nacl-fast.mjs +1382 -0
- package/dist/lightweight/noble_curves.min.mjs +11 -12
- package/dist/lightweight/noble_curves.min.mjs.map +1 -1
- package/dist/lightweight/noble_curves.mjs +2175 -1752
- 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 +80 -51
- package/dist/lightweight/noble_post_quantum.min.mjs +3 -4
- package/dist/lightweight/noble_post_quantum.min.mjs.map +1 -1
- package/dist/lightweight/noble_post_quantum.mjs +352 -10
- package/dist/lightweight/openpgp.min.mjs +3 -4
- package/dist/lightweight/openpgp.min.mjs.map +1 -1
- package/dist/lightweight/openpgp.mjs +998 -2820
- package/dist/lightweight/seek-bzip.min.mjs +2 -2
- package/dist/lightweight/seek-bzip.min.mjs.map +1 -1
- package/dist/lightweight/seek-bzip.mjs +780 -746
- package/dist/lightweight/sha512.min.mjs +4 -2
- package/dist/lightweight/sha512.min.mjs.map +1 -1
- package/dist/lightweight/sha512.mjs +672 -130
- package/dist/node/openpgp.cjs +10685 -10141
- package/dist/node/openpgp.min.cjs +14 -17
- package/dist/node/openpgp.min.cjs.map +1 -1
- package/dist/node/openpgp.min.mjs +14 -17
- package/dist/node/openpgp.min.mjs.map +1 -1
- package/dist/node/openpgp.mjs +10685 -10140
- package/dist/openpgp.js +11728 -11188
- package/dist/openpgp.min.js +14 -17
- package/dist/openpgp.min.js.map +1 -1
- package/dist/openpgp.min.mjs +14 -17
- package/dist/openpgp.min.mjs.map +1 -1
- package/dist/openpgp.mjs +11728 -11188
- package/{src → dist/types}/config/config.d.ts +1 -21
- package/{openpgp.d.ts → dist/types/index.d.ts} +94 -76
- package/dist/types/packet/grammar.d.ts +33 -0
- package/package.json +40 -39
- package/dist/lightweight/sha3.min.mjs +0 -4
- package/dist/lightweight/sha3.min.mjs.map +0 -1
- package/dist/lightweight/sha3.mjs +0 -401
- /package/{src → dist/types}/config/index.d.ts +0 -0
- /package/{src → dist/types}/enums.d.ts +0 -0
|
@@ -1,7 +1,355 @@
|
|
|
1
|
-
/*! OpenPGP.js v6.
|
|
1
|
+
/*! OpenPGP.js v6.2.1 - 2025-08-28 - 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
|
+
function anumber(n) {
|
|
5
|
+
if (!Number.isSafeInteger(n) || n < 0)
|
|
6
|
+
throw new Error('positive integer expected, got ' + n);
|
|
7
|
+
}
|
|
8
|
+
// copied from utils
|
|
9
|
+
function isBytes(a) {
|
|
10
|
+
return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
|
|
11
|
+
}
|
|
12
|
+
function abytes(b, ...lengths) {
|
|
13
|
+
if (!isBytes(b))
|
|
14
|
+
throw new Error('Uint8Array expected');
|
|
15
|
+
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
16
|
+
throw new Error('Uint8Array expected of length ' + lengths + ', got length=' + b.length);
|
|
17
|
+
}
|
|
18
|
+
function aexists(instance, checkFinished = true) {
|
|
19
|
+
if (instance.destroyed)
|
|
20
|
+
throw new Error('Hash instance has been destroyed');
|
|
21
|
+
if (checkFinished && instance.finished)
|
|
22
|
+
throw new Error('Hash#digest() has already been called');
|
|
23
|
+
}
|
|
24
|
+
function aoutput(out, instance) {
|
|
25
|
+
abytes(out);
|
|
26
|
+
const min = instance.outputLen;
|
|
27
|
+
if (out.length < min) {
|
|
28
|
+
throw new Error('digestInto() expects output buffer of length at least ' + min);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
33
|
+
const _32n = /* @__PURE__ */ BigInt(32);
|
|
34
|
+
// BigUint64Array is too slow as per 2024, so we implement it using Uint32Array.
|
|
35
|
+
// TODO: re-check https://issues.chromium.org/issues/42212588
|
|
36
|
+
function fromBig(n, le = false) {
|
|
37
|
+
if (le)
|
|
38
|
+
return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };
|
|
39
|
+
return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
|
40
|
+
}
|
|
41
|
+
function split(lst, le = false) {
|
|
42
|
+
let Ah = new Uint32Array(lst.length);
|
|
43
|
+
let Al = new Uint32Array(lst.length);
|
|
44
|
+
for (let i = 0; i < lst.length; i++) {
|
|
45
|
+
const { h, l } = fromBig(lst[i], le);
|
|
46
|
+
[Ah[i], Al[i]] = [h, l];
|
|
47
|
+
}
|
|
48
|
+
return [Ah, Al];
|
|
49
|
+
}
|
|
50
|
+
// Left rotate for Shift in [1, 32)
|
|
51
|
+
const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));
|
|
52
|
+
const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));
|
|
53
|
+
// Left rotate for Shift in (32, 64), NOTE: 32 is special case.
|
|
54
|
+
const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));
|
|
55
|
+
const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
|
|
56
|
+
|
|
57
|
+
const crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
|
|
58
|
+
|
|
59
|
+
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
60
|
+
// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.
|
|
61
|
+
// node.js versions earlier than v19 don't declare it in global scope.
|
|
62
|
+
// For node.js, package.json#exports field mapping rewrites import
|
|
63
|
+
// from `crypto` to `cryptoNode`, which imports native module.
|
|
64
|
+
// Makes the utils un-importable in browsers without a bundler.
|
|
65
|
+
// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.
|
|
66
|
+
const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
|
67
|
+
const isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();
|
|
68
|
+
// The byte swap operation for uint32
|
|
69
|
+
const byteSwap = (word) => ((word << 24) & 0xff000000) |
|
|
70
|
+
((word << 8) & 0xff0000) |
|
|
71
|
+
((word >>> 8) & 0xff00) |
|
|
72
|
+
((word >>> 24) & 0xff);
|
|
73
|
+
// In place byte swap for Uint32Array
|
|
74
|
+
function byteSwap32(arr) {
|
|
75
|
+
for (let i = 0; i < arr.length; i++) {
|
|
76
|
+
arr[i] = byteSwap(arr[i]);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])
|
|
81
|
+
*/
|
|
82
|
+
function utf8ToBytes(str) {
|
|
83
|
+
if (typeof str !== 'string')
|
|
84
|
+
throw new Error('utf8ToBytes expected string, got ' + typeof str);
|
|
85
|
+
return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Normalizes (non-hex) string or Uint8Array to Uint8Array.
|
|
89
|
+
* Warning: when Uint8Array is passed, it would NOT get copied.
|
|
90
|
+
* Keep in mind for future mutable operations.
|
|
91
|
+
*/
|
|
92
|
+
function toBytes(data) {
|
|
93
|
+
if (typeof data === 'string')
|
|
94
|
+
data = utf8ToBytes(data);
|
|
95
|
+
abytes(data);
|
|
96
|
+
return data;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Copies several Uint8Arrays into one.
|
|
100
|
+
*/
|
|
101
|
+
function concatBytes(...arrays) {
|
|
102
|
+
let sum = 0;
|
|
103
|
+
for (let i = 0; i < arrays.length; i++) {
|
|
104
|
+
const a = arrays[i];
|
|
105
|
+
abytes(a);
|
|
106
|
+
sum += a.length;
|
|
107
|
+
}
|
|
108
|
+
const res = new Uint8Array(sum);
|
|
109
|
+
for (let i = 0, pad = 0; i < arrays.length; i++) {
|
|
110
|
+
const a = arrays[i];
|
|
111
|
+
res.set(a, pad);
|
|
112
|
+
pad += a.length;
|
|
113
|
+
}
|
|
114
|
+
return res;
|
|
115
|
+
}
|
|
116
|
+
// For runtime check if class implements interface
|
|
117
|
+
class Hash {
|
|
118
|
+
// Safe version that clones internal state
|
|
119
|
+
clone() {
|
|
120
|
+
return this._cloneInto();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function wrapConstructor(hashCons) {
|
|
124
|
+
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
|
125
|
+
const tmp = hashCons();
|
|
126
|
+
hashC.outputLen = tmp.outputLen;
|
|
127
|
+
hashC.blockLen = tmp.blockLen;
|
|
128
|
+
hashC.create = () => hashCons();
|
|
129
|
+
return hashC;
|
|
130
|
+
}
|
|
131
|
+
function wrapXOFConstructorWithOpts(hashCons) {
|
|
132
|
+
const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
|
|
133
|
+
const tmp = hashCons({});
|
|
134
|
+
hashC.outputLen = tmp.outputLen;
|
|
135
|
+
hashC.blockLen = tmp.blockLen;
|
|
136
|
+
hashC.create = (opts) => hashCons(opts);
|
|
137
|
+
return hashC;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.
|
|
141
|
+
*/
|
|
142
|
+
function randomBytes$1(bytesLength = 32) {
|
|
143
|
+
if (crypto && typeof crypto.getRandomValues === 'function') {
|
|
144
|
+
return crypto.getRandomValues(new Uint8Array(bytesLength));
|
|
145
|
+
}
|
|
146
|
+
// Legacy Node.js compatibility
|
|
147
|
+
if (crypto && typeof crypto.randomBytes === 'function') {
|
|
148
|
+
return crypto.randomBytes(bytesLength);
|
|
149
|
+
}
|
|
150
|
+
throw new Error('crypto.getRandomValues must be defined');
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size.
|
|
154
|
+
// It's called a sponge function.
|
|
155
|
+
// Various per round constants calculations
|
|
156
|
+
const SHA3_PI = [];
|
|
157
|
+
const SHA3_ROTL = [];
|
|
158
|
+
const _SHA3_IOTA = [];
|
|
159
|
+
const _0n = /* @__PURE__ */ BigInt(0);
|
|
160
|
+
const _1n = /* @__PURE__ */ BigInt(1);
|
|
161
|
+
const _2n = /* @__PURE__ */ BigInt(2);
|
|
162
|
+
const _7n = /* @__PURE__ */ BigInt(7);
|
|
163
|
+
const _256n = /* @__PURE__ */ BigInt(256);
|
|
164
|
+
const _0x71n = /* @__PURE__ */ BigInt(0x71);
|
|
165
|
+
for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
|
|
166
|
+
// Pi
|
|
167
|
+
[x, y] = [y, (2 * x + 3 * y) % 5];
|
|
168
|
+
SHA3_PI.push(2 * (5 * y + x));
|
|
169
|
+
// Rotational
|
|
170
|
+
SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);
|
|
171
|
+
// Iota
|
|
172
|
+
let t = _0n;
|
|
173
|
+
for (let j = 0; j < 7; j++) {
|
|
174
|
+
R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;
|
|
175
|
+
if (R & _2n)
|
|
176
|
+
t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n);
|
|
177
|
+
}
|
|
178
|
+
_SHA3_IOTA.push(t);
|
|
179
|
+
}
|
|
180
|
+
const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);
|
|
181
|
+
// Left rotation (without 0, 32, 64)
|
|
182
|
+
const rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));
|
|
183
|
+
const rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));
|
|
184
|
+
// Same as keccakf1600, but allows to skip some rounds
|
|
185
|
+
function keccakP(s, rounds = 24) {
|
|
186
|
+
const B = new Uint32Array(5 * 2);
|
|
187
|
+
// NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)
|
|
188
|
+
for (let round = 24 - rounds; round < 24; round++) {
|
|
189
|
+
// Theta θ
|
|
190
|
+
for (let x = 0; x < 10; x++)
|
|
191
|
+
B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
|
|
192
|
+
for (let x = 0; x < 10; x += 2) {
|
|
193
|
+
const idx1 = (x + 8) % 10;
|
|
194
|
+
const idx0 = (x + 2) % 10;
|
|
195
|
+
const B0 = B[idx0];
|
|
196
|
+
const B1 = B[idx0 + 1];
|
|
197
|
+
const Th = rotlH(B0, B1, 1) ^ B[idx1];
|
|
198
|
+
const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
|
|
199
|
+
for (let y = 0; y < 50; y += 10) {
|
|
200
|
+
s[x + y] ^= Th;
|
|
201
|
+
s[x + y + 1] ^= Tl;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
// Rho (ρ) and Pi (π)
|
|
205
|
+
let curH = s[2];
|
|
206
|
+
let curL = s[3];
|
|
207
|
+
for (let t = 0; t < 24; t++) {
|
|
208
|
+
const shift = SHA3_ROTL[t];
|
|
209
|
+
const Th = rotlH(curH, curL, shift);
|
|
210
|
+
const Tl = rotlL(curH, curL, shift);
|
|
211
|
+
const PI = SHA3_PI[t];
|
|
212
|
+
curH = s[PI];
|
|
213
|
+
curL = s[PI + 1];
|
|
214
|
+
s[PI] = Th;
|
|
215
|
+
s[PI + 1] = Tl;
|
|
216
|
+
}
|
|
217
|
+
// Chi (χ)
|
|
218
|
+
for (let y = 0; y < 50; y += 10) {
|
|
219
|
+
for (let x = 0; x < 10; x++)
|
|
220
|
+
B[x] = s[y + x];
|
|
221
|
+
for (let x = 0; x < 10; x++)
|
|
222
|
+
s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
|
|
223
|
+
}
|
|
224
|
+
// Iota (ι)
|
|
225
|
+
s[0] ^= SHA3_IOTA_H[round];
|
|
226
|
+
s[1] ^= SHA3_IOTA_L[round];
|
|
227
|
+
}
|
|
228
|
+
B.fill(0);
|
|
229
|
+
}
|
|
230
|
+
class Keccak extends Hash {
|
|
231
|
+
// NOTE: we accept arguments in bytes instead of bits here.
|
|
232
|
+
constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
|
|
233
|
+
super();
|
|
234
|
+
this.blockLen = blockLen;
|
|
235
|
+
this.suffix = suffix;
|
|
236
|
+
this.outputLen = outputLen;
|
|
237
|
+
this.enableXOF = enableXOF;
|
|
238
|
+
this.rounds = rounds;
|
|
239
|
+
this.pos = 0;
|
|
240
|
+
this.posOut = 0;
|
|
241
|
+
this.finished = false;
|
|
242
|
+
this.destroyed = false;
|
|
243
|
+
// Can be passed from user as dkLen
|
|
244
|
+
anumber(outputLen);
|
|
245
|
+
// 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes
|
|
246
|
+
if (0 >= this.blockLen || this.blockLen >= 200)
|
|
247
|
+
throw new Error('Sha3 supports only keccak-f1600 function');
|
|
248
|
+
this.state = new Uint8Array(200);
|
|
249
|
+
this.state32 = u32(this.state);
|
|
250
|
+
}
|
|
251
|
+
keccak() {
|
|
252
|
+
if (!isLE)
|
|
253
|
+
byteSwap32(this.state32);
|
|
254
|
+
keccakP(this.state32, this.rounds);
|
|
255
|
+
if (!isLE)
|
|
256
|
+
byteSwap32(this.state32);
|
|
257
|
+
this.posOut = 0;
|
|
258
|
+
this.pos = 0;
|
|
259
|
+
}
|
|
260
|
+
update(data) {
|
|
261
|
+
aexists(this);
|
|
262
|
+
const { blockLen, state } = this;
|
|
263
|
+
data = toBytes(data);
|
|
264
|
+
const len = data.length;
|
|
265
|
+
for (let pos = 0; pos < len;) {
|
|
266
|
+
const take = Math.min(blockLen - this.pos, len - pos);
|
|
267
|
+
for (let i = 0; i < take; i++)
|
|
268
|
+
state[this.pos++] ^= data[pos++];
|
|
269
|
+
if (this.pos === blockLen)
|
|
270
|
+
this.keccak();
|
|
271
|
+
}
|
|
272
|
+
return this;
|
|
273
|
+
}
|
|
274
|
+
finish() {
|
|
275
|
+
if (this.finished)
|
|
276
|
+
return;
|
|
277
|
+
this.finished = true;
|
|
278
|
+
const { state, suffix, pos, blockLen } = this;
|
|
279
|
+
// Do the padding
|
|
280
|
+
state[pos] ^= suffix;
|
|
281
|
+
if ((suffix & 0x80) !== 0 && pos === blockLen - 1)
|
|
282
|
+
this.keccak();
|
|
283
|
+
state[blockLen - 1] ^= 0x80;
|
|
284
|
+
this.keccak();
|
|
285
|
+
}
|
|
286
|
+
writeInto(out) {
|
|
287
|
+
aexists(this, false);
|
|
288
|
+
abytes(out);
|
|
289
|
+
this.finish();
|
|
290
|
+
const bufferOut = this.state;
|
|
291
|
+
const { blockLen } = this;
|
|
292
|
+
for (let pos = 0, len = out.length; pos < len;) {
|
|
293
|
+
if (this.posOut >= blockLen)
|
|
294
|
+
this.keccak();
|
|
295
|
+
const take = Math.min(blockLen - this.posOut, len - pos);
|
|
296
|
+
out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
|
|
297
|
+
this.posOut += take;
|
|
298
|
+
pos += take;
|
|
299
|
+
}
|
|
300
|
+
return out;
|
|
301
|
+
}
|
|
302
|
+
xofInto(out) {
|
|
303
|
+
// Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF
|
|
304
|
+
if (!this.enableXOF)
|
|
305
|
+
throw new Error('XOF is not possible for this instance');
|
|
306
|
+
return this.writeInto(out);
|
|
307
|
+
}
|
|
308
|
+
xof(bytes) {
|
|
309
|
+
anumber(bytes);
|
|
310
|
+
return this.xofInto(new Uint8Array(bytes));
|
|
311
|
+
}
|
|
312
|
+
digestInto(out) {
|
|
313
|
+
aoutput(out, this);
|
|
314
|
+
if (this.finished)
|
|
315
|
+
throw new Error('digest() was already called');
|
|
316
|
+
this.writeInto(out);
|
|
317
|
+
this.destroy();
|
|
318
|
+
return out;
|
|
319
|
+
}
|
|
320
|
+
digest() {
|
|
321
|
+
return this.digestInto(new Uint8Array(this.outputLen));
|
|
322
|
+
}
|
|
323
|
+
destroy() {
|
|
324
|
+
this.destroyed = true;
|
|
325
|
+
this.state.fill(0);
|
|
326
|
+
}
|
|
327
|
+
_cloneInto(to) {
|
|
328
|
+
const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
|
|
329
|
+
to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
|
|
330
|
+
to.state32.set(this.state32);
|
|
331
|
+
to.pos = this.pos;
|
|
332
|
+
to.posOut = this.posOut;
|
|
333
|
+
to.finished = this.finished;
|
|
334
|
+
to.rounds = rounds;
|
|
335
|
+
// Suffix can change in cSHAKE
|
|
336
|
+
to.suffix = suffix;
|
|
337
|
+
to.outputLen = outputLen;
|
|
338
|
+
to.enableXOF = enableXOF;
|
|
339
|
+
to.destroyed = this.destroyed;
|
|
340
|
+
return to;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
const gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));
|
|
344
|
+
/**
|
|
345
|
+
* SHA3-256 hash function
|
|
346
|
+
* @param message - that would be hashed
|
|
347
|
+
*/
|
|
348
|
+
const sha3_256 = /* @__PURE__ */ gen(0x06, 136, 256 / 8);
|
|
349
|
+
const sha3_512 = /* @__PURE__ */ gen(0x06, 72, 512 / 8);
|
|
350
|
+
const genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true));
|
|
351
|
+
const shake128 = /* @__PURE__ */ genShake(0x1f, 168, 128 / 8);
|
|
352
|
+
const shake256 = /* @__PURE__ */ genShake(0x1f, 136, 256 / 8);
|
|
5
353
|
|
|
6
354
|
/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */
|
|
7
355
|
const ensureBytes = abytes;
|
|
@@ -259,10 +607,7 @@ const { mod: mod$1, nttZetas, NTT: NTT$1, bitsCoder: bitsCoder$1 } = genCrystals
|
|
|
259
607
|
});
|
|
260
608
|
// prettier-ignore
|
|
261
609
|
const PARAMS$1 = {
|
|
262
|
-
|
|
263
|
-
768: { N: N$1, Q: Q$1, K: 3, ETA1: 2, ETA2: 2, du: 10, dv: 4, RBGstrength: 192 },
|
|
264
|
-
1024: { N: N$1, Q: Q$1, K: 4, ETA1: 2, ETA2: 2, du: 11, dv: 5, RBGstrength: 256 },
|
|
265
|
-
};
|
|
610
|
+
768: { N: N$1, Q: Q$1, K: 3, ETA1: 2, ETA2: 2, du: 10, dv: 4, RBGstrength: 192 }};
|
|
266
611
|
// FIPS-203: compress/decompress
|
|
267
612
|
const compress = (d) => {
|
|
268
613
|
// Special case, no need to compress, pass as is, but strip high bytes on compression
|
|
@@ -532,10 +877,7 @@ const GAMMA2_1 = Math.floor((Q - 1) / 88) | 0;
|
|
|
532
877
|
const GAMMA2_2 = Math.floor((Q - 1) / 32) | 0;
|
|
533
878
|
// prettier-ignore
|
|
534
879
|
const PARAMS = {
|
|
535
|
-
|
|
536
|
-
3: { K: 6, L: 5, D, GAMMA1: 2 ** 19, GAMMA2: GAMMA2_2, TAU: 49, ETA: 4, OMEGA: 55 },
|
|
537
|
-
5: { K: 8, L: 7, D, GAMMA1: 2 ** 19, GAMMA2: GAMMA2_2, TAU: 60, ETA: 2, OMEGA: 75 },
|
|
538
|
-
};
|
|
880
|
+
3: { K: 6, L: 5, D, GAMMA1: 2 ** 19, GAMMA2: GAMMA2_2, TAU: 49, ETA: 4, OMEGA: 55 }};
|
|
539
881
|
const newPoly = (n) => new Int32Array(n);
|
|
540
882
|
const { mod, smod, NTT, bitsCoder } = genCrystals({
|
|
541
883
|
N,
|