Consensys / gnark-crypto

gnark-crypto provides elliptic curve and pairing-based cryptography on BN, BLS12, BLS24 and BW6 curves. It also provides various algorithms (algebra, crypto) of particular interest to zero knowledge proof systems.
Apache License 2.0
495 stars 160 forks source link

feat: define and implement field hasher implement for snark-friendly hash functions #448

Open ivokub opened 1 year ago

ivokub commented 1 year ago

Is your feature request related to a problem? Please describe. gnark has field hasher and binary hasher interfaces separated.

Describe the solution you'd like Similarly to gnark, also define FieldHasher interface and implement it for the hash functions for which it is natural (mimc, poseidon etc.). Then it's easier to have interoperability with gnark and we can avoid the edge cases related to having a binary-hasher (need to decompose the input bytes into field elements)

gbotrel commented 1 year ago

cc @Tabaie