MCPcopy Index your code
hub / github.com/arkworks-rs/poly-commit / test_sponge

Function test_sponge

poly-commit/src/utils.rs:183–210  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

181
182#[cfg(test)]
183pub(crate) fn test_sponge<F: PrimeField>() -> PoseidonSponge<F> {
184 use ark_crypto_primitives::sponge::{poseidon::PoseidonConfig, CryptographicSponge};
185 use ark_std::test_rng;
186
187 let full_rounds = 8;
188 let partial_rounds = 31;
189 let alpha = 17;
190
191 let mds = vec![
192 vec![F::one(), F::zero(), F::one()],
193 vec![F::one(), F::one(), F::zero()],
194 vec![F::zero(), F::one(), F::one()],
195 ];
196
197 let mut v = Vec::new();
198 let mut ark_rng = test_rng();
199
200 for _ in 0..(full_rounds + partial_rounds) {
201 let mut res = Vec::new();
202
203 for _ in 0..3 {
204 res.push(F::rand(&mut ark_rng));
205 }
206 v.push(res);
207 }
208 let config = PoseidonConfig::new(full_rounds, partial_rounds, alpha, mds, v, 2, 1);
209 PoseidonSponge::new(&config)
210}
211
212#[cfg(test)]
213pub(crate) mod tests {

Callers

nothing calls this directly

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected