Closed AlexandreBelling closed 1 year ago
You have successfully added a new CodeQL configuration /language:java
. As part of the setup process, we have scanned this repository and found 7 existing alerts. Please check the repository Security tab to see all alerts.
Add an implementation of MiMC on the bn254 scalar field in rust.
MIMC5 is a hash function suited for BN256's scalar field.
It has modulus
p = 21888242871839275222246405745257275088548364400416034343698204186575808495617
The MIMC paper (https://eprint.iacr.org/2016/492.pdf) states that monomial x^d is a permutation in Fp if gcd(d,p) == 1. Exponent for MIMC is 5, which satisfies the above condition.
Interface
The implementation targets full consistency with the present implementation:
Consistency testing with gnark's implementation
gnark and the present implementation are tested to give the same result for the strings.
0x0000000000000000000000000000000000000000000000000000000000000000
0x0000000000000000000000000000000000000000000000000000000000000001
0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000f