*/
const BLAKE2B_IV32_1: u32 = 0x6A09E667u;
-
-/**
-* G Mixing function
-*/
-fn G (
- va0: ptr<function, u32>, va1: ptr<function, u32>,
- vb0: ptr<function, u32>, vb1: ptr<function, u32>,
- vc0: ptr<function, u32>, vc1: ptr<function, u32>,
- vd0: ptr<function, u32>, vd1: ptr<function, u32>,
- mx0: u32, mx1: u32, my0: u32, my1: u32
-) {
- var o0: u32;
- var o1: u32;
- var xor0: u32;
- var xor1: u32;
-
- // a = a + b
- o0 = *va0 + *vb0;
- o1 = *va1 + *vb1;
- o1 = o1 + select(0u, 1u, o0 < *va0);
- *va0 = o0;
- *va1 = o1;
-
- // a = a + m[sigma[r][2*i+0]]
- o0 = *va0 + mx0;
- o1 = *va1 + mx1;
- o1 = o1 + select(0u, 1u, o0 < *va0);
- *va0 = o0;
- *va1 = o1;
-
- // d = rotr64(d ^ a, 32)
- xor0 = *vd0 ^ *va0;
- xor1 = *vd1 ^ *va1;
- *vd0 = xor1;
- *vd1 = xor0;
-
- // c = c + d
- o0 = *vc0 + *vd0;
- o1 = *vc1 + *vd1;
- o1 = o1 + select(0u, 1u, o0 < *vc0);
- *vc0 = o0;
- *vc1 = o1;
-
- // b = rotr64(b ^ c, 24)
- xor0 = *vb0 ^ *vc0;
- xor1 = *vb1 ^ *vc1;
- *vb0 = (xor0 >> 24u) ^ (xor1 << 8u);
- *vb1 = (xor1 >> 24u) ^ (xor0 << 8u);
-
- // a = a + b
- o0 = *va0 + *vb0;
- o1 = *va1 + *vb1;
- o1 = o1 + select(0u, 1u, o0 < *va0);
- *va0 = o0;
- *va1 = o1;
-
- // a = a + m[sigma[r][2*i+1]]
- o0 = *va0 + my0;
- o1 = *va1 + my1;
- o1 = o1 + select(0u, 1u, o0 < *va0);
- *va0 = o0;
- *va1 = o1;
-
- // d = rotr64(d ^ a, 16)
- xor0 = *vd0 ^ *va0;
- xor1 = *vd1 ^ *va1;
- *vd0 = (xor0 >> 16u) ^ (xor1 << 16u);
- *vd1 = (xor1 >> 16u) ^ (xor0 << 16u);
-
- // c = c + d
- o0 = *vc0 + *vd0;
- o1 = *vc1 + *vd1;
- o1 = o1 + select(0u, 1u, o0 < *vc0);
- *vc0 = o0;
- *vc1 = o1;
-
- // b = rotr64(b ^ c, 63)
- xor0 = *vb0 ^ *vc0;
- xor1 = *vb1 ^ *vc1;
- *vb0 = (xor1 >> 31u) ^ (xor0 << 1u);
- *vb1 = (xor0 >> 31u) ^ (xor1 << 1u);
-}
-
/**
* Main compute function
* 8-byte work is split into two 4-byte u32. Low 4 bytes are random u32 from