This repository is result of a joint effort of Demox Labs, Aleo and Aztec to accelerate Zero Knowledge cryptography in the browser using WebGPU.
Right now, most operations are supported on BLS12-377 & BN-254.
Support operations include:
- Field Math
- Curve Math
- Multi-Scalar Multiplications (MSMs)
- Poseidon Hashes
- Number Theoretic Transforms (NTTs aka FFTs)
Ensure you have:
Then run the following:
git clone https://github.com/demox-labs/webgpu-crypto && cd webgpu-crypto
yarn
Run a local server on localhost:4040.
yarn start
Note -- running webgpu functions will only work on browsers compatible with webgpu.
Common issues:
- If you are unable to run the webgpu benchmarks, ensure you are using a webgpu-compatible browser.
- If you are not able to load the test case data, be sure you have installed git LFS. You can either reclone the repo after installing git LFS or run
git lfs fetch && git lfs pull
. - If you run into general npm package errors, make sure you have nodejs v16 or later installed.
- If you are using webgpu functions and getting all 0s as output, you may have hit an out of memory error in the gpu. Reduce your input size or consider breaking your computions into smaller steps.
None of this code has been audited for correctness or security. Use at your own risk.
We will additionally be releasing an npm package to make using this code easier.
[1] Scalar-multiplication algorithms. https://cryptojedi.org/peter/data/eccss-20130911b.pdf
[2] wgsl reference https://www.w3.org/TR/WGSL/