diff --git a/plain_implementations/src/fields/m31.rs b/plain_implementations/src/fields/m31.rs new file mode 100644 index 0000000..01bd307 --- /dev/null +++ b/plain_implementations/src/fields/m31.rs @@ -0,0 +1,8 @@ +use ark_ff::fields::{Fp64, MontBackend, MontConfig}; +use std::convert::TryInto; + +#[derive(MontConfig)] +#[modulus = "2147483647"] // M31 = 2^31 - 1 +#[generator = "7"] +pub struct FqConfig; +pub type FpM31 = Fp64>; diff --git a/plain_implementations/src/fields/mod.rs b/plain_implementations/src/fields/mod.rs index 12b058e..6ec66c8 100644 --- a/plain_implementations/src/fields/mod.rs +++ b/plain_implementations/src/fields/mod.rs @@ -15,6 +15,7 @@ pub mod babybear; pub mod pallas; pub mod vesta; pub mod utils; +pub mod m31; // sage: // p = 21888242871839275222246405745257275088548364400416034343698204186575808495617 diff --git a/plain_implementations/src/poseidon2/mod.rs b/plain_implementations/src/poseidon2/mod.rs index 902639e..5d4bd1c 100644 --- a/plain_implementations/src/poseidon2/mod.rs +++ b/plain_implementations/src/poseidon2/mod.rs @@ -6,4 +6,5 @@ pub mod poseidon2_instance_babybear; pub mod poseidon2_instance_bls12; pub mod poseidon2_instance_bn256; pub mod poseidon2_instance_pallas; -pub mod poseidon2_instance_vesta; \ No newline at end of file +pub mod poseidon2_instance_vesta; +pub mod poseidon2_instance_m31; diff --git a/plain_implementations/src/poseidon2/poseidon2.rs b/plain_implementations/src/poseidon2/poseidon2.rs index e306e42..6654d32 100644 --- a/plain_implementations/src/poseidon2/poseidon2.rs +++ b/plain_implementations/src/poseidon2/poseidon2.rs @@ -40,7 +40,7 @@ impl Poseidon2 { current_state[0] = self.sbox_p(¤t_state[0]); self.matmul_internal(&mut current_state, &self.params.mat_internal_diag_m_1); } - + for r in p_end..self.params.rounds { current_state = self.add_rc(¤t_state, &self.params.round_constants[r]); current_state = self.sbox(¤t_state); @@ -611,4 +611,66 @@ mod poseidon2_tests_vesta { assert_eq!(perm[2], from_hex("0x262316c0ce5244838c75873299b59d763ae0849d2dd31bdc95caf7db1c2901bf")); } -} \ No newline at end of file +} + +#[allow(unused_imports)] +#[cfg(test)] +mod poseidon2_tests_m31 { + use super::*; + use crate::fields::{m31::FpM31, utils::from_hex, utils::random_scalar}; + use crate::poseidon2::poseidon2_instance_m31::POSEIDON2_M31_16_PARAMS; + use std::convert::TryFrom; + + type Scalar = FpM31; + + static TESTRUNS: usize = 5; + + #[test] + fn consistent_perm() { + let poseidon2 = Poseidon2::new(&POSEIDON2_M31_16_PARAMS); + let t = poseidon2.params.t; + for _ in 0..TESTRUNS { + let input1: Vec = (0..t).map(|_| random_scalar()).collect(); + + let mut input2: Vec; + loop { + input2 = (0..t).map(|_| random_scalar()).collect(); + if input1 != input2 { + break; + } + } + + let perm1 = poseidon2.permutation(&input1); + let perm2 = poseidon2.permutation(&input1); + let perm3 = poseidon2.permutation(&input2); + assert_eq!(perm1, perm2); + assert_ne!(perm1, perm3); + } + } + + #[test] + fn kats() { + let poseidon2 = Poseidon2::new(&POSEIDON2_M31_16_PARAMS); + let mut input: Vec = vec![]; + for i in 0..poseidon2.params.t { + input.push(Scalar::from(i as u64)); + } + let perm = poseidon2.permutation(&input); + assert_eq!(perm[0], from_hex("0x505d9689")); + assert_eq!(perm[1], from_hex("0x3b64c904")); + assert_eq!(perm[2], from_hex("0x79e2fd81")); + assert_eq!(perm[3], from_hex("0x4ba8015f")); + assert_eq!(perm[4], from_hex("0x24b6d2f5")); + assert_eq!(perm[5], from_hex("0x23845add")); + assert_eq!(perm[6], from_hex("0x521f4314")); + assert_eq!(perm[7], from_hex("0x69dfb019")); + assert_eq!(perm[8], from_hex("0x2aaae419")); + assert_eq!(perm[9], from_hex("0x6cb4502c")); + assert_eq!(perm[10], from_hex("0x6f7fa65a")); + assert_eq!(perm[11], from_hex("0x75feff24")); + assert_eq!(perm[12], from_hex("0x128d6587")); + assert_eq!(perm[13], from_hex("0x515877e4")); + assert_eq!(perm[14], from_hex("0x037f4dd7")); + assert_eq!(perm[15], from_hex("0x134b427f")); + } +} diff --git a/plain_implementations/src/poseidon2/poseidon2_instance_m31.rs b/plain_implementations/src/poseidon2/poseidon2_instance_m31.rs new file mode 100644 index 0000000..f763834 --- /dev/null +++ b/plain_implementations/src/poseidon2/poseidon2_instance_m31.rs @@ -0,0 +1,721 @@ +use super::poseidon2_params::Poseidon2Params; +use crate::fields::m31::FpM31; +use crate::fields::utils::from_hex; + +use lazy_static::lazy_static; +use std::sync::Arc; + +type Scalar = FpM31; + +lazy_static! { + pub static ref MAT_DIAG16_M_1: Vec = vec![ + from_hex("0x07b80ac4"), + from_hex("0x6bd9cb33"), + from_hex("0x48ee3f9f"), + from_hex("0x4f63dd19"), + from_hex("0x18c546b3"), + from_hex("0x5af89e8b"), + from_hex("0x4ff23de8"), + from_hex("0x4f78aaf6"), + from_hex("0x53bdc6d4"), + from_hex("0x5c59823e"), + from_hex("0x2a471c72"), + from_hex("0x4c975e79"), + from_hex("0x58dc64d4"), + from_hex("0x06e9315d"), + from_hex("0x2cf32286"), + from_hex("0x2fb6755d"), + ]; + pub static ref MAT_INTERNAL16: Vec> = vec![ + vec![ + from_hex("0x07b80ac5"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + ], + vec![ + from_hex("0x00000001"), + from_hex("0x6bd9cb34"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + ], + vec![ + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x48ee3fa0"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + ], + vec![ + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x4f63dd1a"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + ], + vec![ + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x18c546b4"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + ], + vec![ + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x5af89e8c"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + ], + vec![ + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x4ff23de9"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + ], + vec![ + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x4f78aaf7"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + ], + vec![ + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x53bdc6d5"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + ], + vec![ + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x5c59823f"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + ], + vec![ + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x2a471c73"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + ], + vec![ + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x4c975e7a"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + ], + vec![ + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x58dc64d5"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + ], + vec![ + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x06e9315e"), + from_hex("0x00000001"), + from_hex("0x00000001"), + ], + vec![ + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x2cf32287"), + from_hex("0x00000001"), + ], + vec![ + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x00000001"), + from_hex("0x2fb6755e"), + ], + ]; + pub static ref RC16: Vec> = vec![ + vec![ + from_hex("0x768bab52"), + from_hex("0x70e0ab7d"), + from_hex("0x3d266c8a"), + from_hex("0x6da42045"), + from_hex("0x600fef22"), + from_hex("0x41dace6b"), + from_hex("0x64f9bdd4"), + from_hex("0x5d42d4fe"), + from_hex("0x76b1516d"), + from_hex("0x6fc9a717"), + from_hex("0x70ac4fb6"), + from_hex("0x00194ef6"), + from_hex("0x22b644e2"), + from_hex("0x1f7916d5"), + from_hex("0x47581be2"), + from_hex("0x2710a123"), + ], + vec![ + from_hex("0x6284e867"), + from_hex("0x018d3afe"), + from_hex("0x5df99ef3"), + from_hex("0x4c1e467b"), + from_hex("0x566f6abc"), + from_hex("0x2994e427"), + from_hex("0x538a6d42"), + from_hex("0x5d7bf2cf"), + from_hex("0x7fda2dab"), + from_hex("0x0fd854c4"), + from_hex("0x46922fca"), + from_hex("0x3d7763a1"), + from_hex("0x19fd05ca"), + from_hex("0x0a4bbb43"), + from_hex("0x15075851"), + from_hex("0x3d903d76"), + ], + vec![ + from_hex("0x2d290ff7"), + from_hex("0x40809fa0"), + from_hex("0x59dac6ec"), + from_hex("0x127927a2"), + from_hex("0x6bbf0ea0"), + from_hex("0x0294140f"), + from_hex("0x24742976"), + from_hex("0x6e84c081"), + from_hex("0x22484f4a"), + from_hex("0x354cae59"), + from_hex("0x0453ffe1"), + from_hex("0x3f47a3cc"), + from_hex("0x0088204e"), + from_hex("0x6066e109"), + from_hex("0x3b7c4b80"), + from_hex("0x6b55665d"), + ], + vec![ + from_hex("0x3bc4b897"), + from_hex("0x735bf378"), + from_hex("0x508daf42"), + from_hex("0x1884fc2b"), + from_hex("0x7214f24c"), + from_hex("0x7498be0a"), + from_hex("0x1a60e640"), + from_hex("0x3303f928"), + from_hex("0x29b46376"), + from_hex("0x5c96bb68"), + from_hex("0x65d097a5"), + from_hex("0x1d358e9f"), + from_hex("0x4a9a9017"), + from_hex("0x4724cf76"), + from_hex("0x347af70f"), + from_hex("0x1e77e59a"), + ], + vec![ + from_hex("0x7f7ec4bf"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + ], + vec![ + from_hex("0x0421926f"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + ], + vec![ + from_hex("0x5198e669"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + ], + vec![ + from_hex("0x34db3148"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + ], + vec![ + from_hex("0x4368bafd"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + ], + vec![ + from_hex("0x66685c7f"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + ], + vec![ + from_hex("0x78d3249a"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + ], + vec![ + from_hex("0x60187881"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + ], + vec![ + from_hex("0x76dad67a"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + ], + vec![ + from_hex("0x0690b437"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + ], + vec![ + from_hex("0x1ea95311"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + ], + vec![ + from_hex("0x40e5369a"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + ], + vec![ + from_hex("0x38f103fc"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + ], + vec![ + from_hex("0x1d226a21"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + from_hex("0x00000000"), + ], + vec![ + from_hex("0x57090613"), + from_hex("0x1fa42108"), + from_hex("0x17bbef50"), + from_hex("0x1ff7e11c"), + from_hex("0x047b24ca"), + from_hex("0x4e140275"), + from_hex("0x4fa086f5"), + from_hex("0x079b309c"), + from_hex("0x1159bd47"), + from_hex("0x6d37e4e5"), + from_hex("0x075d8dce"), + from_hex("0x12121ca0"), + from_hex("0x7f6a7c40"), + from_hex("0x68e182ba"), + from_hex("0x5493201b"), + from_hex("0x0444a80e"), + ], + vec![ + from_hex("0x0064f4c6"), + from_hex("0x6467abe6"), + from_hex("0x66975762"), + from_hex("0x2af68f9b"), + from_hex("0x345b33be"), + from_hex("0x1b70d47f"), + from_hex("0x053db717"), + from_hex("0x381189cb"), + from_hex("0x43b915f8"), + from_hex("0x20df3694"), + from_hex("0x0f459d26"), + from_hex("0x77a0e97b"), + from_hex("0x2f73e739"), + from_hex("0x1876c2f9"), + from_hex("0x65a0e29a"), + from_hex("0x4cabefbe"), + ], + vec![ + from_hex("0x5abd1268"), + from_hex("0x4d34a760"), + from_hex("0x12771799"), + from_hex("0x69a0c9ac"), + from_hex("0x39091e55"), + from_hex("0x7f611cd0"), + from_hex("0x3af055da"), + from_hex("0x7ac0bbdf"), + from_hex("0x6e0f3a24"), + from_hex("0x41e3b6f7"), + from_hex("0x49b3756d"), + from_hex("0x568bc538"), + from_hex("0x20c079d8"), + from_hex("0x1701c72c"), + from_hex("0x7670dc6c"), + from_hex("0x5a439035"), + ], + vec![ + from_hex("0x7c93e00e"), + from_hex("0x561fbb4d"), + from_hex("0x1178907b"), + from_hex("0x02737406"), + from_hex("0x32fb24f1"), + from_hex("0x6323b60a"), + from_hex("0x6ab12418"), + from_hex("0x42c99cea"), + from_hex("0x155a0b97"), + from_hex("0x53d1c6aa"), + from_hex("0x2bd20347"), + from_hex("0x279b3d73"), + from_hex("0x4f5f3c70"), + from_hex("0x0245af6c"), + from_hex("0x238359d3"), + from_hex("0x49966a59"), + ], + ]; + pub static ref POSEIDON2_M31_16_PARAMS: Arc> = Arc::new( + Poseidon2Params::new(16, 5, 8, 14, &MAT_DIAG16_M_1, &MAT_INTERNAL16, &RC16) + ); +} +