You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// The initial value for the capacity element initialized with 0 for standard Poseidon
205
-
let iv = U256::from_u32(&self.env,0);
206
-
letmut sponge = PoseidonSponge::new(&self.env, iv, field);
207
-
for input in inputs.iter(){
208
-
sponge.absorb(input);
209
-
}
210
-
sponge.squeeze()
202
+
/// Performs a Poseidon hash using a sponge construction that matches circom's [implementation](https://github.com/iden3/circomlib/blob/35e54ea21da3e8762557234298dbb553c175ea8d/circuits/poseidon.circom)
// The initial value for the capacity element initialized with `input.len() * 2^24` for Poseidon2
216
-
let iv = U256::from_u128(&self.env,(inputs.len()asu128) << 64);
217
-
letmut sponge = Poseidon2Sponge::new(&self.env, iv, field);
218
-
for input in inputs.iter(){
219
-
sponge.absorb(input);
220
-
}
221
-
sponge.squeeze()
208
+
/// Performs a poseidon2 hash with a sponge construction that matches noir's implementation.
209
+
/// Uses rate=3 (t=4) to match the noir/barretenberg [implementation](https://github.com/noir-lang/noir/blob/abfee1f54b20984172ba23482f4af160395cfba5/noir_stdlib/src/hash/poseidon2.nr).
0 commit comments