let output = ` /**
* Buffers and counters
* - b: input buffer, filled and refilled by input data in ${B_LENGTH} byte increments
- * - c: buffer counter, points to current index in \`b\`
* - h: chain buffer, updated after each compression
* - p: set according to BLAKE2 layout from constructor arguments
+ * - c: buffer counter, points to current index in \`b\`
* - t: total byte counter, incremented by \`c\`
* - Note: BLAKE2b reference supports 2¹²⁸-1, but this implementation restricts to 2⁶⁴-1 for compatibility with WASM without SIMD)
*/
b: StaticArray<u8> = new StaticArray<u8>(${B_LENGTH})
- c: u8 = 0
h: StaticArray<u64> = new StaticArray<u64>(${H_LENGTH})
p: StaticArray<u8> = new StaticArray<u8>(64)
+ c: u8 = 0
t: u64 = 0
`
return output
function CLEAR () {
let output = ` this.b.fill(0)
- this.c = 0
this.h.fill(0)
this.p.fill(0)
+ this.c = 0
this.t = 0
`
/**
* Buffers and counters
* - b: input buffer, filled and refilled by input data in 128 byte increments
- * - c: buffer counter, points to current index in `b`
* - h: chain buffer, updated after each compression
* - p: set according to BLAKE2 layout from constructor arguments
+ * - c: buffer counter, points to current index in `b`
* - t: total byte counter, incremented by `c`
* - Note: BLAKE2b reference supports 2¹²⁸-1, but this implementation restricts to 2⁶⁴-1 for compatibility with WASM without SIMD)
*/
b: StaticArray<u8> = new StaticArray<u8>(128)
- c: u8 = 0
h: StaticArray<u64> = new StaticArray<u64>(8)
p: StaticArray<u8> = new StaticArray<u8>(64)
+ c: u8 = 0
t: u64 = 0
init (): Blake2b {
// reset buffers and counters
this.b.fill(0)
- this.c = 0
this.h.fill(0)
this.p.fill(0)
+ this.c = 0
this.t = 0
// initialize parameter block
// clear internal buffers and counters
this.b.fill(0)
- this.c = 0
this.h.fill(0)
this.p.fill(0)
+ this.c = 0
this.t = 0
return