Expand description
MiMC-Feistel sponge hash function.
MiMC (Minimal Multiplicative Complexity) is a hash function designed for efficient evaluation inside arithmetic circuits, particularly in ZK-SNARKs.
§Algorithm
This implementation uses the MiMC-Feistel-Sponge construction with:
- Feistel network structure for the permutation
- Sponge construction for variable-length input
- Exponent of 5 (x^5) for the round function
§Constants
The round constants are derived deterministically. The default configuration uses constants compatible with circomlib/Tornado Cash implementations.
§References
§Example
use stealth_lib::hash::MimcHasher;
let hasher = MimcHasher::default();
let hash = hasher.hash(123, 456);
println!("MiMC hash: {}", hash);§Security Note
This implementation is designed for use in ZK circuits. It is:
- NOT constant-time (do not use where timing attacks are a concern)
- NOT suitable for password hashing (use argon2, bcrypt, or scrypt instead)
Structs§
- Hasher
Deprecated - Legacy Hasher struct for backwards compatibility.
- Mimc
Hasher - MiMC-Feistel sponge hasher.