https://github.com/shuklaayush/circom-monolith
Monolith hash function implementation in circom.
https://github.com/shuklaayush/circom-monolith
Last synced: 7 days ago
JSON representation
Monolith hash function implementation in circom.
- Host: GitHub
- URL: https://github.com/shuklaayush/circom-monolith
- Owner: shuklaayush
- Created: 2023-11-11T22:36:35.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-01T22:14:23.000Z (over 1 year ago)
- Last Synced: 2025-02-17T21:46:18.443Z (3 months ago)
- Language: Circom
- Homepage:
- Size: 58.6 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# circom-monolith
This repository contains a circom implementation of the [Monolith](https://eprint.iacr.org/2023/1025) hash function over the Goldilocks prime field $\mathbb{F}_p$ where $p = 2^{64} - 2^{32} + 1$.
[Open in zkREPL](https://zkrepl.dev/?gist=9f513ee275e003ebf8a53559cc8b9198)
## Test
To run a test against the [test vectors](https://github.com/HorizenLabs/monolith/blob/823039b29ea05d77f20613311da9a179e70c88ea/src/monolith_hash/monolith_goldilocks.rs#L396-L415)
```
yarn install
yarn test
```## Acknowledgements
The code is based on the [reference implementation](https://github.com/HorizenLabs/monolith/tree/main) of Monolith from Horizon Labs.
The implementation of the Goldilocks field is taken from [plonky2-circom](https://github.com/polymerdao/plonky2-circom/blob/main/circom/circuits/goldilocks.circom).
## Disclaimer
These circuits were written over a few hours during [ZK Hack Istanbul](https://www.zkistanbul.com).
While they pass the test vectors, they have **NOT** been formally audited. Therefore, they should not be deployed in production. There's also a lot of scope for optimizations to reduce the number of constraints.
The plonky2-circom Goldilocks implementation might be [underconstrained](https://github.com/polymerdao/plonky2-circom/issues/5).
PRs welcome