From: Chris Duncan Date: Mon, 6 Jan 2025 14:38:58 +0000 (-0800) Subject: Document odd difference between blake C reference implementation and nano-webgl-pow... X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=b509acf312b7b82211b065ee36e5aaa3fde2443f;p=libnemo.git Document odd difference between blake C reference implementation and nano-webgl-pow port that might need fixing later. --- diff --git a/src/lib/workers/powgpu.ts b/src/lib/workers/powgpu.ts index b9be12c..51c9506 100644 --- a/src/lib/workers/powgpu.ts +++ b/src/lib/workers/powgpu.ts @@ -199,6 +199,9 @@ export class PowGpu extends WorkerInterface { /** * Initialize (nonce||blockhash) concatenation + * NOTE: blake2b reference uses uint64_t whereas we have u32 + * Array length might need to increase from 16 to 32 because of this + * Unsure why it works anyway now since it should throw out-of-range error? */ var m: array; m[0u] = ubo.random; @@ -322,14 +325,14 @@ export class PowGpu extends WorkerInterface { G(&v, &m, 6u, 8u, 18u, 28u, m[30u], m[31u], m[16u], m[17u]); // ROUND(4) - G(&v, &m, 0u, 8u, 16u, 24u, 18u, 0u); - G(&v, &m, 2u, 10u, 18u, 26u, 10u, 14u); - G(&v, &m, 4u, 12u, 20u, 28u, 4u, 8u); - G(&v, &m, 6u, 14u, 22u, 30u, 20u, 30u); - G(&v, &m, 0u, 10u, 20u, 30u, 28u, 2u); - G(&v, &m, 2u, 12u, 22u, 24u, 22u, 24u); - G(&v, &m, 4u, 14u, 16u, 26u, 12u, 16u); - G(&v, &m, 6u, 8u, 18u, 28u, 6u, 26u); + G(&v, &m, 0u, 8u, 16u, 24u, m[18u], m[19u], m[0u], m[1u]); + G(&v, &m, 2u, 10u, 18u, 26u, m[10u], m[11u], m[14u], m[15u]); + G(&v, &m, 4u, 12u, 20u, 28u, m[4u], m[5u], m[8u], m[9u]); + G(&v, &m, 6u, 14u, 22u, 30u, m[20u], m[21u], m[30u], m[31u]); + G(&v, &m, 0u, 10u, 20u, 30u, m[28u], m[29u], m[2u], m[3u]); + G(&v, &m, 2u, 12u, 22u, 24u, m[22u], m[23u], m[24u], m[25u]); + G(&v, &m, 4u, 14u, 16u, 26u, m[12u], m[13u], m[16u], m[17u]); + G(&v, &m, 6u, 8u, 18u, 28u, m[6u], m[7u], m[26u], m[27u]); // ROUND(5) G(&v, &m, 0u, 8u, 16u, 24u, 4u, 24u);