@byline/admin 0.9.3 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/modules/auth/password.d.ts.map +1 -1
  2. package/dist/modules/auth/password.js +51 -10
  3. package/dist/modules/auth/password.js.map +1 -1
  4. package/dist/modules/auth/phc.d.ts +45 -0
  5. package/dist/modules/auth/phc.d.ts.map +1 -0
  6. package/dist/modules/auth/phc.js +88 -0
  7. package/dist/modules/auth/phc.js.map +1 -0
  8. package/dist/vendor/noble-argon2/_blake.d.ts +21 -0
  9. package/dist/vendor/noble-argon2/_blake.d.ts.map +1 -0
  10. package/dist/vendor/noble-argon2/_blake.js +53 -0
  11. package/dist/vendor/noble-argon2/_blake.js.map +1 -0
  12. package/dist/vendor/noble-argon2/_md.d.ts +99 -0
  13. package/dist/vendor/noble-argon2/_md.d.ts.map +1 -0
  14. package/dist/vendor/noble-argon2/_md.js +203 -0
  15. package/dist/vendor/noble-argon2/_md.js.map +1 -0
  16. package/dist/vendor/noble-argon2/_u64.d.ts +63 -0
  17. package/dist/vendor/noble-argon2/_u64.d.ts.map +1 -0
  18. package/dist/vendor/noble-argon2/_u64.js +84 -0
  19. package/dist/vendor/noble-argon2/_u64.js.map +1 -0
  20. package/dist/vendor/noble-argon2/argon2.d.ts +112 -0
  21. package/dist/vendor/noble-argon2/argon2.d.ts.map +1 -0
  22. package/dist/vendor/noble-argon2/argon2.js +518 -0
  23. package/dist/vendor/noble-argon2/argon2.js.map +1 -0
  24. package/dist/vendor/noble-argon2/blake2.d.ts +184 -0
  25. package/dist/vendor/noble-argon2/blake2.d.ts.map +1 -0
  26. package/dist/vendor/noble-argon2/blake2.js +502 -0
  27. package/dist/vendor/noble-argon2/blake2.js.map +1 -0
  28. package/dist/vendor/noble-argon2/utils.d.ts +519 -0
  29. package/dist/vendor/noble-argon2/utils.d.ts.map +1 -0
  30. package/dist/vendor/noble-argon2/utils.js +578 -0
  31. package/dist/vendor/noble-argon2/utils.js.map +1 -0
  32. package/package.json +4 -5
@@ -0,0 +1,184 @@
1
+ import { type CHash, type Hash, type TArg, type TRet } from './utils.js';
2
+ /**
3
+ * Blake hash options.
4
+ * `dkLen` is output length. `key` is used in MAC mode. `salt` is used in
5
+ * KDF mode.
6
+ */
7
+ export type Blake2Opts = {
8
+ /** Desired digest length in bytes. RFC 7693 uses 1..64 for blake2b and 1..32 for blake2s. */
9
+ dkLen?: number;
10
+ /** Optional MAC key. */
11
+ key?: Uint8Array;
12
+ /** Optional salt mixed into initialization. */
13
+ salt?: Uint8Array;
14
+ /** Optional personalization bytes. */
15
+ personalization?: Uint8Array;
16
+ };
17
+ /** Internal base class for BLAKE2. */
18
+ export declare abstract class _BLAKE2<T extends _BLAKE2<T>> implements Hash<T> {
19
+ protected abstract compress(msg: Uint32Array, offset: number, isLast: boolean): void;
20
+ protected abstract get(): number[];
21
+ protected abstract set(...args: number[]): void;
22
+ abstract destroy(): void;
23
+ protected buffer: Uint8Array;
24
+ protected buffer32: Uint32Array;
25
+ protected finished: boolean;
26
+ protected destroyed: boolean;
27
+ protected length: number;
28
+ protected pos: number;
29
+ readonly blockLen: number;
30
+ readonly outputLen: number;
31
+ readonly canXOF: boolean;
32
+ constructor(blockLen: number, outputLen: number);
33
+ update(data: TArg<Uint8Array>): this;
34
+ digestInto(out: TArg<Uint8Array>): void;
35
+ digest(): TRet<Uint8Array>;
36
+ _cloneInto(to?: T): T;
37
+ clone(): T;
38
+ }
39
+ /** Internal blake2b hash class with state stored as LE u32 low/high halves. */
40
+ export declare class _BLAKE2b extends _BLAKE2<_BLAKE2b> {
41
+ private v0l;
42
+ private v0h;
43
+ private v1l;
44
+ private v1h;
45
+ private v2l;
46
+ private v2h;
47
+ private v3l;
48
+ private v3h;
49
+ private v4l;
50
+ private v4h;
51
+ private v5l;
52
+ private v5h;
53
+ private v6l;
54
+ private v6h;
55
+ private v7l;
56
+ private v7h;
57
+ constructor(opts?: Blake2Opts);
58
+ protected get(): [
59
+ number,
60
+ number,
61
+ number,
62
+ number,
63
+ number,
64
+ number,
65
+ number,
66
+ number,
67
+ number,
68
+ number,
69
+ number,
70
+ number,
71
+ number,
72
+ number,
73
+ number,
74
+ number
75
+ ];
76
+ protected set(v0l: number, v0h: number, v1l: number, v1h: number, v2l: number, v2h: number, v3l: number, v3h: number, v4l: number, v4h: number, v5l: number, v5h: number, v6l: number, v6h: number, v7l: number, v7h: number): void;
77
+ protected compress(msg: Uint32Array, offset: number, isLast: boolean): void;
78
+ destroy(): void;
79
+ }
80
+ /**
81
+ * Blake2b hash function. 64-bit. 1.5x slower than blake2s in JS.
82
+ * @param msg - message that would be hashed
83
+ * @param opts - Optional output, MAC, salt, and personalization settings.
84
+ * `dkLen` must be 1..64 bytes; `salt` and `personalization`, if present,
85
+ * must be 16 bytes each. See {@link Blake2Opts}.
86
+ * @returns Digest bytes.
87
+ * @example
88
+ * Hash a message with Blake2b.
89
+ * ```ts
90
+ * blake2b(new Uint8Array([97, 98, 99]));
91
+ * ```
92
+ */
93
+ export declare const blake2b: TRet<CHash<_BLAKE2b, Blake2Opts>>;
94
+ /** Internal type, 16 numbers. */
95
+ export type _Num16 = {
96
+ v0: number;
97
+ v1: number;
98
+ v2: number;
99
+ v3: number;
100
+ v4: number;
101
+ v5: number;
102
+ v6: number;
103
+ v7: number;
104
+ v8: number;
105
+ v9: number;
106
+ v10: number;
107
+ v11: number;
108
+ v12: number;
109
+ v13: number;
110
+ v14: number;
111
+ v15: number;
112
+ };
113
+ /**
114
+ * BLAKE2-compress core method.
115
+ * Runs only the round function over a caller-supplied local vector; callers initialize `v0..v15`
116
+ * and apply the final `h[i] ^= v[i] ^ v[i + 8]` fold themselves.
117
+ * @param s - flattened sigma schedule bytes
118
+ * @param offset - starting word offset inside `msg`, not a byte offset
119
+ * @param msg - message words
120
+ * @param rounds - round count to execute
121
+ * @param v0 - state word 0
122
+ * @param v1 - state word 1
123
+ * @param v2 - state word 2
124
+ * @param v3 - state word 3
125
+ * @param v4 - state word 4
126
+ * @param v5 - state word 5
127
+ * @param v6 - state word 6
128
+ * @param v7 - state word 7
129
+ * @param v8 - state word 8
130
+ * @param v9 - state word 9
131
+ * @param v10 - state word 10
132
+ * @param v11 - state word 11
133
+ * @param v12 - state word 12
134
+ * @param v13 - state word 13
135
+ * @param v14 - state word 14
136
+ * @param v15 - state word 15
137
+ * @returns Updated compression state words.
138
+ * @example
139
+ * Run the BLAKE2 compression core on zeroed state and message words.
140
+ * ```ts
141
+ * import { compress } from '@noble/hashes/blake2.js';
142
+ * const state = compress(
143
+ * new Uint8Array(16),
144
+ * 0,
145
+ * new Uint32Array(16),
146
+ * 1,
147
+ * 0, 0, 0, 0, 0, 0, 0, 0,
148
+ * 0, 0, 0, 0, 0, 0, 0, 0
149
+ * );
150
+ * state.v0;
151
+ * ```
152
+ */
153
+ export declare function compress(s: TArg<Uint8Array>, offset: number, msg: TArg<Uint32Array>, rounds: number, v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number): _Num16;
154
+ /** Internal blake2s hash class. */
155
+ export declare class _BLAKE2s extends _BLAKE2<_BLAKE2s> {
156
+ private v0;
157
+ private v1;
158
+ private v2;
159
+ private v3;
160
+ private v4;
161
+ private v5;
162
+ private v6;
163
+ private v7;
164
+ constructor(opts?: Blake2Opts);
165
+ protected get(): [number, number, number, number, number, number, number, number];
166
+ protected set(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number): void;
167
+ protected compress(msg: Uint32Array, offset: number, isLast: boolean): void;
168
+ destroy(): void;
169
+ }
170
+ /**
171
+ * Blake2s hash function. Focuses on 8-bit to 32-bit platforms. 1.5x faster than blake2b in JS.
172
+ * @param msg - message that would be hashed
173
+ * @param opts - Optional output, MAC, salt, and personalization settings.
174
+ * `dkLen` must be 1..32 bytes; `salt` and `personalization`, if present,
175
+ * must be 8 bytes each. See {@link Blake2Opts}.
176
+ * @returns Digest bytes.
177
+ * @example
178
+ * Hash a message with Blake2s.
179
+ * ```ts
180
+ * blake2s(new Uint8Array([97, 98, 99]));
181
+ * ```
182
+ */
183
+ export declare const blake2s: TRet<CHash<_BLAKE2s, Blake2Opts>>;
184
+ //# sourceMappingURL=blake2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blake2.d.ts","sourceRoot":"","sources":["../../../src/vendor/noble-argon2/blake2.ts"],"names":[],"mappings":"AAUA,OAAO,EAKL,KAAK,KAAK,EACV,KAAK,IAAI,EACT,KAAK,IAAI,EACT,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,6FAA6F;IAC7F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,sCAAsC;IACtC,eAAe,CAAC,EAAE,UAAU,CAAC;CAC9B,CAAC;AAiFF,sCAAsC;AACtC,8BAAsB,OAAO,CAAC,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,CAAE,YAAW,IAAI,CAAC,CAAC,CAAC;IACpE,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI;IACpF,SAAS,CAAC,QAAQ,CAAC,GAAG,IAAI,MAAM,EAAE;IAClC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI;IAC/C,QAAQ,CAAC,OAAO,IAAI,IAAI;IACxB,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC;IAC7B,SAAS,CAAC,QAAQ,EAAE,WAAW,CAAC;IAChC,SAAS,CAAC,QAAQ,UAAS;IAC3B,SAAS,CAAC,SAAS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AM,EAAE,MAAM,CAAC;IAKjF,SAAS,CAAC,GAAG,CACX,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAC7F,IAAI;IAUP,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI;IAoB3E,OAAO,IAAI,IAAI;CAKhB;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,UAAU,CAAC,CAErD,CAAC"}
@@ -0,0 +1,502 @@
1
+ // @ts-nocheck — vendored from noble-hashes; see ./README.md
2
+ /**
3
+ * blake2b (64-bit) & blake2s (8 to 32-bit) hash functions.
4
+ * b could have been faster, but there is no fast u64 in js, so s is 1.5x faster.
5
+ * @module
6
+ */
7
+ import { BSIGMA, G1s, G2s } from './_blake.js';
8
+ import { SHA256_IV } from './_md.js';
9
+ import * as u64 from './_u64.js';
10
+ // prettier-ignore
11
+ import { abytes, aexists, anumber, aoutput, clean, createHasher, swap32IfBE, swap8IfBE, u32 } from './utils.js';
12
+ // Same IV words as `SHA512_IV`, but endian-swapped into LE u32 low/high halves
13
+ // for the BLAKE2b u64 helpers below.
14
+ const B2B_IV = /* @__PURE__ */ Uint32Array.from([
15
+ 0xf3bcc908, 0x6a09e667, 0x84caa73b, 0xbb67ae85, 0xfe94f82b, 0x3c6ef372, 0x5f1d36f1, 0xa54ff53a,
16
+ 0xade682d1, 0x510e527f, 0x2b3e6c1f, 0x9b05688c, 0xfb41bd6b, 0x1f83d9ab, 0x137e2179, 0x5be0cd19,
17
+ ]);
18
+ // Shared synchronous BLAKE2b work vector as LE u32 low/high halves.
19
+ const BBUF = /* @__PURE__ */ new Uint32Array(32);
20
+ // BLAKE2b G mix split into two half-rounds over LE u32 low/high limbs.
21
+ function G1b(a, b, c, d, msg, x) {
22
+ // NOTE: V is LE here
23
+ const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore
24
+ let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1]; // prettier-ignore
25
+ let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1]; // prettier-ignore
26
+ let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1]; // prettier-ignore
27
+ let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1]; // prettier-ignore
28
+ // v[a] = (v[a] + v[b] + x) | 0;
29
+ let ll = u64.add3L(Al, Bl, Xl);
30
+ Ah = u64.add3H(ll, Ah, Bh, Xh);
31
+ Al = ll | 0;
32
+ // v[d] = rotr(v[d] ^ v[a], 32)
33
+ ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
34
+ ({ Dh, Dl } = { Dh: u64.rotr32H(Dh, Dl), Dl: u64.rotr32L(Dh, Dl) });
35
+ // v[c] = (v[c] + v[d]) | 0;
36
+ ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl));
37
+ // v[b] = rotr(v[b] ^ v[c], 24)
38
+ ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
39
+ ({ Bh, Bl } = { Bh: u64.rotrSH(Bh, Bl, 24), Bl: u64.rotrSL(Bh, Bl, 24) });
40
+ ((BBUF[2 * a] = Al), (BBUF[2 * a + 1] = Ah));
41
+ ((BBUF[2 * b] = Bl), (BBUF[2 * b + 1] = Bh));
42
+ ((BBUF[2 * c] = Cl), (BBUF[2 * c + 1] = Ch));
43
+ ((BBUF[2 * d] = Dl), (BBUF[2 * d + 1] = Dh));
44
+ }
45
+ // Second half-round of the same LE-limb BLAKE2b G mix; `x` is the message word offset.
46
+ function G2b(a, b, c, d, msg, x) {
47
+ // NOTE: V is LE here
48
+ const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore
49
+ let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1]; // prettier-ignore
50
+ let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1]; // prettier-ignore
51
+ let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1]; // prettier-ignore
52
+ let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1]; // prettier-ignore
53
+ // v[a] = (v[a] + v[b] + x) | 0;
54
+ let ll = u64.add3L(Al, Bl, Xl);
55
+ Ah = u64.add3H(ll, Ah, Bh, Xh);
56
+ Al = ll | 0;
57
+ // v[d] = rotr(v[d] ^ v[a], 16)
58
+ ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
59
+ ({ Dh, Dl } = { Dh: u64.rotrSH(Dh, Dl, 16), Dl: u64.rotrSL(Dh, Dl, 16) });
60
+ // v[c] = (v[c] + v[d]) | 0;
61
+ ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl));
62
+ // v[b] = rotr(v[b] ^ v[c], 63)
63
+ ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
64
+ ({ Bh, Bl } = { Bh: u64.rotrBH(Bh, Bl, 63), Bl: u64.rotrBL(Bh, Bl, 63) });
65
+ ((BBUF[2 * a] = Al), (BBUF[2 * a + 1] = Ah));
66
+ ((BBUF[2 * b] = Bl), (BBUF[2 * b + 1] = Bh));
67
+ ((BBUF[2 * c] = Cl), (BBUF[2 * c + 1] = Ch));
68
+ ((BBUF[2 * d] = Dl), (BBUF[2 * d + 1] = Dh));
69
+ }
70
+ function checkBlake2Opts(outputLen, opts = {}, keyLen, saltLen, persLen) {
71
+ anumber(keyLen);
72
+ // RFC 7693 §2.1 requires digest length nn in 1..keyLen.
73
+ if (outputLen <= 0 || outputLen > keyLen)
74
+ throw new Error('outputLen bigger than keyLen');
75
+ const { key, salt, personalization } = opts;
76
+ // This API uses `undefined` for the RFC 7693 `kk = 0` case, so a provided key must be non-empty.
77
+ if (key !== undefined && (key.length < 1 || key.length > keyLen))
78
+ throw new Error('"key" expected to be undefined or of length=1..' + keyLen);
79
+ if (salt !== undefined)
80
+ abytes(salt, saltLen, 'salt');
81
+ if (personalization !== undefined)
82
+ abytes(personalization, persLen, 'personalization');
83
+ }
84
+ /** Internal base class for BLAKE2. */
85
+ export class _BLAKE2 {
86
+ buffer;
87
+ buffer32;
88
+ finished = false;
89
+ destroyed = false;
90
+ length = 0;
91
+ pos = 0;
92
+ blockLen;
93
+ outputLen;
94
+ canXOF = false;
95
+ constructor(blockLen, outputLen) {
96
+ anumber(blockLen);
97
+ anumber(outputLen);
98
+ this.blockLen = blockLen;
99
+ this.outputLen = outputLen;
100
+ this.buffer = new Uint8Array(blockLen);
101
+ this.buffer32 = u32(this.buffer);
102
+ }
103
+ update(data) {
104
+ aexists(this);
105
+ abytes(data);
106
+ // Main difference with other hashes: there is flag for last block,
107
+ // so we cannot process current block before we know that there
108
+ // is the next one. This significantly complicates logic and reduces ability
109
+ // to do zero-copy processing
110
+ const { blockLen, buffer, buffer32 } = this;
111
+ const len = data.length;
112
+ const offset = data.byteOffset;
113
+ const buf = data.buffer;
114
+ for (let pos = 0; pos < len;) {
115
+ // If buffer is full and we still have input (don't process last block, same as blake2s)
116
+ if (this.pos === blockLen) {
117
+ swap32IfBE(buffer32);
118
+ this.compress(buffer32, 0, false);
119
+ swap32IfBE(buffer32);
120
+ this.pos = 0;
121
+ }
122
+ const take = Math.min(blockLen - this.pos, len - pos);
123
+ const dataOffset = offset + pos;
124
+ // Zero-copy only for full, 4-byte-aligned, non-final blocks.
125
+ if (take === blockLen && !(dataOffset % 4) && pos + take < len) {
126
+ const data32 = new Uint32Array(buf, dataOffset, Math.floor((len - pos) / 4));
127
+ swap32IfBE(data32);
128
+ for (let pos32 = 0; pos + blockLen < len; pos32 += buffer32.length, pos += blockLen) {
129
+ this.length += blockLen;
130
+ this.compress(data32, pos32, false);
131
+ }
132
+ swap32IfBE(data32);
133
+ continue;
134
+ }
135
+ buffer.set(data.subarray(pos, pos + take), this.pos);
136
+ this.pos += take;
137
+ this.length += take;
138
+ pos += take;
139
+ }
140
+ return this;
141
+ }
142
+ digestInto(out) {
143
+ aexists(this);
144
+ aoutput(out, this);
145
+ const { pos, buffer32 } = this;
146
+ this.finished = true;
147
+ // Padding
148
+ clean(this.buffer.subarray(pos));
149
+ swap32IfBE(buffer32);
150
+ this.compress(buffer32, 0, true);
151
+ swap32IfBE(buffer32);
152
+ // Reject unaligned views explicitly instead of hiding them behind a full scratch copy.
153
+ if (out.byteOffset & 3)
154
+ throw new RangeError('"digestInto() output" expected 4-byte aligned byteOffset, got ' + out.byteOffset);
155
+ const state = this.get();
156
+ const out32 = u32(out);
157
+ const full = Math.floor(this.outputLen / 4);
158
+ for (let i = 0; i < full; i++)
159
+ out32[i] = swap8IfBE(state[i]);
160
+ const tail = this.outputLen % 4;
161
+ if (!tail)
162
+ return;
163
+ const off = full * 4;
164
+ const word = state[full];
165
+ for (let i = 0; i < tail; i++)
166
+ out[off + i] = word >>> (8 * i);
167
+ }
168
+ digest() {
169
+ const { buffer, outputLen } = this;
170
+ this.digestInto(buffer);
171
+ // Return a copy so callers do not alias the instance scratch buffer used during finalization.
172
+ const res = buffer.slice(0, outputLen);
173
+ this.destroy();
174
+ return res;
175
+ }
176
+ _cloneInto(to) {
177
+ const { buffer, length, finished, destroyed, outputLen, pos } = this;
178
+ // Recreate only `dkLen`; key/salt/personalization are already absorbed into the copied state.
179
+ to ||= new this.constructor({ dkLen: outputLen });
180
+ to.set(...this.get());
181
+ to.buffer.set(buffer);
182
+ to.destroyed = destroyed;
183
+ to.finished = finished;
184
+ to.length = length;
185
+ to.pos = pos;
186
+ // @ts-ignore
187
+ to.outputLen = outputLen;
188
+ return to;
189
+ }
190
+ clone() {
191
+ return this._cloneInto();
192
+ }
193
+ }
194
+ /** Internal blake2b hash class with state stored as LE u32 low/high halves. */
195
+ export class _BLAKE2b extends _BLAKE2 {
196
+ // Same IV words as SHA-512 / BLAKE2b, encoded as LE u32 low/high halves.
197
+ v0l = B2B_IV[0] | 0;
198
+ v0h = B2B_IV[1] | 0;
199
+ v1l = B2B_IV[2] | 0;
200
+ v1h = B2B_IV[3] | 0;
201
+ v2l = B2B_IV[4] | 0;
202
+ v2h = B2B_IV[5] | 0;
203
+ v3l = B2B_IV[6] | 0;
204
+ v3h = B2B_IV[7] | 0;
205
+ v4l = B2B_IV[8] | 0;
206
+ v4h = B2B_IV[9] | 0;
207
+ v5l = B2B_IV[10] | 0;
208
+ v5h = B2B_IV[11] | 0;
209
+ v6l = B2B_IV[12] | 0;
210
+ v6h = B2B_IV[13] | 0;
211
+ v7l = B2B_IV[14] | 0;
212
+ v7h = B2B_IV[15] | 0;
213
+ constructor(opts = {}) {
214
+ const olen = opts.dkLen === undefined ? 64 : opts.dkLen;
215
+ super(128, olen);
216
+ checkBlake2Opts(olen, opts, 64, 16, 16);
217
+ let { key, personalization, salt } = opts;
218
+ let keyLength = 0;
219
+ if (key !== undefined) {
220
+ abytes(key, undefined, 'key');
221
+ keyLength = key.length;
222
+ }
223
+ // RFC 7693 §2.5: xor `p[0] = 0x0101kknn` into the low 32 bits of `h[0]`;
224
+ // the high 32 bits stay at `IV[0]`.
225
+ this.v0l ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24);
226
+ if (salt !== undefined) {
227
+ abytes(salt, undefined, 'salt');
228
+ const slt = u32(salt);
229
+ this.v4l ^= swap8IfBE(slt[0]);
230
+ this.v4h ^= swap8IfBE(slt[1]);
231
+ this.v5l ^= swap8IfBE(slt[2]);
232
+ this.v5h ^= swap8IfBE(slt[3]);
233
+ }
234
+ if (personalization !== undefined) {
235
+ abytes(personalization, undefined, 'personalization');
236
+ const pers = u32(personalization);
237
+ this.v6l ^= swap8IfBE(pers[0]);
238
+ this.v6h ^= swap8IfBE(pers[1]);
239
+ this.v7l ^= swap8IfBE(pers[2]);
240
+ this.v7h ^= swap8IfBE(pers[3]);
241
+ }
242
+ if (key !== undefined) {
243
+ // Pad to blockLen and update
244
+ const tmp = new Uint8Array(this.blockLen);
245
+ tmp.set(key);
246
+ this.update(tmp);
247
+ }
248
+ }
249
+ // prettier-ignore
250
+ get() {
251
+ let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this;
252
+ return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h];
253
+ }
254
+ // prettier-ignore
255
+ set(v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h) {
256
+ this.v0l = v0l | 0;
257
+ this.v0h = v0h | 0;
258
+ this.v1l = v1l | 0;
259
+ this.v1h = v1h | 0;
260
+ this.v2l = v2l | 0;
261
+ this.v2h = v2h | 0;
262
+ this.v3l = v3l | 0;
263
+ this.v3h = v3h | 0;
264
+ this.v4l = v4l | 0;
265
+ this.v4h = v4h | 0;
266
+ this.v5l = v5l | 0;
267
+ this.v5h = v5h | 0;
268
+ this.v6l = v6l | 0;
269
+ this.v6h = v6h | 0;
270
+ this.v7l = v7l | 0;
271
+ this.v7h = v7h | 0;
272
+ }
273
+ compress(msg, offset, isLast) {
274
+ this.get().forEach((v, i) => (BBUF[i] = v)); // First half from state.
275
+ BBUF.set(B2B_IV, 16); // Second half from IV.
276
+ let { h, l } = u64.fromBig(BigInt(this.length));
277
+ BBUF[24] = B2B_IV[8] ^ l; // Low word of the offset.
278
+ BBUF[25] = B2B_IV[9] ^ h; // High word.
279
+ // Invert all bits for last block
280
+ if (isLast) {
281
+ BBUF[28] = ~BBUF[28];
282
+ BBUF[29] = ~BBUF[29];
283
+ }
284
+ let j = 0;
285
+ const s = BSIGMA;
286
+ // SIGMA selects 64-bit message words; multiply by 2 because `msg` stores
287
+ // each word as [low32, high32].
288
+ for (let i = 0; i < 12; i++) {
289
+ G1b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
290
+ G2b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
291
+ G1b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
292
+ G2b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
293
+ G1b(2, 6, 10, 14, msg, offset + 2 * s[j++]);
294
+ G2b(2, 6, 10, 14, msg, offset + 2 * s[j++]);
295
+ G1b(3, 7, 11, 15, msg, offset + 2 * s[j++]);
296
+ G2b(3, 7, 11, 15, msg, offset + 2 * s[j++]);
297
+ G1b(0, 5, 10, 15, msg, offset + 2 * s[j++]);
298
+ G2b(0, 5, 10, 15, msg, offset + 2 * s[j++]);
299
+ G1b(1, 6, 11, 12, msg, offset + 2 * s[j++]);
300
+ G2b(1, 6, 11, 12, msg, offset + 2 * s[j++]);
301
+ G1b(2, 7, 8, 13, msg, offset + 2 * s[j++]);
302
+ G2b(2, 7, 8, 13, msg, offset + 2 * s[j++]);
303
+ G1b(3, 4, 9, 14, msg, offset + 2 * s[j++]);
304
+ G2b(3, 4, 9, 14, msg, offset + 2 * s[j++]);
305
+ }
306
+ this.v0l ^= BBUF[0] ^ BBUF[16];
307
+ this.v0h ^= BBUF[1] ^ BBUF[17];
308
+ this.v1l ^= BBUF[2] ^ BBUF[18];
309
+ this.v1h ^= BBUF[3] ^ BBUF[19];
310
+ this.v2l ^= BBUF[4] ^ BBUF[20];
311
+ this.v2h ^= BBUF[5] ^ BBUF[21];
312
+ this.v3l ^= BBUF[6] ^ BBUF[22];
313
+ this.v3h ^= BBUF[7] ^ BBUF[23];
314
+ this.v4l ^= BBUF[8] ^ BBUF[24];
315
+ this.v4h ^= BBUF[9] ^ BBUF[25];
316
+ this.v5l ^= BBUF[10] ^ BBUF[26];
317
+ this.v5h ^= BBUF[11] ^ BBUF[27];
318
+ this.v6l ^= BBUF[12] ^ BBUF[28];
319
+ this.v6h ^= BBUF[13] ^ BBUF[29];
320
+ this.v7l ^= BBUF[14] ^ BBUF[30];
321
+ this.v7h ^= BBUF[15] ^ BBUF[31];
322
+ clean(BBUF);
323
+ }
324
+ destroy() {
325
+ this.destroyed = true;
326
+ clean(this.buffer32);
327
+ this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
328
+ }
329
+ }
330
+ /**
331
+ * Blake2b hash function. 64-bit. 1.5x slower than blake2s in JS.
332
+ * @param msg - message that would be hashed
333
+ * @param opts - Optional output, MAC, salt, and personalization settings.
334
+ * `dkLen` must be 1..64 bytes; `salt` and `personalization`, if present,
335
+ * must be 16 bytes each. See {@link Blake2Opts}.
336
+ * @returns Digest bytes.
337
+ * @example
338
+ * Hash a message with Blake2b.
339
+ * ```ts
340
+ * blake2b(new Uint8Array([97, 98, 99]));
341
+ * ```
342
+ */
343
+ export const blake2b = /* @__PURE__ */ createHasher((opts) => new _BLAKE2b(opts));
344
+ /**
345
+ * BLAKE2-compress core method.
346
+ * Runs only the round function over a caller-supplied local vector; callers initialize `v0..v15`
347
+ * and apply the final `h[i] ^= v[i] ^ v[i + 8]` fold themselves.
348
+ * @param s - flattened sigma schedule bytes
349
+ * @param offset - starting word offset inside `msg`, not a byte offset
350
+ * @param msg - message words
351
+ * @param rounds - round count to execute
352
+ * @param v0 - state word 0
353
+ * @param v1 - state word 1
354
+ * @param v2 - state word 2
355
+ * @param v3 - state word 3
356
+ * @param v4 - state word 4
357
+ * @param v5 - state word 5
358
+ * @param v6 - state word 6
359
+ * @param v7 - state word 7
360
+ * @param v8 - state word 8
361
+ * @param v9 - state word 9
362
+ * @param v10 - state word 10
363
+ * @param v11 - state word 11
364
+ * @param v12 - state word 12
365
+ * @param v13 - state word 13
366
+ * @param v14 - state word 14
367
+ * @param v15 - state word 15
368
+ * @returns Updated compression state words.
369
+ * @example
370
+ * Run the BLAKE2 compression core on zeroed state and message words.
371
+ * ```ts
372
+ * import { compress } from '@noble/hashes/blake2.js';
373
+ * const state = compress(
374
+ * new Uint8Array(16),
375
+ * 0,
376
+ * new Uint32Array(16),
377
+ * 1,
378
+ * 0, 0, 0, 0, 0, 0, 0, 0,
379
+ * 0, 0, 0, 0, 0, 0, 0, 0
380
+ * );
381
+ * state.v0;
382
+ * ```
383
+ */
384
+ // prettier-ignore
385
+ export function compress(s, offset, msg, rounds, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) {
386
+ let j = 0;
387
+ for (let i = 0; i < rounds; i++) {
388
+ ({ a: v0, b: v4, c: v8, d: v12 } = G1s(v0, v4, v8, v12, msg[offset + s[j++]]));
389
+ ({ a: v0, b: v4, c: v8, d: v12 } = G2s(v0, v4, v8, v12, msg[offset + s[j++]]));
390
+ ({ a: v1, b: v5, c: v9, d: v13 } = G1s(v1, v5, v9, v13, msg[offset + s[j++]]));
391
+ ({ a: v1, b: v5, c: v9, d: v13 } = G2s(v1, v5, v9, v13, msg[offset + s[j++]]));
392
+ ({ a: v2, b: v6, c: v10, d: v14 } = G1s(v2, v6, v10, v14, msg[offset + s[j++]]));
393
+ ({ a: v2, b: v6, c: v10, d: v14 } = G2s(v2, v6, v10, v14, msg[offset + s[j++]]));
394
+ ({ a: v3, b: v7, c: v11, d: v15 } = G1s(v3, v7, v11, v15, msg[offset + s[j++]]));
395
+ ({ a: v3, b: v7, c: v11, d: v15 } = G2s(v3, v7, v11, v15, msg[offset + s[j++]]));
396
+ ({ a: v0, b: v5, c: v10, d: v15 } = G1s(v0, v5, v10, v15, msg[offset + s[j++]]));
397
+ ({ a: v0, b: v5, c: v10, d: v15 } = G2s(v0, v5, v10, v15, msg[offset + s[j++]]));
398
+ ({ a: v1, b: v6, c: v11, d: v12 } = G1s(v1, v6, v11, v12, msg[offset + s[j++]]));
399
+ ({ a: v1, b: v6, c: v11, d: v12 } = G2s(v1, v6, v11, v12, msg[offset + s[j++]]));
400
+ ({ a: v2, b: v7, c: v8, d: v13 } = G1s(v2, v7, v8, v13, msg[offset + s[j++]]));
401
+ ({ a: v2, b: v7, c: v8, d: v13 } = G2s(v2, v7, v8, v13, msg[offset + s[j++]]));
402
+ ({ a: v3, b: v4, c: v9, d: v14 } = G1s(v3, v4, v9, v14, msg[offset + s[j++]]));
403
+ ({ a: v3, b: v4, c: v9, d: v14 } = G2s(v3, v4, v9, v14, msg[offset + s[j++]]));
404
+ }
405
+ return { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 };
406
+ }
407
+ // Blake2s reuses the SHA-256 IV words as-is.
408
+ const B2S_IV = /* @__PURE__ */ SHA256_IV.slice();
409
+ /** Internal blake2s hash class. */
410
+ export class _BLAKE2s extends _BLAKE2 {
411
+ // Internal state, same as SHA-256
412
+ v0 = B2S_IV[0] | 0;
413
+ v1 = B2S_IV[1] | 0;
414
+ v2 = B2S_IV[2] | 0;
415
+ v3 = B2S_IV[3] | 0;
416
+ v4 = B2S_IV[4] | 0;
417
+ v5 = B2S_IV[5] | 0;
418
+ v6 = B2S_IV[6] | 0;
419
+ v7 = B2S_IV[7] | 0;
420
+ constructor(opts = {}) {
421
+ const olen = opts.dkLen === undefined ? 32 : opts.dkLen;
422
+ super(64, olen);
423
+ checkBlake2Opts(olen, opts, 32, 8, 8);
424
+ let { key, personalization, salt } = opts;
425
+ let keyLength = 0;
426
+ if (key !== undefined) {
427
+ abytes(key, undefined, 'key');
428
+ keyLength = key.length;
429
+ }
430
+ // RFC 7693 §2.5: xor `p[0] = 0x0101kknn` directly into `h[0]`, since
431
+ // BLAKE2s stores each state word as one `u32`.
432
+ this.v0 ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24);
433
+ if (salt !== undefined) {
434
+ abytes(salt, undefined, 'salt');
435
+ const slt = u32(salt);
436
+ this.v4 ^= swap8IfBE(slt[0]);
437
+ this.v5 ^= swap8IfBE(slt[1]);
438
+ }
439
+ if (personalization !== undefined) {
440
+ abytes(personalization, undefined, 'personalization');
441
+ const pers = u32(personalization);
442
+ this.v6 ^= swap8IfBE(pers[0]);
443
+ this.v7 ^= swap8IfBE(pers[1]);
444
+ }
445
+ if (key !== undefined) {
446
+ // Pad to blockLen and update
447
+ const tmp = new Uint8Array(this.blockLen);
448
+ tmp.set(key);
449
+ this.update(tmp);
450
+ }
451
+ }
452
+ get() {
453
+ const { v0, v1, v2, v3, v4, v5, v6, v7 } = this;
454
+ return [v0, v1, v2, v3, v4, v5, v6, v7];
455
+ }
456
+ // prettier-ignore
457
+ set(v0, v1, v2, v3, v4, v5, v6, v7) {
458
+ this.v0 = v0 | 0;
459
+ this.v1 = v1 | 0;
460
+ this.v2 = v2 | 0;
461
+ this.v3 = v3 | 0;
462
+ this.v4 = v4 | 0;
463
+ this.v5 = v5 | 0;
464
+ this.v6 = v6 | 0;
465
+ this.v7 = v7 | 0;
466
+ }
467
+ compress(msg, offset, isLast) {
468
+ const { h, l } = u64.fromBig(BigInt(this.length));
469
+ // Seed v8..v15 from the IV, xor the low/high 32-bit byte counter into
470
+ // v12/v13, and invert v14 on the final block.
471
+ // prettier-ignore
472
+ const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = compress(BSIGMA, offset, msg, 10, this.v0, this.v1, this.v2, this.v3, this.v4, this.v5, this.v6, this.v7, B2S_IV[0], B2S_IV[1], B2S_IV[2], B2S_IV[3], l ^ B2S_IV[4], h ^ B2S_IV[5], isLast ? ~B2S_IV[6] : B2S_IV[6], B2S_IV[7]);
473
+ this.v0 ^= v0 ^ v8;
474
+ this.v1 ^= v1 ^ v9;
475
+ this.v2 ^= v2 ^ v10;
476
+ this.v3 ^= v3 ^ v11;
477
+ this.v4 ^= v4 ^ v12;
478
+ this.v5 ^= v5 ^ v13;
479
+ this.v6 ^= v6 ^ v14;
480
+ this.v7 ^= v7 ^ v15;
481
+ }
482
+ destroy() {
483
+ this.destroyed = true;
484
+ clean(this.buffer32);
485
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
486
+ }
487
+ }
488
+ /**
489
+ * Blake2s hash function. Focuses on 8-bit to 32-bit platforms. 1.5x faster than blake2b in JS.
490
+ * @param msg - message that would be hashed
491
+ * @param opts - Optional output, MAC, salt, and personalization settings.
492
+ * `dkLen` must be 1..32 bytes; `salt` and `personalization`, if present,
493
+ * must be 8 bytes each. See {@link Blake2Opts}.
494
+ * @returns Digest bytes.
495
+ * @example
496
+ * Hash a message with Blake2s.
497
+ * ```ts
498
+ * blake2s(new Uint8Array([97, 98, 99]));
499
+ * ```
500
+ */
501
+ export const blake2s = /* @__PURE__ */ createHasher((opts) => new _BLAKE2s(opts));
502
+ //# sourceMappingURL=blake2.js.map