]> zoso.dev Git - libnemo.git/commitdiff
PoW does not need to be secure, so just use basic fast PRNG.
authorChris Duncan <chris@zoso.dev>
Sun, 5 Jan 2025 10:46:51 +0000 (02:46 -0800)
committerChris Duncan <chris@zoso.dev>
Sun, 5 Jan 2025 10:46:51 +0000 (02:46 -0800)
src/lib/workers/powgpu.ts

index deb688ecc9ce7c692251fbbb74002852730bff04..6ade30dcfb154c0ef117cd6853b19d913aaee62b 100644 (file)
@@ -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)