From: Chris Duncan Date: Sun, 5 Jan 2025 10:46:51 +0000 (-0800) Subject: PoW does not need to be secure, so just use basic fast PRNG. X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=421ea0ab2dad8d6a64b5b1bdd0e129394a9a3015;p=libnemo.git PoW does not need to be secure, so just use basic fast PRNG. --- 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)