From 421ea0ab2dad8d6a64b5b1bdd0e129394a9a3015 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Sun, 5 Jan 2025 02:46:51 -0800 Subject: [PATCH] PoW does not need to be secure, so just use basic fast PRNG. --- src/lib/workers/powgpu.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/workers/powgpu.ts b/src/lib/workers/powgpu.ts index deb688e..6ade30d 100644 --- a/src/lib/workers/powgpu.ts +++ b/src/lib/workers/powgpu.ts @@ -315,7 +315,7 @@ export class PowGpu extends WorkerInterface { const uint32 = hashHex.slice(i, i + 8) uboView.setUint32(i / 2, parseInt(uint32, 16)) } - const random = crypto.getRandomValues(new Uint32Array(1))[0] + const random = Math.floor((Math.random() * 0xffffffff)) uboView.setUint32(32, random, true) uboView.setUint32(36, threshold, true) PowGpu.#device.queue.writeBuffer(PowGpu.#uboBuffer, 0, uboView) -- 2.34.1