Skip to content
This repository was archived by the owner on Jan 1, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ Before you can use this implementation, ensure you have the Noir language and it
Once you have Noir set up, clone this repository to your local machine:

```bash
git clone https://github.com/yourusername/mimc-sponge-noir.git
git clone https://github.com/KumaCrypto/mimc_sponge_noir.git
cd mimc-sponge-noir
```

To import this as a dependency in your noir project, please add this to your nargo`[dependencies]`. Replace the tag with the version you wish to use.
```
mimc_sponge = { tag = "v0.0.2", git = "https://github.com/KumaCrypto/mimc_sponge_noir" }
```

## Disclaimer

This `MiMC Sponge` hash function implementation is provided as-is without any warranty. It has not been audited and is not guaranteed to be secure. It is intended for educational and research purposes only. Users should conduct their own due diligence and risk assessment before deploying it in production environments or for high-stakes applications.
Expand Down
4 changes: 2 additions & 2 deletions src/lib.nr
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use constants::get_c_partial;

// log_5(21888242871839275222246405745257275088548364400416034343698204186575808495617) ~= 110
// => nRounds should be 220
global nRounds: Field = 220;
global nRounds: u64 = 220;

pub fn mimc_sponge<N, M>(ins: [Field; N], k: Field) -> [Field; M] {
pub fn mimc_sponge<let N: u32, let M: u32>(ins: [Field; N], k: Field) -> [Field; M] {
let mut S = MiMCFeistel(ins[0], 0, k); // First round with xL = ins[0] and xR = 0

for i in 1..N {
Expand Down