You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1018 B

3 years ago
  1. # keccak256-circom [![Test](https://github.com/vocdoni/keccak256-circom/workflows/Test/badge.svg)](https://github.com/vocdoni/keccak256-circom/actions?query=workflow%3ATest)
  2. Keccak256 hash function (ethereum version) implemented in [circom](https://github.com/iden3/circom). Spec: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf
  3. **Warning**: WIP, this is an experimental repo.
  4. ## Status
  5. Initial version works, compatible with Ethereum version of Keccak256.
  6. It needs around `150848` (`151k`) constraints.
  7. > For context: [Rapidsnark](https://github.com/iden3/rapidsnark) proof generation time:
  8. > - 1.1M constraints -> 7 seconds (8 CPU)
  9. > - 128M constraints -> <2min (64 CPU)
  10. ## Usage
  11. - import the lib in the `package.json`:
  12. ```
  13. "dependencies": {
  14. "keccak256-circom": "git+https://github.com/vocdoni/keccak256-circom"
  15. }
  16. ```
  17. - Usage:
  18. ```
  19. pragma circom 2.0.0;
  20. include "../node_modules/keccak256-circom/circuits/keccak.circom";
  21. // for a input & output of 32 bytes:
  22. component main = Keccak(32*8, 32*8);
  23. ```