1 unstable release
| 0.1.0 | Dec 19, 2025 |
|---|
#596 in Cryptography
Used in 2 crates
1MB
4K
SLoC
SHA3/Keccak implementation for Halo2
A chip to implement the keccak-f[1600] permutation and two gadgets to implement the sha3-256 hash function and the keccak256 hash function in halo2.
The chip is based on a single lookup and it uses packed arithmetic techniques.
Usage
For basic usage check out the example and the intergration test.
Techniques
For an in-depth explanation on how the chip works and the underlying techniques, start here.
Benchmarks
We run benchmarks for computing a preimage for various input sizes. The benchmarks were done in a Lenovo Thinkpad X1 Xtreame Gen5 laptop with an Intel Core i7-12700H cpu and 32GB of RAM.
The benchmarks are done for a 2^14 lookup table implementation. The circuit uses 10 advice columns and 9 fixed columns. All the constraints access at most the rotations $X$, $\omega X$ and $\omega^2 X$.
For all the preimage bit lenghts the verification key size is 902 bytes and the proof size is 5408 bytes. The verification time is ~4.5ms.
| Preimage size in bytes | Number of rows | Prover time |
|---|---|---|
| 100 | 2^14 | 1.8 s |
| 200 | 2^14 | 2.1 s |
| 300 | 2^14 | 2.4 s |
| 400 | 2^14 | 2.5 s |
| 500 | 2^15 | 3.8 s |
| 750 | 2^15 | 4.5 s |
| 1000 | 2^16 | 6.9 s |
| 2000 | 2^16 | 9.1 s |
| 3000 | 2^17 | 15.4 s |
| 5000 | 2^18 | 26.7 s |
| 10000 | 2^19 | 53.9 s |
Disclaimer
This project is provided "as is" and is intended for educational and experimental purposes only. The library has not been audited. It is not production-ready and may contain bugs or incomplete features. Use at your own risk.
The authors and contributors are not responsible for any damage, loss of data, or other issues that may arise from using this software.
License
This project is licensed under the Apache License 2.0.
Acknowledgments
Special thanks to @John-Gong-Math and @iquerejeta for contributions, discussions and feedback on the project.
Dependencies
~17MB
~326K SLoC