From 361f9d14abb1e00fd03f5b3214283ffb21442bca Mon Sep 17 00:00:00 2001 From: Ben Hamlin Date: Mon, 12 Feb 2024 23:43:23 +0000 Subject: [PATCH 1/3] Implement a framework for creating Poseidon duplex test vectors and associated types --- .../src/poseidon/duplex/test_vector_tools.rs | 387 ++++++++++++++++++ 1 file changed, 387 insertions(+) create mode 100644 halo2_proofs/src/poseidon/duplex/test_vector_tools.rs diff --git a/halo2_proofs/src/poseidon/duplex/test_vector_tools.rs b/halo2_proofs/src/poseidon/duplex/test_vector_tools.rs new file mode 100644 index 000000000..d2e9bc2b8 --- /dev/null +++ b/halo2_proofs/src/poseidon/duplex/test_vector_tools.rs @@ -0,0 +1,387 @@ +//! This module contains tools for creating and using Poseidon duplex test vectors. It is public to +//! facilitate having an example binary to generate random test vectors. +//! +//! You can print out n random test vectors of each type by calling [`print_random_duplex_test_vectors`]. + +// Module-internal documentation: +// +// Note that every combination of field, width, rate, pattern length, and pattern currently +// requires generating a [`DuplexDomain`] and a `DuplexTestVector` type tailored to these +// parameters. In addition, since the types are different, we can't have a single collection of +// test vectors—they too must be tailored to the parameters. The `make_test_vector_types` macro +// exists to make this a little easier. +// +// Creating test vectors currently looks like this: +// +// ``` +// make_test_vector_types!( +// my_module_name, // A module name of your choosing for the domain +// MyDuplexDomain, // A domain name of your choosing +// F::ZERO, // The domain separator +// 2, // The pattern length +// DuplexPattern::new([DuplexPhase::Absorb(4), DuplexPhase::Squeeze(2)]), +// MyDuplexTestVector, // A test-vector type name of your choosing +// Fp, // The scalar ff::PrimeField to work over +// P128Pow5T3, // The Spec for the duplex +// 3, // The width +// 2, // The rate +// ); +// +// // Note that these are kept in the poseidon::duplex::test_vectors module, which is hidden +// // behind cfg(test), rather than in this module. +// vec![MyDuplexTestVector { +// // Some nice nothing-up-my-sleeve numbers +// inputs: vec![ +// std::array::from_fn::(|i| i as u8), +// [42; 32], +// [1337; 32], +// [9001; 32], +// ], +// // The corresponding outputs (which you'll need to compute) +// outputs: vec![ +// [ +// 175, 248, 184, 82, 107, 9, 37, 41, 50, 52, 166, 173, 27, 90, 174, 195, 171, 24, +// 152, 89, 146, 140, 59, 179, 226, 23, 192, 37, 30, 139, 185, 20, +// ], +// [ +// 22, 61, 32, 106, 62, 192, 20, 22, 178, 59, 33, 143, 139, 64, 226, 49, 106, 43, 197, +// 158, 23, 254, 47, 12, 138, 66, 28, 97, 216, 46, 109, 38, +// ], +// ], +// }]; +// ``` + +use ff::PrimeField; +use rand::Rng; +use rand_core::OsRng; + +use super::{Duplex, DuplexDomain, DuplexPattern, DuplexPhase}; +use crate::poseidon::{Domain, P128Pow5T3, Spec}; +use halo2curves::pasta::{Fp, Fq}; + +/// A Poseidon duplex test-vector type for a specific field, width, rate, spec, and pattern. +pub(crate) trait DuplexTestVector { + /// The scalar field the Poseidon should work over. + type F: PrimeField; + + /// The spec for the Poseidon duplex. + type S: Spec; + + /// The domain for the Poseidon duplex. Note that this fixes the pattern, as well. + type D: DuplexDomain; + + /// Construct a test vector from input and output vectors. + fn from_inputs_outputs( + inputs: impl IntoIterator::Repr>, + outputs: impl IntoIterator::Repr>, + ) -> Self; + + /// Return this test vector's inputs. + fn get_inputs(&self) -> Vec<::Repr>; + + /// Return this test vector's outputs. + fn get_outputs(&self) -> Vec<::Repr>; +} + +pub(crate) fn run_test_vector_internal< + TV, + const WIDTH: usize, + const RATE: usize, + const LEN: usize, +>( + inputs: &[::Repr], +) -> Vec<::Repr> +where + TV: DuplexTestVector, +{ + let mut duplex = Duplex::::init(); + let mut inputs: Vec<_> = inputs.iter().collect(); + let mut results = vec![]; + + for i in 0..LEN { + match TV::D::pattern().phase(i) { + DuplexPhase::Absorb(n) => { + for _ in 0..n { + let &x = inputs.pop().unwrap(); + duplex = duplex.absorb([TV::F::from_repr(x).unwrap()]); + } + } + DuplexPhase::Squeeze(n) => { + for _ in 0..n { + let ([value], new_duplex) = duplex.squeeze::<1>(); + duplex = new_duplex; + results.push(value.to_repr()); + } + } + } + } + + results +} + +/// Generate a random test vector of the given type. +fn random_test_vector( + rng: &mut R, +) -> TV +where + R: Rng, + TV: DuplexTestVector, +{ + let mut inputs: Vec<::Repr> = vec![]; + for i in 0..LEN { + match TV::D::pattern().phase(i) { + DuplexPhase::Absorb(n) => { + for _ in 0..n { + inputs.push(::random(&mut *rng).to_repr()) + } + } + DuplexPhase::Squeeze(_) => (), + } + } + + let outputs = run_test_vector_internal::(&inputs); + + TV::from_inputs_outputs(inputs, outputs) +} + +/// Generate and print out n random test vectors of each type. If you make a new test vector type +/// in this module, add it to this function. +pub fn print_random_duplex_test_vectors(n: usize) { + let mut rng = OsRng; + + println!( + "{:?}", + (0..n) + .map(|_| random_test_vector::<_, DuplexTestVectorFpA1S1, 3, 2, 2>(&mut rng)) + .collect::>() + ); + println!( + "{:?}", + (0..n) + .map(|_| random_test_vector::<_, DuplexTestVectorFpA1S2, 3, 2, 2>(&mut rng)) + .collect::>() + ); + println!( + "{:?}", + (0..n) + .map(|_| random_test_vector::<_, DuplexTestVectorFpA2S1, 3, 2, 2>(&mut rng)) + .collect::>() + ); + println!( + "{:?}", + (0..n) + .map(|_| random_test_vector::<_, DuplexTestVectorFpA2S2, 3, 2, 2>(&mut rng)) + .collect::>() + ); + + println!( + "{:?}", + (0..n) + .map(|_| random_test_vector::<_, DuplexTestVectorFqA1S1, 3, 2, 2>(&mut rng)) + .collect::>() + ); + println!( + "{:?}", + (0..n) + .map(|_| random_test_vector::<_, DuplexTestVectorFqA1S2, 3, 2, 2>(&mut rng)) + .collect::>() + ); + println!( + "{:?}", + (0..n) + .map(|_| random_test_vector::<_, DuplexTestVectorFqA2S1, 3, 2, 2>(&mut rng)) + .collect::>() + ); + println!( + "{:?}", + (0..n) + .map(|_| random_test_vector::<_, DuplexTestVectorFqA2S2, 3, 2, 2>(&mut rng)) + .collect::>() + ); +} + +// Construct a test-vector type and implements `DuplexTestVector` for it. The `$domain_type` must +// be a duplex domain created using `generate_duplex_domain`. +macro_rules! make_test_vector_types { + ( + $domain_type: ident, + $test_vector_type: ident, + $field: ident, + $spec: ident, + $patlen: literal, + $width: literal, + $rate: literal $(,)? + ) => { + #[derive(Debug)] + pub(crate) struct $test_vector_type { + pub inputs: Vec<<$field as ff::PrimeField>::Repr>, + pub outputs: Vec<<$field as ff::PrimeField>::Repr>, + } + + impl DuplexTestVector<$width, $rate, $patlen> for $test_vector_type { + type F = $field; + type S = $spec; + type D = $domain_type<$field, $spec, $width, $rate>; + fn from_inputs_outputs( + inputs: impl IntoIterator::Repr>, + outputs: impl IntoIterator::Repr>, + ) -> Self { + Self { + inputs: inputs.into_iter().collect(), + outputs: outputs.into_iter().collect(), + } + } + fn get_inputs(&self) -> Vec<::Repr> { + self.inputs.iter().cloned().collect() + } + fn get_outputs(&self) -> Vec<::Repr> { + self.outputs.iter().cloned().collect() + } + } + }; +} + +// Run a duplex test vector and assert that the output equals the expected output. +#[cfg(test)] +pub(crate) fn check_duplex_test_vector< + TV, + const WIDTH: usize, + const RATE: usize, + const LEN: usize, +>( + tv: TV, + name: &String, +) where + TV: DuplexTestVector, + <>::F as PrimeField>::Repr: + PartialEq + std::fmt::Debug, +{ + let inputs = tv.get_inputs().into_iter().collect::>(); + let outputs = tv.get_outputs(); + + let results = run_test_vector_internal::(&inputs); + + assert_eq!(results, outputs, "{name}") +} + +// The following are test vector duplex-domain types. The naming scheme is as follows: +// +// `TestVectorDomainAnSm`: This refers to a domain with two phases, an `Absorb(n)` followed by a +// `Squeeze(m)`. A four-phase domain would look like `TestVectorDomainAnSmApSq`, etc. + +generate_duplex_domain!( + test_vector_domain_a1_s1, + TestVectorDomainA1S1, + F::ZERO, + 2, + DuplexPattern::new([DuplexPhase::Absorb(1), DuplexPhase::Squeeze(1)]) +); + +generate_duplex_domain!( + test_vector_domain_a1_s2, + TestVectorDomainA1S2, + F::ZERO, + 2, + DuplexPattern::new([DuplexPhase::Absorb(1), DuplexPhase::Squeeze(2)]) +); + +generate_duplex_domain!( + test_vector_domain_a2_s1, + TestVectorDomainA2S1, + F::ZERO, + 2, + DuplexPattern::new([DuplexPhase::Absorb(2), DuplexPhase::Squeeze(1)]) +); + +generate_duplex_domain!( + test_vector_domain_a2_s2, + TestVectorDomainA2S2, + F::ZERO, + 2, + DuplexPattern::new([DuplexPhase::Absorb(2), DuplexPhase::Squeeze(2)]) +); + +// The following are test vector types. The naming scheme is as follows: +// +// `DuplexTestVectorSomeFieldAnSm`: This refers to a test-vector type with inputs and outputs in +// the scalar field `SomeField` and two phases---an `Absorb(n)` followed by a `Squeeze(m)`. + +make_test_vector_types!( + TestVectorDomainA1S1, + DuplexTestVectorFpA1S1, + Fp, + P128Pow5T3, + 2, + 3, + 2, +); + +make_test_vector_types!( + TestVectorDomainA1S2, + DuplexTestVectorFpA1S2, + Fp, + P128Pow5T3, + 2, + 3, + 2, +); + +make_test_vector_types!( + TestVectorDomainA2S1, + DuplexTestVectorFpA2S1, + Fp, + P128Pow5T3, + 2, + 3, + 2, +); + +make_test_vector_types!( + TestVectorDomainA2S2, + DuplexTestVectorFpA2S2, + Fp, + P128Pow5T3, + 2, + 3, + 2, +); + +make_test_vector_types!( + TestVectorDomainA1S1, + DuplexTestVectorFqA1S1, + Fq, + P128Pow5T3, + 2, + 3, + 2, +); + +make_test_vector_types!( + TestVectorDomainA1S2, + DuplexTestVectorFqA1S2, + Fq, + P128Pow5T3, + 2, + 3, + 2, +); + +make_test_vector_types!( + TestVectorDomainA2S1, + DuplexTestVectorFqA2S1, + Fq, + P128Pow5T3, + 2, + 3, + 2, +); + +make_test_vector_types!( + TestVectorDomainA2S2, + DuplexTestVectorFqA2S2, + Fq, + P128Pow5T3, + 2, + 3, + 2, +); From b69e6f40f2216a6c2a05f3d26a3b79d6030fa8b2 Mon Sep 17 00:00:00 2001 From: Ben Hamlin Date: Mon, 12 Feb 2024 23:44:50 +0000 Subject: [PATCH 2/3] Runnable example for generating random Poseidon duplex test vectors --- halo2_proofs/Cargo.toml | 3 +++ halo2_proofs/examples/random-duplex-test-vectors.rs | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 halo2_proofs/examples/random-duplex-test-vectors.rs diff --git a/halo2_proofs/Cargo.toml b/halo2_proofs/Cargo.toml index 1de3018be..ccb56c0dd 100644 --- a/halo2_proofs/Cargo.toml +++ b/halo2_proofs/Cargo.toml @@ -106,3 +106,6 @@ required-features = ["dev-graph"] [[example]] name = "emit-duplex-pattern" + +[[example]] +name = "random-duplex-test-vectors" diff --git a/halo2_proofs/examples/random-duplex-test-vectors.rs b/halo2_proofs/examples/random-duplex-test-vectors.rs new file mode 100644 index 000000000..e523943e3 --- /dev/null +++ b/halo2_proofs/examples/random-duplex-test-vectors.rs @@ -0,0 +1,5 @@ +use halo2_proofs::poseidon::duplex::test_vector_tools::print_random_duplex_test_vectors; + +fn main() { + print_random_duplex_test_vectors(5); +} From adbc67bf09c0f93818f554af3e14d67bc8d017e2 Mon Sep 17 00:00:00 2001 From: Ben Hamlin Date: Mon, 12 Feb 2024 23:45:34 +0000 Subject: [PATCH 3/3] Add random test vectors and associated tests to Poseidon duplex --- halo2_proofs/src/poseidon/duplex.rs | 51 ++ .../src/poseidon/duplex/test_vectors.rs | 768 ++++++++++++++++++ 2 files changed, 819 insertions(+) create mode 100644 halo2_proofs/src/poseidon/duplex/test_vectors.rs diff --git a/halo2_proofs/src/poseidon/duplex.rs b/halo2_proofs/src/poseidon/duplex.rs index 7701a6976..39de81b26 100644 --- a/halo2_proofs/src/poseidon/duplex.rs +++ b/halo2_proofs/src/poseidon/duplex.rs @@ -709,3 +709,54 @@ mod test_complex_pattern { duplex.finish(); } } + +pub mod test_vector_tools; + +#[cfg(test)] +mod test_vectors; + +#[cfg(test)] +mod check_test_vectors { + use super::test_vector_tools::check_duplex_test_vector; + use super::test_vectors; + + #[test] + fn check_fp_test_vectors() { + test_vectors::fp_a1_s1() + .into_iter() + .enumerate() + .for_each(|(i, tv)| check_duplex_test_vector(tv, &format!("fp_a1_s1[{i}]"))); + test_vectors::fp_a1_s2() + .into_iter() + .enumerate() + .for_each(|(i, tv)| check_duplex_test_vector(tv, &format!("fp_a1_s2[{i}]"))); + test_vectors::fp_a2_s1() + .into_iter() + .enumerate() + .for_each(|(i, tv)| check_duplex_test_vector(tv, &format!("fp_a2_s1[{i}]"))); + test_vectors::fp_a2_s2() + .into_iter() + .enumerate() + .for_each(|(i, tv)| check_duplex_test_vector(tv, &format!("fp_a2_s2[{i}]"))); + } + + #[test] + fn check_fq_test_vectors() { + test_vectors::fq_a1_s1() + .into_iter() + .enumerate() + .for_each(|(i, tv)| check_duplex_test_vector(tv, &format!("fq_a1_s1[{i}]"))); + test_vectors::fq_a1_s2() + .into_iter() + .enumerate() + .for_each(|(i, tv)| check_duplex_test_vector(tv, &format!("fq_a1_s2[{i}]"))); + test_vectors::fq_a2_s1() + .into_iter() + .enumerate() + .for_each(|(i, tv)| check_duplex_test_vector(tv, &format!("fq_a2_s1[{i}]"))); + test_vectors::fq_a2_s2() + .into_iter() + .enumerate() + .for_each(|(i, tv)| check_duplex_test_vector(tv, &format!("fq_a2_s2[{i}]"))); + } +} diff --git a/halo2_proofs/src/poseidon/duplex/test_vectors.rs b/halo2_proofs/src/poseidon/duplex/test_vectors.rs new file mode 100644 index 000000000..c367f288a --- /dev/null +++ b/halo2_proofs/src/poseidon/duplex/test_vectors.rs @@ -0,0 +1,768 @@ +//! This module contains test vectors for the Poseidon duplex and functions for using them. + +use crate::poseidon::duplex::test_vector_tools::{ + run_test_vector_internal, DuplexTestVector, DuplexTestVectorFpA1S1, DuplexTestVectorFpA1S2, + DuplexTestVectorFpA2S1, DuplexTestVectorFpA2S2, DuplexTestVectorFqA1S1, DuplexTestVectorFqA1S2, + DuplexTestVectorFqA2S1, DuplexTestVectorFqA2S2, +}; +use ff::PrimeField; + +pub(crate) fn fp_a1_s1() -> Vec { + vec![ + DuplexTestVectorFpA1S1 { + inputs: vec![[0; 32]], + outputs: vec![[ + 170, 155, 207, 24, 88, 50, 197, 53, 120, 149, 217, 207, 128, 52, 130, 29, 230, 123, + 145, 33, 79, 235, 144, 13, 76, 9, 203, 53, 71, 148, 153, 55, + ]], + }, + DuplexTestVectorFpA1S1 { + inputs: vec![[ + 53, 147, 49, 31, 220, 249, 149, 42, 52, 249, 74, 209, 167, 37, 133, 102, 121, 30, + 62, 216, 248, 44, 247, 228, 211, 166, 94, 66, 180, 251, 174, 6, + ]], + outputs: vec![[ + 87, 157, 245, 169, 79, 191, 190, 114, 224, 98, 181, 164, 185, 137, 227, 122, 22, + 96, 161, 167, 22, 89, 144, 218, 65, 116, 157, 209, 48, 88, 117, 52, + ]], + }, + DuplexTestVectorFpA1S1 { + inputs: vec![[ + 78, 34, 139, 36, 143, 11, 248, 171, 120, 19, 114, 79, 220, 129, 133, 193, 118, 72, + 20, 145, 83, 202, 116, 254, 73, 40, 198, 195, 74, 199, 181, 46, + ]], + outputs: vec![[ + 30, 237, 17, 63, 201, 42, 4, 111, 81, 161, 227, 52, 208, 178, 124, 96, 150, 183, + 139, 218, 222, 117, 50, 211, 118, 67, 127, 175, 156, 136, 156, 26, + ]], + }, + DuplexTestVectorFpA1S1 { + inputs: vec![[ + 154, 238, 25, 180, 42, 27, 203, 97, 156, 32, 235, 1, 106, 118, 222, 182, 139, 237, + 117, 134, 82, 167, 54, 193, 112, 199, 139, 202, 120, 161, 4, 48, + ]], + outputs: vec![[ + 237, 116, 211, 203, 7, 26, 158, 9, 89, 241, 218, 39, 221, 21, 7, 46, 42, 71, 207, + 117, 11, 0, 165, 37, 175, 206, 255, 26, 93, 116, 102, 32, + ]], + }, + DuplexTestVectorFpA1S1 { + inputs: vec![[ + 198, 197, 48, 24, 45, 155, 205, 240, 239, 254, 245, 201, 34, 122, 2, 141, 173, 30, + 184, 152, 146, 111, 168, 97, 192, 196, 145, 127, 123, 170, 96, 31, + ]], + outputs: vec![[ + 106, 210, 195, 147, 71, 98, 121, 234, 229, 106, 207, 56, 129, 197, 44, 228, 13, 63, + 232, 90, 198, 2, 170, 158, 211, 101, 170, 148, 229, 19, 162, 41, + ]], + }, + DuplexTestVectorFpA1S1 { + inputs: vec![[ + 242, 68, 234, 11, 22, 234, 200, 60, 238, 48, 145, 229, 116, 188, 50, 65, 110, 83, + 168, 166, 201, 57, 42, 34, 224, 93, 171, 224, 218, 82, 3, 29, + ]], + outputs: vec![[ + 130, 143, 159, 194, 135, 52, 163, 56, 161, 234, 111, 81, 26, 57, 244, 171, 246, + 209, 67, 133, 19, 33, 147, 128, 180, 244, 113, 126, 26, 105, 98, 37, + ]], + }, + ] +} + +pub(crate) fn fp_a1_s2() -> Vec { + vec![ + DuplexTestVectorFpA1S2 { + inputs: vec![[0; 32]], + outputs: vec![ + [ + 175, 248, 184, 82, 107, 9, 37, 41, 50, 52, 166, 173, 27, 90, 174, 195, 171, 24, + 152, 89, 146, 140, 59, 179, 226, 23, 192, 37, 30, 139, 185, 20, + ], + [ + 22, 61, 32, 106, 62, 192, 20, 22, 178, 59, 33, 143, 139, 64, 226, 49, 106, 43, + 197, 158, 23, 254, 47, 12, 138, 66, 28, 97, 216, 46, 109, 38, + ], + ], + }, + DuplexTestVectorFpA1S2 { + inputs: vec![[ + 190, 145, 231, 142, 50, 114, 3, 116, 119, 103, 187, 169, 123, 8, 179, 48, 217, 17, + 115, 90, 182, 166, 28, 110, 166, 177, 170, 75, 107, 184, 238, 30, + ]], + outputs: vec![ + [ + 166, 158, 43, 67, 169, 25, 201, 87, 200, 18, 232, 203, 183, 239, 22, 122, 224, + 150, 243, 220, 142, 76, 244, 184, 22, 93, 104, 102, 135, 84, 38, 43, + ], + [ + 240, 32, 160, 38, 15, 8, 168, 162, 94, 54, 220, 59, 80, 252, 51, 43, 25, 98, + 173, 45, 101, 184, 62, 218, 125, 28, 209, 195, 226, 20, 1, 62, + ], + ], + }, + DuplexTestVectorFpA1S2 { + inputs: vec![[ + 169, 137, 221, 135, 149, 203, 46, 187, 80, 101, 89, 22, 49, 77, 122, 214, 122, 247, + 3, 255, 62, 237, 49, 215, 194, 138, 221, 232, 195, 44, 225, 37, + ]], + outputs: vec![ + [ + 220, 80, 163, 75, 92, 29, 32, 236, 70, 233, 68, 224, 233, 212, 109, 105, 244, + 57, 185, 136, 206, 148, 127, 223, 178, 109, 182, 130, 240, 15, 178, 62, + ], + [ + 237, 145, 194, 97, 161, 47, 144, 246, 151, 65, 30, 204, 233, 108, 22, 200, 138, + 50, 121, 59, 35, 57, 75, 131, 223, 49, 174, 46, 48, 79, 57, 11, + ], + ], + }, + DuplexTestVectorFpA1S2 { + inputs: vec![[ + 203, 113, 70, 116, 219, 164, 172, 70, 212, 191, 95, 143, 91, 10, 216, 186, 147, + 221, 164, 138, 212, 89, 73, 149, 135, 249, 40, 191, 197, 197, 71, 53, + ]], + outputs: vec![ + [ + 155, 62, 137, 165, 232, 224, 226, 181, 3, 187, 130, 98, 217, 28, 158, 161, 149, + 169, 58, 151, 12, 4, 184, 105, 138, 113, 113, 81, 20, 85, 147, 15, + ], + [ + 13, 242, 146, 57, 13, 115, 25, 154, 183, 52, 176, 24, 203, 17, 209, 14, 59, + 101, 28, 172, 125, 139, 214, 45, 186, 49, 101, 164, 71, 2, 199, 15, + ], + ], + }, + DuplexTestVectorFpA1S2 { + inputs: vec![[ + 34, 157, 12, 174, 183, 65, 19, 2, 96, 94, 184, 136, 144, 246, 251, 91, 65, 91, 42, + 186, 240, 189, 113, 130, 13, 87, 163, 169, 128, 47, 161, 59, + ]], + outputs: vec![ + [ + 152, 129, 111, 255, 6, 25, 133, 77, 12, 12, 121, 99, 240, 90, 114, 212, 31, + 211, 179, 61, 50, 31, 169, 19, 51, 210, 109, 14, 7, 80, 191, 35, + ], + [ + 181, 170, 57, 42, 69, 101, 204, 46, 75, 43, 5, 81, 103, 101, 50, 45, 232, 241, + 182, 205, 108, 131, 202, 187, 190, 202, 121, 61, 155, 206, 108, 23, + ], + ], + }, + DuplexTestVectorFpA1S2 { + inputs: vec![[ + 199, 253, 32, 114, 151, 246, 50, 35, 107, 246, 21, 22, 151, 240, 118, 226, 112, + 210, 229, 125, 134, 2, 80, 16, 142, 116, 27, 26, 179, 100, 185, 13, + ]], + outputs: vec![ + [ + 31, 20, 106, 8, 207, 85, 61, 42, 84, 9, 126, 157, 52, 70, 227, 0, 5, 49, 254, + 126, 222, 131, 141, 195, 233, 240, 230, 154, 245, 79, 185, 29, + ], + [ + 187, 175, 105, 0, 74, 57, 81, 238, 239, 39, 176, 197, 230, 114, 41, 1, 208, 74, + 179, 47, 170, 49, 226, 168, 214, 246, 141, 133, 88, 10, 199, 41, + ], + ], + }, + ] +} + +pub(crate) fn fp_a2_s1() -> Vec { + vec![ + DuplexTestVectorFpA2S1 { + inputs: vec![[0; 32], [0; 32]], + outputs: vec![[ + 34, 93, 110, 106, 99, 245, 133, 160, 49, 37, 103, 149, 232, 222, 24, 108, 215, 149, + 61, 176, 146, 194, 75, 57, 72, 177, 185, 126, 127, 217, 111, 32, + ]], + }, + DuplexTestVectorFpA2S1 { + inputs: vec![ + [ + 174, 151, 245, 106, 15, 23, 12, 230, 36, 244, 22, 199, 163, 16, 249, 192, 16, + 119, 69, 73, 53, 249, 199, 3, 54, 150, 142, 90, 57, 188, 210, 57, + ], + [ + 72, 163, 236, 141, 0, 126, 202, 150, 217, 158, 128, 146, 241, 188, 58, 76, 23, + 113, 135, 131, 220, 178, 11, 43, 122, 84, 66, 33, 110, 66, 93, 28, + ], + ], + outputs: vec![[ + 184, 220, 43, 144, 236, 252, 216, 125, 164, 13, 132, 7, 77, 73, 153, 192, 21, 153, + 115, 152, 55, 9, 221, 18, 207, 8, 123, 111, 12, 162, 130, 18, + ]], + }, + DuplexTestVectorFpA2S1 { + inputs: vec![ + [ + 239, 64, 118, 31, 54, 93, 50, 130, 233, 0, 58, 249, 85, 210, 109, 40, 70, 124, + 211, 110, 36, 252, 99, 100, 214, 127, 156, 199, 42, 154, 3, 19, + ], + [ + 66, 219, 103, 105, 143, 93, 87, 66, 185, 183, 11, 195, 108, 108, 117, 99, 156, + 15, 182, 6, 64, 133, 149, 211, 15, 237, 80, 149, 165, 117, 213, 27, + ], + ], + outputs: vec![[ + 30, 206, 22, 1, 1, 63, 68, 192, 7, 178, 113, 70, 59, 106, 125, 247, 58, 128, 186, + 244, 118, 111, 35, 103, 246, 29, 236, 32, 207, 246, 163, 1, + ]], + }, + DuplexTestVectorFpA2S1 { + inputs: vec![ + [ + 72, 98, 61, 225, 61, 232, 7, 33, 167, 232, 114, 56, 222, 0, 156, 237, 29, 132, + 206, 152, 62, 10, 77, 169, 161, 134, 193, 214, 90, 11, 107, 51, + ], + [ + 69, 125, 95, 192, 238, 161, 143, 128, 170, 25, 4, 22, 76, 54, 214, 151, 114, + 214, 122, 79, 194, 102, 63, 9, 178, 76, 183, 95, 138, 164, 130, 6, + ], + ], + outputs: vec![[ + 157, 133, 131, 153, 115, 68, 33, 152, 15, 222, 32, 83, 97, 244, 230, 10, 130, 191, + 181, 121, 121, 27, 212, 119, 212, 187, 107, 74, 103, 28, 74, 5, + ]], + }, + DuplexTestVectorFpA2S1 { + inputs: vec![ + [ + 66, 39, 159, 198, 251, 27, 151, 246, 185, 139, 137, 104, 124, 242, 115, 131, + 87, 149, 152, 161, 184, 197, 40, 43, 50, 174, 203, 93, 208, 85, 254, 2, + ], + [ + 11, 119, 48, 204, 112, 183, 211, 154, 129, 245, 209, 115, 26, 162, 71, 31, 125, + 168, 149, 212, 87, 212, 175, 34, 108, 31, 178, 99, 61, 77, 239, 41, + ], + ], + outputs: vec![[ + 97, 117, 161, 59, 186, 224, 175, 252, 25, 60, 208, 100, 115, 175, 117, 120, 74, + 150, 75, 183, 51, 32, 53, 244, 76, 93, 193, 72, 98, 60, 95, 50, + ]], + }, + DuplexTestVectorFpA2S1 { + inputs: vec![ + [ + 196, 220, 199, 134, 148, 153, 34, 58, 81, 122, 221, 75, 30, 127, 65, 117, 71, + 25, 81, 85, 214, 143, 32, 4, 243, 144, 11, 201, 215, 101, 98, 52, + ], + [ + 206, 98, 59, 168, 195, 35, 217, 24, 113, 145, 52, 127, 200, 13, 197, 146, 214, + 9, 20, 140, 105, 46, 106, 138, 226, 114, 12, 206, 88, 80, 226, 52, + ], + ], + outputs: vec![[ + 124, 44, 35, 254, 34, 145, 158, 209, 228, 141, 33, 225, 8, 103, 179, 206, 202, 185, + 159, 169, 177, 113, 94, 36, 13, 225, 84, 12, 196, 15, 254, 23, + ]], + }, + ] +} + +pub(crate) fn fp_a2_s2() -> Vec { + vec![ + DuplexTestVectorFpA2S2 { + inputs: vec![[0; 32], [0; 32]], + outputs: vec![ + [ + 154, 74, 110, 220, 204, 104, 165, 180, 176, 188, 224, 40, 50, 86, 189, 108, 50, + 233, 64, 253, 97, 142, 114, 59, 29, 106, 214, 217, 40, 204, 105, 30, + ], + [ + 12, 166, 22, 90, 58, 241, 227, 73, 11, 215, 54, 14, 10, 34, 201, 187, 34, 85, + 160, 186, 218, 129, 155, 199, 64, 18, 162, 106, 85, 107, 229, 52, + ], + ], + }, + DuplexTestVectorFpA2S2 { + inputs: vec![ + [ + 108, 129, 247, 198, 146, 98, 170, 180, 188, 180, 240, 189, 231, 33, 89, 152, + 240, 30, 190, 182, 61, 20, 105, 28, 53, 27, 1, 126, 83, 221, 161, 2, + ], + [ + 41, 13, 101, 153, 95, 23, 182, 119, 100, 64, 104, 62, 94, 225, 199, 252, 8, 54, + 81, 147, 135, 235, 99, 6, 184, 157, 48, 25, 198, 134, 162, 55, + ], + ], + outputs: vec![ + [ + 191, 246, 49, 49, 2, 171, 180, 249, 151, 223, 43, 117, 156, 6, 196, 195, 106, + 146, 93, 68, 254, 150, 40, 58, 208, 185, 58, 206, 152, 84, 49, 26, + ], + [ + 110, 23, 157, 126, 50, 172, 76, 4, 154, 179, 160, 49, 141, 252, 97, 137, 10, + 82, 26, 100, 79, 183, 156, 154, 50, 227, 150, 25, 169, 50, 98, 50, + ], + ], + }, + DuplexTestVectorFpA2S2 { + inputs: vec![ + [ + 200, 218, 199, 36, 173, 137, 21, 114, 51, 138, 8, 227, 98, 95, 194, 2, 119, + 100, 122, 244, 247, 160, 85, 88, 6, 234, 112, 219, 204, 245, 7, 23, + ], + [ + 30, 97, 152, 127, 215, 126, 32, 23, 85, 82, 236, 255, 136, 12, 172, 226, 214, + 13, 163, 244, 239, 93, 28, 4, 72, 250, 215, 170, 180, 114, 213, 16, + ], + ], + outputs: vec![ + [ + 188, 252, 193, 232, 0, 18, 162, 190, 30, 108, 71, 55, 24, 136, 143, 10, 31, + 146, 73, 36, 3, 52, 97, 216, 216, 39, 208, 25, 185, 36, 83, 28, + ], + [ + 133, 72, 189, 96, 105, 91, 120, 163, 137, 135, 219, 112, 207, 77, 84, 167, 197, + 78, 95, 165, 228, 228, 97, 116, 130, 154, 143, 106, 172, 83, 185, 42, + ], + ], + }, + DuplexTestVectorFpA2S2 { + inputs: vec![ + [ + 115, 234, 221, 223, 50, 214, 172, 88, 243, 1, 214, 210, 120, 183, 106, 3, 133, + 73, 128, 26, 30, 245, 70, 150, 237, 83, 219, 68, 155, 114, 16, 55, + ], + [ + 4, 183, 8, 199, 55, 123, 249, 220, 234, 47, 19, 99, 238, 48, 39, 119, 194, 4, + 133, 51, 4, 4, 225, 111, 121, 71, 108, 134, 30, 75, 53, 4, + ], + ], + outputs: vec![ + [ + 8, 88, 47, 171, 39, 176, 160, 186, 236, 255, 247, 150, 85, 209, 226, 48, 96, 4, + 159, 94, 69, 255, 245, 184, 18, 171, 114, 90, 9, 82, 230, 38, + ], + [ + 209, 124, 33, 184, 172, 230, 208, 37, 4, 96, 196, 137, 137, 35, 221, 120, 58, + 57, 158, 239, 94, 188, 110, 129, 86, 247, 157, 158, 178, 20, 77, 34, + ], + ], + }, + DuplexTestVectorFpA2S2 { + inputs: vec![ + [ + 159, 157, 245, 60, 33, 187, 24, 27, 137, 15, 184, 4, 125, 231, 10, 59, 123, + 230, 133, 181, 17, 168, 63, 247, 20, 57, 214, 9, 96, 33, 88, 54, + ], + [ + 167, 46, 2, 58, 243, 199, 112, 246, 212, 134, 221, 254, 62, 112, 13, 236, 241, + 0, 40, 205, 31, 254, 220, 198, 108, 5, 14, 182, 149, 186, 234, 21, + ], + ], + outputs: vec![ + [ + 66, 186, 86, 109, 70, 219, 70, 224, 240, 103, 208, 107, 246, 17, 32, 157, 232, + 65, 180, 189, 59, 84, 94, 69, 127, 123, 249, 156, 84, 47, 14, 58, + ], + [ + 239, 46, 116, 116, 166, 188, 127, 224, 63, 174, 197, 175, 153, 90, 60, 91, 119, + 234, 72, 86, 252, 35, 40, 132, 93, 80, 182, 118, 176, 226, 255, 41, + ], + ], + }, + DuplexTestVectorFpA2S2 { + inputs: vec![ + [ + 48, 186, 166, 67, 157, 120, 203, 88, 49, 64, 56, 219, 137, 138, 122, 18, 204, + 189, 128, 29, 78, 6, 200, 194, 186, 145, 124, 55, 30, 223, 159, 48, + ], + [ + 171, 31, 7, 48, 179, 203, 224, 235, 57, 201, 64, 125, 5, 191, 170, 205, 194, + 103, 245, 226, 140, 102, 13, 121, 240, 223, 5, 167, 202, 241, 38, 48, + ], + ], + outputs: vec![ + [ + 69, 11, 40, 65, 222, 109, 146, 83, 104, 35, 251, 158, 87, 255, 134, 225, 144, + 250, 133, 245, 183, 53, 241, 167, 52, 58, 107, 131, 5, 219, 28, 38, + ], + [ + 190, 192, 180, 254, 95, 24, 238, 89, 92, 148, 121, 156, 34, 51, 190, 162, 102, + 4, 240, 3, 216, 250, 246, 216, 230, 69, 44, 78, 64, 141, 46, 14, + ], + ], + }, + ] +} + +pub(crate) fn fq_a1_s1() -> Vec { + vec![ + DuplexTestVectorFqA1S1 { + inputs: vec![[0; 32]], + outputs: vec![[ + 96, 99, 241, 120, 48, 175, 193, 35, 39, 239, 200, 205, 1, 102, 249, 225, 94, 227, + 233, 152, 57, 188, 133, 247, 223, 249, 243, 11, 63, 139, 163, 45, + ]], + }, + DuplexTestVectorFqA1S1 { + inputs: vec![[ + 178, 247, 201, 137, 39, 65, 112, 167, 74, 244, 98, 92, 241, 115, 224, 120, 18, 71, + 77, 1, 221, 151, 83, 39, 199, 201, 37, 21, 54, 69, 189, 9, + ]], + outputs: vec![[ + 238, 46, 163, 197, 246, 241, 82, 81, 254, 132, 191, 233, 30, 173, 255, 88, 97, 147, + 217, 33, 113, 198, 210, 109, 253, 247, 209, 190, 211, 206, 241, 19, + ]], + }, + DuplexTestVectorFqA1S1 { + inputs: vec![[ + 233, 146, 209, 217, 205, 197, 76, 115, 92, 131, 120, 140, 206, 233, 137, 176, 127, + 70, 175, 225, 6, 107, 119, 11, 10, 76, 4, 207, 60, 12, 78, 47, + ]], + outputs: vec![[ + 3, 251, 26, 79, 22, 34, 124, 164, 79, 6, 224, 219, 80, 77, 243, 125, 181, 107, 79, + 174, 237, 1, 139, 88, 208, 252, 70, 179, 15, 152, 23, 10, + ]], + }, + DuplexTestVectorFqA1S1 { + inputs: vec![[ + 85, 191, 149, 57, 157, 68, 22, 59, 73, 184, 191, 89, 117, 242, 221, 60, 255, 169, + 29, 239, 245, 42, 18, 15, 13, 217, 114, 177, 5, 165, 141, 58, + ]], + outputs: vec![[ + 109, 212, 241, 12, 97, 228, 231, 218, 179, 117, 250, 206, 248, 124, 72, 73, 145, + 72, 209, 52, 79, 211, 240, 105, 16, 191, 66, 181, 44, 216, 218, 27, + ]], + }, + DuplexTestVectorFqA1S1 { + inputs: vec![[ + 245, 249, 195, 126, 34, 47, 25, 130, 202, 16, 166, 28, 139, 174, 90, 163, 25, 51, + 138, 223, 42, 194, 84, 145, 106, 37, 110, 199, 115, 62, 163, 59, + ]], + outputs: vec![[ + 0, 226, 8, 254, 186, 194, 23, 142, 188, 0, 28, 103, 27, 69, 230, 137, 118, 1, 179, + 65, 101, 56, 252, 89, 61, 7, 249, 216, 114, 21, 156, 35, + ]], + }, + DuplexTestVectorFqA1S1 { + inputs: vec![[ + 167, 16, 9, 243, 133, 91, 52, 190, 135, 41, 171, 78, 138, 240, 136, 130, 218, 230, + 1, 107, 94, 87, 206, 163, 143, 159, 225, 55, 111, 125, 128, 19, + ]], + outputs: vec![[ + 28, 140, 171, 169, 104, 22, 56, 160, 77, 86, 204, 184, 224, 228, 10, 221, 143, 114, + 62, 145, 126, 209, 154, 198, 221, 224, 192, 212, 212, 218, 231, 21, + ]], + }, + ] +} + +pub(crate) fn fq_a1_s2() -> Vec { + vec![ + DuplexTestVectorFqA1S2 { + inputs: vec![[0; 32]], + outputs: vec![ + [ + 226, 84, 247, 215, 65, 206, 7, 60, 89, 223, 37, 253, 69, 219, 2, 97, 105, 118, + 137, 152, 143, 57, 155, 254, 110, 67, 22, 150, 120, 87, 57, 17, + ], + [ + 161, 127, 207, 40, 199, 234, 83, 238, 156, 34, 1, 86, 147, 125, 123, 97, 98, + 147, 201, 24, 120, 130, 191, 33, 32, 49, 48, 225, 79, 65, 203, 3, + ], + ], + }, + DuplexTestVectorFqA1S2 { + inputs: vec![[ + 151, 38, 130, 93, 239, 92, 233, 27, 208, 8, 90, 114, 107, 190, 133, 89, 189, 65, + 148, 74, 222, 97, 28, 114, 132, 77, 105, 80, 111, 125, 247, 50, + ]], + outputs: vec![ + [ + 40, 177, 214, 94, 161, 154, 144, 46, 91, 1, 113, 143, 145, 241, 216, 219, 84, + 185, 74, 219, 231, 97, 165, 224, 129, 222, 246, 31, 54, 227, 186, 9, + ], + [ + 30, 187, 210, 139, 78, 54, 42, 33, 129, 166, 80, 195, 145, 201, 190, 100, 121, + 115, 163, 15, 100, 230, 59, 248, 39, 185, 177, 140, 47, 196, 197, 3, + ], + ], + }, + DuplexTestVectorFqA1S2 { + inputs: vec![[ + 170, 36, 136, 35, 224, 7, 205, 101, 212, 247, 250, 226, 215, 47, 71, 53, 55, 237, + 218, 108, 188, 137, 219, 236, 31, 228, 199, 124, 109, 152, 206, 1, + ]], + outputs: vec![ + [ + 96, 47, 7, 47, 46, 83, 223, 18, 84, 67, 84, 204, 23, 77, 153, 71, 235, 7, 29, + 128, 183, 96, 182, 62, 25, 97, 145, 158, 44, 45, 60, 50, + ], + [ + 224, 197, 85, 104, 13, 252, 212, 40, 36, 6, 29, 229, 183, 137, 250, 113, 19, + 219, 205, 239, 146, 211, 115, 183, 59, 81, 150, 3, 208, 64, 95, 24, + ], + ], + }, + DuplexTestVectorFqA1S2 { + inputs: vec![[ + 164, 87, 213, 127, 147, 150, 102, 243, 227, 150, 110, 139, 214, 40, 33, 99, 80, + 169, 141, 189, 93, 143, 47, 240, 253, 239, 113, 228, 227, 199, 177, 30, + ]], + outputs: vec![ + [ + 18, 237, 144, 193, 159, 155, 165, 200, 190, 247, 226, 105, 115, 118, 146, 2, + 53, 24, 90, 158, 105, 233, 103, 194, 100, 1, 97, 67, 231, 108, 122, 22, + ], + [ + 96, 11, 249, 93, 180, 15, 198, 249, 76, 188, 171, 164, 46, 39, 31, 125, 128, + 110, 161, 227, 191, 174, 17, 33, 205, 142, 65, 150, 151, 165, 122, 33, + ], + ], + }, + DuplexTestVectorFqA1S2 { + inputs: vec![[ + 204, 160, 212, 132, 190, 222, 157, 193, 210, 90, 240, 111, 110, 63, 128, 149, 148, + 60, 159, 117, 133, 146, 161, 251, 176, 234, 204, 30, 133, 233, 118, 7, + ]], + outputs: vec![ + [ + 4, 133, 53, 7, 220, 50, 8, 150, 232, 189, 105, 134, 155, 7, 53, 64, 31, 174, + 168, 75, 113, 50, 182, 66, 134, 218, 78, 71, 188, 106, 74, 59, + ], + [ + 22, 28, 123, 150, 234, 54, 221, 200, 125, 10, 177, 238, 95, 215, 116, 197, 52, + 230, 241, 168, 162, 193, 158, 65, 210, 118, 98, 230, 63, 122, 18, 19, + ], + ], + }, + DuplexTestVectorFqA1S2 { + inputs: vec![[ + 208, 118, 135, 87, 115, 76, 212, 20, 74, 128, 192, 65, 33, 255, 75, 243, 203, 96, + 51, 252, 234, 143, 219, 169, 126, 188, 66, 194, 135, 9, 177, 50, + ]], + outputs: vec![ + [ + 100, 243, 171, 149, 179, 217, 54, 52, 43, 214, 152, 158, 169, 129, 53, 225, + 221, 161, 248, 91, 143, 25, 26, 172, 104, 191, 194, 245, 35, 109, 199, 39, + ], + [ + 1, 16, 178, 186, 36, 173, 111, 106, 212, 146, 69, 59, 163, 19, 167, 66, 50, + 113, 12, 137, 44, 190, 124, 78, 28, 224, 137, 86, 195, 220, 140, 33, + ], + ], + }, + ] +} + +pub(crate) fn fq_a2_s1() -> Vec { + vec![ + DuplexTestVectorFqA2S1 { + inputs: vec![[0; 32], [0; 32]], + outputs: vec![[ + 143, 122, 74, 96, 99, 135, 80, 235, 5, 10, 74, 156, 87, 125, 53, 5, 209, 187, 117, + 100, 164, 142, 165, 198, 216, 109, 4, 175, 57, 136, 154, 33, + ]], + }, + DuplexTestVectorFqA2S1 { + inputs: vec![ + [ + 192, 118, 47, 58, 170, 141, 132, 163, 174, 171, 163, 255, 18, 22, 188, 46, 41, + 166, 83, 165, 217, 246, 19, 127, 156, 81, 246, 125, 28, 129, 81, 63, + ], + [ + 105, 223, 34, 139, 69, 12, 218, 228, 158, 72, 254, 132, 134, 5, 193, 95, 33, + 49, 126, 249, 108, 7, 106, 159, 196, 216, 124, 178, 111, 13, 127, 15, + ], + ], + outputs: vec![[ + 127, 111, 140, 247, 97, 247, 59, 8, 165, 247, 11, 158, 84, 224, 219, 150, 212, 112, + 15, 201, 246, 129, 221, 101, 106, 67, 219, 22, 224, 231, 172, 28, + ]], + }, + DuplexTestVectorFqA2S1 { + inputs: vec![ + [ + 27, 114, 5, 35, 47, 64, 78, 52, 61, 127, 168, 203, 202, 61, 92, 210, 226, 206, + 243, 243, 78, 115, 119, 206, 213, 188, 2, 63, 137, 243, 148, 21, + ], + [ + 1, 123, 43, 95, 48, 151, 225, 98, 253, 80, 59, 50, 134, 36, 82, 165, 237, 53, + 208, 175, 61, 243, 20, 168, 225, 83, 225, 30, 179, 165, 11, 14, + ], + ], + outputs: vec![[ + 148, 180, 164, 138, 206, 51, 155, 216, 87, 253, 204, 255, 207, 81, 105, 123, 30, + 94, 61, 162, 239, 21, 254, 12, 54, 166, 172, 65, 111, 3, 154, 63, + ]], + }, + DuplexTestVectorFqA2S1 { + inputs: vec![ + [ + 212, 175, 87, 50, 34, 177, 213, 135, 35, 152, 122, 105, 42, 92, 23, 146, 99, + 137, 22, 93, 70, 252, 162, 7, 195, 43, 176, 109, 157, 165, 111, 20, + ], + [ + 89, 27, 63, 103, 203, 222, 240, 108, 58, 105, 47, 111, 93, 125, 42, 244, 246, + 4, 6, 182, 232, 36, 55, 61, 8, 117, 94, 62, 207, 238, 38, 17, + ], + ], + outputs: vec![[ + 212, 175, 37, 253, 157, 95, 20, 32, 250, 135, 88, 162, 10, 94, 160, 39, 120, 237, + 149, 68, 19, 83, 55, 177, 205, 130, 217, 175, 16, 158, 148, 29, + ]], + }, + DuplexTestVectorFqA2S1 { + inputs: vec![ + [ + 202, 3, 14, 68, 34, 114, 20, 86, 61, 210, 50, 107, 59, 101, 13, 109, 49, 196, + 247, 255, 146, 211, 70, 88, 145, 223, 7, 153, 220, 199, 26, 63, + ], + [ + 59, 189, 38, 196, 170, 40, 127, 232, 153, 143, 72, 185, 88, 191, 65, 233, 173, + 71, 156, 149, 176, 163, 62, 193, 76, 249, 130, 133, 94, 150, 126, 37, + ], + ], + outputs: vec![[ + 143, 156, 30, 76, 251, 143, 51, 142, 6, 127, 193, 77, 131, 99, 45, 128, 237, 192, + 106, 95, 118, 43, 151, 152, 108, 35, 151, 65, 190, 25, 128, 3, + ]], + }, + DuplexTestVectorFqA2S1 { + inputs: vec![ + [ + 115, 138, 18, 216, 3, 143, 228, 245, 174, 118, 247, 122, 228, 165, 158, 99, + 145, 186, 120, 216, 195, 238, 162, 195, 253, 20, 195, 60, 228, 184, 74, 48, + ], + [ + 122, 85, 240, 245, 194, 183, 162, 186, 69, 46, 181, 37, 207, 77, 82, 215, 80, + 232, 170, 43, 114, 140, 129, 181, 233, 224, 204, 7, 176, 75, 27, 50, + ], + ], + outputs: vec![[ + 65, 135, 115, 43, 129, 169, 232, 100, 161, 238, 9, 69, 101, 165, 215, 18, 137, 83, + 84, 81, 147, 91, 9, 107, 185, 147, 111, 38, 237, 47, 131, 30, + ]], + }, + ] +} + +pub(crate) fn fq_a2_s2() -> Vec { + vec![ + DuplexTestVectorFqA2S2 { + inputs: vec![[0; 32], [0; 32]], + outputs: vec![ + [ + 198, 209, 35, 56, 213, 195, 118, 89, 136, 85, 195, 123, 192, 239, 227, 168, 78, + 139, 195, 36, 241, 14, 199, 62, 199, 141, 53, 27, 129, 113, 239, 27, + ], + [ + 93, 185, 203, 134, 26, 182, 84, 99, 50, 105, 135, 155, 113, 99, 82, 100, 228, + 26, 123, 252, 87, 55, 19, 56, 183, 143, 186, 63, 174, 203, 198, 60, + ], + ], + }, + DuplexTestVectorFqA2S2 { + inputs: vec![ + [ + 79, 65, 55, 245, 16, 1, 12, 158, 237, 2, 170, 99, 177, 11, 33, 84, 191, 60, + 217, 79, 228, 219, 125, 182, 176, 72, 59, 150, 95, 109, 65, 50, + ], + [ + 54, 14, 149, 139, 112, 17, 66, 204, 251, 175, 12, 169, 150, 24, 184, 33, 75, + 28, 182, 185, 75, 252, 246, 204, 194, 46, 181, 98, 76, 25, 84, 57, + ], + ], + outputs: vec![ + [ + 150, 226, 31, 236, 180, 184, 198, 155, 12, 229, 97, 101, 186, 21, 193, 69, 105, + 247, 9, 182, 242, 217, 103, 98, 4, 237, 118, 147, 32, 136, 137, 6, + ], + [ + 96, 137, 193, 208, 212, 154, 242, 231, 36, 146, 228, 6, 251, 110, 188, 5, 161, + 84, 246, 70, 210, 181, 253, 255, 170, 149, 63, 211, 98, 173, 202, 59, + ], + ], + }, + DuplexTestVectorFqA2S2 { + inputs: vec![ + [ + 37, 226, 252, 174, 201, 97, 127, 131, 138, 123, 251, 32, 24, 140, 203, 168, + 164, 120, 229, 197, 170, 92, 120, 163, 0, 115, 201, 197, 128, 230, 130, 48, + ], + [ + 22, 19, 11, 167, 7, 230, 205, 13, 69, 9, 209, 125, 225, 248, 101, 91, 170, 112, + 93, 20, 193, 73, 181, 174, 49, 91, 118, 123, 163, 220, 225, 44, + ], + ], + outputs: vec![ + [ + 128, 230, 153, 178, 75, 75, 83, 129, 9, 172, 68, 190, 5, 228, 168, 221, 122, + 226, 60, 222, 52, 227, 80, 8, 167, 57, 82, 183, 222, 91, 61, 35, + ], + [ + 18, 60, 148, 164, 15, 174, 89, 61, 176, 66, 222, 130, 145, 131, 2, 18, 167, + 223, 58, 242, 1, 18, 12, 184, 182, 185, 160, 125, 205, 1, 185, 55, + ], + ], + }, + DuplexTestVectorFqA2S2 { + inputs: vec![ + [ + 112, 73, 72, 222, 28, 91, 138, 183, 100, 223, 90, 231, 119, 145, 166, 233, 148, + 78, 14, 55, 136, 109, 109, 68, 115, 111, 187, 160, 13, 96, 24, 32, + ], + [ + 165, 139, 14, 67, 128, 142, 233, 44, 180, 165, 119, 24, 164, 167, 136, 124, 72, + 59, 197, 16, 7, 83, 11, 34, 129, 211, 201, 243, 48, 127, 245, 6, + ], + ], + outputs: vec![ + [ + 152, 136, 76, 74, 61, 183, 90, 92, 191, 231, 133, 85, 110, 71, 132, 33, 148, 4, + 57, 115, 80, 44, 68, 97, 50, 129, 162, 180, 4, 172, 214, 36, + ], + [ + 50, 57, 236, 119, 111, 186, 82, 161, 50, 59, 112, 52, 160, 206, 178, 135, 147, + 17, 10, 26, 96, 122, 212, 160, 45, 186, 12, 187, 214, 188, 25, 10, + ], + ], + }, + DuplexTestVectorFqA2S2 { + inputs: vec![ + [ + 184, 172, 166, 17, 217, 112, 193, 196, 200, 166, 58, 93, 19, 191, 93, 41, 118, + 177, 103, 196, 112, 143, 151, 146, 40, 234, 12, 24, 112, 192, 178, 56, + ], + [ + 124, 88, 58, 86, 208, 166, 236, 130, 166, 103, 184, 22, 240, 149, 81, 95, 84, + 60, 187, 94, 8, 46, 164, 162, 25, 168, 21, 100, 248, 110, 148, 6, + ], + ], + outputs: vec![ + [ + 173, 164, 250, 152, 128, 58, 92, 198, 177, 223, 29, 83, 187, 80, 62, 182, 186, + 83, 119, 209, 209, 69, 204, 57, 139, 111, 215, 20, 201, 32, 67, 15, + ], + [ + 251, 20, 238, 225, 65, 119, 124, 242, 56, 125, 141, 38, 247, 167, 116, 197, 89, + 76, 54, 27, 174, 170, 119, 215, 66, 208, 121, 16, 223, 241, 148, 35, + ], + ], + }, + DuplexTestVectorFqA2S2 { + inputs: vec![ + [ + 54, 96, 159, 157, 180, 195, 243, 234, 198, 250, 60, 70, 22, 204, 161, 20, 65, + 85, 178, 236, 16, 49, 117, 93, 72, 35, 251, 250, 39, 177, 56, 51, + ], + [ + 243, 75, 233, 199, 94, 28, 82, 127, 128, 30, 59, 44, 252, 244, 89, 85, 215, + 176, 109, 79, 39, 185, 172, 179, 134, 50, 39, 33, 254, 113, 12, 44, + ], + ], + outputs: vec![ + [ + 129, 119, 63, 107, 11, 194, 40, 140, 163, 147, 75, 106, 249, 103, 68, 104, 162, + 92, 44, 177, 168, 17, 84, 208, 136, 23, 228, 245, 149, 13, 13, 3, + ], + [ + 144, 118, 47, 233, 204, 249, 246, 46, 142, 51, 159, 134, 66, 136, 255, 0, 173, + 51, 61, 239, 64, 6, 54, 153, 136, 184, 121, 138, 63, 59, 95, 9, + ], + ], + }, + ] +}