From 91db490e202dbd19d96e0ae5519a2445e614534b Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Tue, 18 May 2021 21:33:11 +0100 Subject: [PATCH] test: Add Poseidon test vectors --- src/circuit/gadget/poseidon/pow5t3.rs | 39 +- src/primitives/poseidon.rs | 3 + src/primitives/poseidon/nullifier.rs | 40 +- src/primitives/poseidon/test_vectors.rs | 632 ++++++++++++++++++++++++ 4 files changed, 703 insertions(+), 11 deletions(-) create mode 100644 src/primitives/poseidon/test_vectors.rs diff --git a/src/circuit/gadget/poseidon/pow5t3.rs b/src/circuit/gadget/poseidon/pow5t3.rs index c591a87c..ad7290aa 100644 --- a/src/circuit/gadget/poseidon/pow5t3.rs +++ b/src/circuit/gadget/poseidon/pow5t3.rs @@ -600,6 +600,7 @@ impl Pow5T3State { #[cfg(test)] mod tests { + use ff::PrimeField; use halo2::{ arithmetic::FieldExt, circuit::{layouter, Layouter}, @@ -607,6 +608,7 @@ mod tests { pasta::Fp, plonk::{Assignment, Circuit, ConstraintSystem, Error}, }; + use pasta_curves::pallas; use super::{PoseidonInstructions, Pow5T3Chip, Pow5T3Config, StateWord, WIDTH}; use crate::{ @@ -702,6 +704,9 @@ mod tests { struct HashCircuit { message: Option<[Fp; 2]>, + // For the purpose of this test, witness the result. + // TODO: Move this into an instance column. + output: Option, } impl Circuit for HashCircuit { @@ -748,12 +753,6 @@ mod tests { let hasher = Hash::init(chip, layouter.namespace(|| "init"), ConstantLength::<2>)?; let output = hasher.hash(layouter.namespace(|| "hash"), message)?; - // For the purpose of this test, compute the real final state inline. - // TODO: Move this into an instance column. - let expected_output = self.message.map(|message_vals| { - poseidon::Hash::init(OrchardNullifier, ConstantLength::<2>).hash(message_vals) - }); - layouter.assign_region( || "constrain output", |mut region| { @@ -761,7 +760,7 @@ mod tests { || "load output", config.state[0], 0, - || expected_output.ok_or(Error::SynthesisError), + || self.output.ok_or(Error::SynthesisError), )?; let word: StateWord<_> = output.inner; region.constrain_equal(&config.state_permutation, word.var, expected_var) @@ -773,15 +772,36 @@ mod tests { #[test] fn poseidon_hash() { let message = [Fp::rand(), Fp::rand()]; + let output = poseidon::Hash::init(OrchardNullifier, ConstantLength::<2>).hash(message); let k = 6; let circuit = HashCircuit { message: Some(message), + output: Some(output), }; let prover = MockProver::run(k, &circuit, vec![]).unwrap(); assert_eq!(prover.verify(), Ok(())) } + #[test] + fn hash_test_vectors() { + for tv in crate::primitives::poseidon::test_vectors::hash() { + let message = [ + pallas::Base::from_repr(tv.input[0]).unwrap(), + pallas::Base::from_repr(tv.input[1]).unwrap(), + ]; + let output = poseidon::Hash::init(OrchardNullifier, ConstantLength).hash(message); + + let k = 6; + let circuit = HashCircuit { + message: Some(message), + output: Some(output), + }; + let prover = MockProver::run(k, &circuit, vec![]).unwrap(); + assert_eq!(prover.verify(), Ok(())); + } + } + #[cfg(feature = "dev-graph")] #[test] fn print_poseidon_chip() { @@ -793,7 +813,10 @@ mod tests { .titled("Poseidon Chip Layout", ("sans-serif", 60)) .unwrap(); - let circuit = HashCircuit { message: None }; + let circuit = HashCircuit { + message: None, + output: None, + }; halo2::dev::circuit_layout(&circuit, &root).unwrap(); } } diff --git a/src/primitives/poseidon.rs b/src/primitives/poseidon.rs index 144aad1e..5569665b 100644 --- a/src/primitives/poseidon.rs +++ b/src/primitives/poseidon.rs @@ -8,6 +8,9 @@ use halo2::arithmetic::FieldExt; pub(crate) mod grain; pub(crate) mod mds; +#[cfg(test)] +pub(crate) mod test_vectors; + mod nullifier; pub use nullifier::OrchardNullifier; diff --git a/src/primitives/poseidon/nullifier.rs b/src/primitives/poseidon/nullifier.rs index 1ebb5883..1d5167b3 100644 --- a/src/primitives/poseidon/nullifier.rs +++ b/src/primitives/poseidon/nullifier.rs @@ -1507,12 +1507,13 @@ const MDS_INV: [[pallas::Base; 3]; 3] = [ mod tests { use std::marker::PhantomData; + use ff::PrimeField; use halo2::arithmetic::FieldExt; use pasta_curves::pallas; - use crate::primitives::poseidon::{permute, Spec}; + use crate::primitives::poseidon::{permute, ConstantLength, Hash, Spec}; - use super::{MDS, MDS_INV, ROUND_CONSTANTS}; + use super::{OrchardNullifier, MDS, MDS_INV, ROUND_CONSTANTS}; /// The same Poseidon specification as poseidon::OrchardNullifier, but constructed /// such that its constants will be generated at runtime. @@ -1550,7 +1551,7 @@ mod tests { } #[test] - fn test_vectors() { + fn verify_constants() { let poseidon = P128Pow5T3Plus::::new(0); let (round_constants, mds, mds_inv) = poseidon.constants(); @@ -1626,4 +1627,37 @@ mod tests { ); assert_eq!(input, expected_output); } + + #[test] + fn permute_test_vectors() { + let (round_constants, mds, _) = OrchardNullifier.constants(); + + for tv in crate::primitives::poseidon::test_vectors::permute() { + let mut state = [ + pallas::Base::from_repr(tv.initial_state[0]).unwrap(), + pallas::Base::from_repr(tv.initial_state[1]).unwrap(), + pallas::Base::from_repr(tv.initial_state[2]).unwrap(), + ]; + + permute::(&mut state, &mds, &round_constants); + + for (expected, actual) in tv.final_state.iter().zip(state.iter()) { + assert_eq!(&actual.to_repr(), expected); + } + } + } + + #[test] + fn hash_test_vectors() { + for tv in crate::primitives::poseidon::test_vectors::hash() { + let message = [ + pallas::Base::from_repr(tv.input[0]).unwrap(), + pallas::Base::from_repr(tv.input[1]).unwrap(), + ]; + + let result = Hash::init(OrchardNullifier, ConstantLength).hash(message); + + assert_eq!(result.to_repr(), tv.output); + } + } } diff --git a/src/primitives/poseidon/test_vectors.rs b/src/primitives/poseidon/test_vectors.rs new file mode 100644 index 00000000..f33d5cb5 --- /dev/null +++ b/src/primitives/poseidon/test_vectors.rs @@ -0,0 +1,632 @@ +//! Test vectors for [`OrchardNullifier`]. + +pub(crate) struct PermuteTestVector { + pub(crate) initial_state: [[u8; 32]; 3], + pub(crate) final_state: [[u8; 32]; 3], +} + +pub(crate) struct HashTestVector { + pub(crate) input: [[u8; 32]; 2], + pub(crate) output: [u8; 32], +} + +pub(crate) fn permute() -> Vec { + use PermuteTestVector as TestVector; + + // From https://github.com/zcash-hackworks/zcash-test-vectors/blob/master/orchard_poseidon.py + vec![ + TestVector { + initial_state: [ + [ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + ], + [ + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + ], + [ + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + ], + ], + final_state: [ + [ + 0x90, 0x4c, 0x22, 0xc1, 0xdf, 0x0c, 0x86, 0x45, 0x6e, 0x2d, 0x11, 0x05, 0x3e, + 0x1f, 0xd2, 0x6a, 0x5c, 0xdb, 0xe5, 0x7e, 0xe0, 0x3b, 0xd3, 0xe2, 0xea, 0xaa, + 0x40, 0xf8, 0xdb, 0x64, 0xa2, 0x19, + ], + [ + 0x1e, 0x09, 0x34, 0x34, 0x1c, 0xed, 0xc3, 0x3d, 0xfd, 0xd5, 0x6b, 0xdf, 0xbf, + 0x06, 0xcc, 0x31, 0x99, 0xcf, 0x10, 0xdf, 0xb6, 0x86, 0x36, 0x81, 0x85, 0xc2, + 0x94, 0x6e, 0xd6, 0x23, 0xb8, 0x11, + ], + [ + 0x28, 0xde, 0x6e, 0x75, 0x6d, 0x3d, 0xdc, 0xc5, 0xe3, 0x96, 0xc5, 0xab, 0xae, + 0x5c, 0xaa, 0xcb, 0x08, 0xb6, 0xcb, 0xb4, 0xc3, 0x35, 0xa6, 0x68, 0xce, 0xd2, + 0x66, 0x19, 0xf4, 0x04, 0x11, 0x11, + ], + ], + }, + TestVector { + initial_state: [ + [ + 0x5c, 0x7a, 0x8f, 0x73, 0xad, 0xfc, 0x70, 0xfb, 0x3f, 0x13, 0x94, 0x49, 0xac, + 0x6b, 0x57, 0x07, 0x4c, 0x4d, 0x6e, 0x66, 0xb1, 0x64, 0x93, 0x9d, 0xaf, 0xfa, + 0x2e, 0xf6, 0xee, 0x69, 0x21, 0x08, + ], + [ + 0x1a, 0xdd, 0x86, 0xb3, 0xf2, 0xe1, 0xbd, 0xa6, 0x2a, 0x5d, 0x2e, 0x0e, 0x98, + 0x2b, 0x77, 0xe6, 0xb0, 0xef, 0x9c, 0xa3, 0xf2, 0x49, 0x88, 0xc7, 0xb3, 0x53, + 0x42, 0x01, 0xcf, 0xb1, 0xcd, 0x0d, + ], + [ + 0xbd, 0x69, 0xb8, 0x25, 0x32, 0xb6, 0x94, 0x0f, 0xf2, 0x59, 0x0f, 0x67, 0x9b, + 0xa9, 0xc7, 0x27, 0x1f, 0xe0, 0x1f, 0x7e, 0x9c, 0x8e, 0x36, 0xd6, 0xa5, 0xe2, + 0x9d, 0x4e, 0x30, 0xa7, 0x35, 0x14, + ], + ], + final_state: [ + [ + 0xc5, 0x77, 0x86, 0x7d, 0xe7, 0x3a, 0xac, 0x8f, 0xb6, 0x70, 0x24, 0x17, 0x15, + 0x02, 0xb9, 0x05, 0xed, 0xb3, 0x28, 0x5e, 0xd8, 0x2a, 0x83, 0xfd, 0x2d, 0x42, + 0x80, 0x78, 0x58, 0x20, 0xf8, 0x2b, + ], + [ + 0x15, 0xd5, 0xce, 0xac, 0x4b, 0x8a, 0x89, 0xf5, 0x50, 0xaf, 0x64, 0x6b, 0x9d, + 0x94, 0x01, 0x5d, 0xfe, 0x2d, 0xf2, 0x5e, 0x53, 0x1f, 0xc8, 0x64, 0x5a, 0x77, + 0x15, 0x25, 0xff, 0x8e, 0x79, 0x18, + ], + [ + 0x79, 0xcc, 0x5e, 0xf9, 0xec, 0xe6, 0x3d, 0x36, 0x85, 0xe0, 0x2e, 0xa3, 0xb0, + 0xb6, 0x91, 0x1b, 0xf3, 0xf1, 0x08, 0x9a, 0xf6, 0xc4, 0x5e, 0x1d, 0xbb, 0xb3, + 0x69, 0x24, 0x64, 0x49, 0x74, 0x1d, + ], + ], + }, + TestVector { + initial_state: [ + [ + 0xbc, 0x50, 0x98, 0x42, 0x55, 0xd6, 0xaf, 0xbe, 0x9e, 0xf9, 0x28, 0x48, 0xed, + 0x5a, 0xc0, 0x08, 0x62, 0xc2, 0xfa, 0x7b, 0x2f, 0xec, 0xbc, 0xb6, 0x4b, 0x69, + 0x68, 0x91, 0x2a, 0x63, 0x81, 0x0e, + ], + [ + 0x3d, 0xc1, 0x66, 0xd5, 0x6a, 0x1d, 0x62, 0xf5, 0xa8, 0xd7, 0x55, 0x1d, 0xb5, + 0xfd, 0x93, 0x13, 0xe8, 0xc7, 0x20, 0x3d, 0x99, 0x6a, 0xf7, 0xd4, 0x77, 0x08, + 0x37, 0x56, 0xd5, 0x9a, 0xf8, 0x0d, + ], + [ + 0x05, 0xa7, 0x45, 0xf4, 0x5d, 0x7f, 0xf6, 0xdb, 0x10, 0xbc, 0x67, 0xfd, 0xf0, + 0xf0, 0x3e, 0xbf, 0x81, 0x30, 0xab, 0x33, 0x36, 0x26, 0x97, 0xb0, 0xe4, 0xe4, + 0xc7, 0x63, 0xcc, 0xb8, 0xf6, 0x36, + ], + ], + final_state: [ + [ + 0xf3, 0x8d, 0xca, 0xec, 0x4a, 0x8f, 0x4e, 0xa2, 0x4d, 0x77, 0x8f, 0x00, 0x02, + 0x36, 0xe4, 0xd3, 0x5e, 0x3c, 0xa6, 0x2e, 0x6a, 0x1b, 0xd8, 0x8b, 0x09, 0x00, + 0xfb, 0xaa, 0x1f, 0xc1, 0x79, 0x3e, + ], + [ + 0x3a, 0xe7, 0x5e, 0x3d, 0x47, 0xda, 0x8c, 0xd9, 0x9e, 0x11, 0x5e, 0x6a, 0xee, + 0x89, 0x08, 0x0c, 0x19, 0x24, 0xbc, 0x47, 0xac, 0xe6, 0x1d, 0x66, 0x54, 0xf9, + 0x90, 0x07, 0x4d, 0x95, 0x57, 0x0b, + ], + [ + 0xdd, 0x21, 0xcf, 0x43, 0x97, 0xb5, 0xec, 0xe2, 0x0c, 0x7a, 0x27, 0x42, 0x1e, + 0xf8, 0x18, 0x5b, 0x3d, 0xb7, 0x19, 0x1d, 0xac, 0x0e, 0xed, 0x45, 0x37, 0xe3, + 0x79, 0xf1, 0x3d, 0x71, 0x78, 0x06, + ], + ], + }, + TestVector { + initial_state: [ + [ + 0x49, 0x5c, 0x22, 0x2f, 0x7f, 0xba, 0x1e, 0x31, 0xde, 0xfa, 0x3d, 0x5a, 0x57, + 0xef, 0xc2, 0xe1, 0xe9, 0xb0, 0x1a, 0x03, 0x55, 0x87, 0xd5, 0xfb, 0x1a, 0x38, + 0xe0, 0x1d, 0x94, 0x90, 0x3d, 0x3c, + ], + [ + 0x3d, 0x0a, 0xd3, 0x36, 0x1f, 0xec, 0x09, 0x77, 0x90, 0xd9, 0xbe, 0x0e, 0x42, + 0x98, 0x8d, 0x7d, 0x25, 0xc9, 0xa1, 0x38, 0xf4, 0x9b, 0x1a, 0x53, 0x7e, 0xdc, + 0xf0, 0x4b, 0xe3, 0x4a, 0x98, 0x11, + ], + [ + 0xa4, 0xaf, 0x9d, 0xb6, 0xd2, 0x7b, 0x50, 0x72, 0x83, 0x5f, 0x0c, 0x3e, 0x88, + 0x39, 0x5e, 0xd7, 0xa4, 0x1b, 0x00, 0x52, 0xad, 0x80, 0x84, 0xa8, 0xb9, 0xda, + 0x94, 0x8d, 0x32, 0x0d, 0xad, 0x16, + ], + ], + final_state: [ + [ + 0xdc, 0xd8, 0xa7, 0x4b, 0x5e, 0xd4, 0xfc, 0xe5, 0x5d, 0x55, 0x3a, 0x44, 0xcb, + 0x7f, 0x3e, 0x49, 0xf4, 0x58, 0xd7, 0x5c, 0xd2, 0x73, 0x54, 0xaf, 0x50, 0x87, + 0xad, 0xfd, 0x62, 0xba, 0x1f, 0x39, + ], + [ + 0x32, 0xe8, 0xb9, 0xf1, 0xe8, 0x1b, 0x94, 0xc0, 0xc5, 0x5b, 0x0a, 0x65, 0xb4, + 0x3b, 0xae, 0x5e, 0xae, 0xa8, 0x5b, 0x92, 0x6c, 0xda, 0x2d, 0x7c, 0x9b, 0x12, + 0xc3, 0xb3, 0x4a, 0x44, 0x02, 0x17, + ], + [ + 0xea, 0xec, 0x69, 0x76, 0x9a, 0x01, 0xd0, 0xdb, 0x4e, 0xdc, 0x1e, 0x02, 0xb2, + 0x63, 0x14, 0x06, 0xba, 0xf7, 0x27, 0x34, 0x1f, 0xf1, 0xd4, 0xae, 0xe0, 0xdc, + 0xd9, 0x6e, 0x48, 0xb6, 0x0c, 0x13, + ], + ], + }, + TestVector { + initial_state: [ + [ + 0x4d, 0x54, 0x31, 0xe6, 0x43, 0x7d, 0x0b, 0x5b, 0xed, 0xbb, 0xcd, 0xaf, 0x34, + 0x5b, 0x86, 0xc4, 0x12, 0x1f, 0xc0, 0x0f, 0xe7, 0xf2, 0x35, 0x73, 0x42, 0x76, + 0xd3, 0x8d, 0x47, 0xf1, 0xe1, 0x11, + ], + [ + 0xdd, 0x0c, 0x7a, 0x1d, 0x81, 0x1c, 0x7d, 0x9c, 0xd4, 0x6d, 0x37, 0x7b, 0x3f, + 0xde, 0xab, 0x3f, 0xb6, 0x79, 0xf3, 0xdc, 0x60, 0x1d, 0x00, 0x82, 0x85, 0xed, + 0xcb, 0xda, 0xe6, 0x9c, 0xe8, 0x3c, + ], + [ + 0x19, 0xe4, 0xaa, 0xc0, 0x35, 0x90, 0x17, 0xec, 0x85, 0xa1, 0x83, 0xd2, 0x20, + 0x53, 0xdb, 0x33, 0xf7, 0x34, 0x76, 0xf2, 0x1a, 0x48, 0x2e, 0xc9, 0x37, 0x83, + 0x65, 0xc8, 0xf7, 0x39, 0x3c, 0x14, + ], + ], + final_state: [ + [ + 0x55, 0x28, 0xb7, 0x18, 0xe3, 0x7d, 0x53, 0xad, 0x3c, 0x5e, 0x39, 0x8d, 0xa8, + 0xe7, 0xf1, 0x76, 0x3c, 0x0e, 0x9b, 0xf5, 0xe6, 0x15, 0xb3, 0x9a, 0x42, 0x25, + 0x74, 0x1d, 0x5f, 0xc2, 0x2c, 0x14, + ], + [ + 0xa5, 0x87, 0xa7, 0xa9, 0x85, 0x48, 0xc5, 0xe6, 0xc4, 0x9c, 0xdd, 0x04, 0xdf, + 0x77, 0x82, 0x6a, 0x5e, 0xf4, 0xe6, 0x24, 0xb8, 0x59, 0x5e, 0x79, 0x0e, 0x0d, + 0xba, 0xb1, 0x6f, 0x59, 0xd2, 0x26, + ], + [ + 0x53, 0xe4, 0x47, 0xbd, 0x29, 0x95, 0x72, 0x2c, 0xf5, 0x1a, 0x6c, 0x44, 0x71, + 0xeb, 0xb8, 0x3f, 0x0d, 0x11, 0xd5, 0xd0, 0x1f, 0x4d, 0x84, 0x88, 0xc5, 0x78, + 0x9f, 0xe9, 0x03, 0x37, 0x5e, 0x23, + ], + ], + }, + TestVector { + initial_state: [ + [ + 0xe2, 0x88, 0x53, 0x15, 0xeb, 0x46, 0x71, 0x09, 0x8b, 0x79, 0x53, 0x5e, 0x79, + 0x0f, 0xe5, 0x3e, 0x29, 0xfe, 0xf2, 0xb3, 0x76, 0x66, 0x97, 0xac, 0x32, 0xb4, + 0xf4, 0x73, 0xf4, 0x68, 0xa0, 0x08, + ], + [ + 0xe6, 0x23, 0x89, 0xfc, 0x16, 0x57, 0xe0, 0xde, 0xf0, 0xb6, 0x32, 0xc6, 0xae, + 0x25, 0xf9, 0xf7, 0x83, 0xb2, 0x7d, 0xb5, 0x9a, 0x4a, 0x15, 0x3d, 0x88, 0x2d, + 0x2b, 0x21, 0x03, 0x59, 0x65, 0x15, + ], + [ + 0xeb, 0x94, 0x94, 0xc6, 0xd2, 0x27, 0xe2, 0x16, 0x3b, 0x46, 0x99, 0xd9, 0x91, + 0xf4, 0x33, 0xbf, 0x94, 0x86, 0xa7, 0xaf, 0xcf, 0x4a, 0x0d, 0x9c, 0x73, 0x1e, + 0x98, 0x5d, 0x99, 0x58, 0x9c, 0x0b, + ], + ], + final_state: [ + [ + 0x4a, 0x09, 0x0a, 0xa2, 0x98, 0xa8, 0x0c, 0xc3, 0x9c, 0x13, 0x5d, 0x51, 0xd1, + 0x63, 0x7c, 0xa4, 0x4e, 0xa4, 0xb2, 0x92, 0xc7, 0xa1, 0xd4, 0xef, 0xd3, 0xc0, + 0x5d, 0x0b, 0xfa, 0x3e, 0x0c, 0x09, + ], + [ + 0xf6, 0x6b, 0x28, 0x79, 0x7c, 0xe3, 0x56, 0x83, 0x0f, 0xda, 0xbf, 0xe0, 0x79, + 0x83, 0x9e, 0x9c, 0xb2, 0xe4, 0xd5, 0x66, 0x6b, 0xa6, 0x3b, 0x15, 0x94, 0x5e, + 0x95, 0x85, 0x85, 0x52, 0xfd, 0x38, + ], + [ + 0xde, 0xe0, 0x09, 0x64, 0x33, 0x8c, 0x59, 0xe6, 0x92, 0x98, 0x53, 0x66, 0xc9, + 0x69, 0xa6, 0xba, 0x83, 0x1a, 0x62, 0x9f, 0xbb, 0xd6, 0xec, 0xee, 0xf1, 0x04, + 0x9d, 0x78, 0xc6, 0x2f, 0x0c, 0x13, + ], + ], + }, + TestVector { + initial_state: [ + [ + 0xb7, 0x38, 0xe8, 0xaa, 0x0a, 0x15, 0x26, 0xa5, 0xbd, 0xef, 0x61, 0x31, 0x20, + 0x37, 0x2e, 0x83, 0x1a, 0x20, 0xda, 0x8a, 0xba, 0x18, 0xd1, 0xdb, 0xeb, 0xbc, + 0x86, 0x2d, 0xed, 0x42, 0x43, 0x1e, + ], + [ + 0x91, 0x47, 0x69, 0x30, 0xe3, 0x38, 0x5c, 0xd3, 0xe3, 0x37, 0x9e, 0x38, 0x53, + 0xd9, 0x34, 0x67, 0xe0, 0x01, 0xaf, 0xa2, 0xfb, 0x8d, 0xc3, 0x43, 0x6d, 0x75, + 0xa4, 0xa6, 0xf2, 0x65, 0x72, 0x10, + ], + [ + 0x4b, 0x19, 0x22, 0x32, 0xec, 0xb9, 0xf0, 0xc0, 0x24, 0x11, 0xe5, 0x25, 0x96, + 0xbc, 0x5e, 0x90, 0x45, 0x7e, 0x74, 0x59, 0x39, 0xff, 0xed, 0xbd, 0x12, 0x86, + 0x3c, 0xe7, 0x1a, 0x02, 0xaf, 0x11, + ], + ], + final_state: [ + [ + 0xab, 0x9d, 0x4b, 0x1a, 0x43, 0xfc, 0xbe, 0x0f, 0x8d, 0xc4, 0xc6, 0x2d, 0x5f, + 0xb1, 0x34, 0xa9, 0x3b, 0x71, 0xa4, 0x98, 0xe5, 0x76, 0xdd, 0x10, 0xe5, 0x23, + 0x0a, 0x9c, 0xc5, 0xe3, 0x35, 0x07, + ], + [ + 0x35, 0xf0, 0x6f, 0x31, 0x1e, 0x1f, 0x7b, 0x05, 0x89, 0x0b, 0xc3, 0xe4, 0xcf, + 0xc9, 0xff, 0xbe, 0xd0, 0xce, 0x36, 0xf7, 0xb8, 0xa0, 0x56, 0xfd, 0x1b, 0x7a, + 0xd1, 0x79, 0xff, 0x89, 0x30, 0x2a, + ], + [ + 0xfe, 0x25, 0x79, 0xc2, 0x88, 0x75, 0xae, 0x02, 0x25, 0x0f, 0x12, 0x43, 0x13, + 0xd0, 0xc9, 0xcf, 0x92, 0xbe, 0x3c, 0x5f, 0x81, 0x5c, 0xe9, 0x95, 0xf0, 0x66, + 0xfe, 0x02, 0xe5, 0x1f, 0x43, 0x02, + ], + ], + }, + TestVector { + initial_state: [ + [ + 0x7b, 0x41, 0x7a, 0xdb, 0x63, 0xb3, 0x71, 0x22, 0xa5, 0xbf, 0x62, 0xd2, 0x6f, + 0x1e, 0x7f, 0x26, 0x8f, 0xb8, 0x6b, 0x12, 0xb5, 0x6d, 0xa9, 0xc3, 0x82, 0x85, + 0x7d, 0xee, 0xcc, 0x40, 0xa9, 0x0d, + ], + [ + 0x5e, 0x29, 0x35, 0x39, 0x71, 0xb3, 0x49, 0x94, 0xb6, 0x21, 0xb0, 0xb2, 0x61, + 0xae, 0xb3, 0x78, 0x6d, 0xd9, 0x84, 0xd5, 0x67, 0xdb, 0x28, 0x57, 0xb9, 0x27, + 0xb7, 0xfa, 0xe2, 0xdb, 0x58, 0x31, + ], + [ + 0x05, 0x41, 0x5d, 0x46, 0x42, 0x78, 0x9d, 0x38, 0xf5, 0x0b, 0x8d, 0xbc, 0xc1, + 0x29, 0xca, 0xb3, 0xd1, 0x7d, 0x19, 0xf3, 0x35, 0x5b, 0xcf, 0x73, 0xce, 0xcb, + 0x8c, 0xb8, 0xa5, 0xda, 0x01, 0x30, + ], + ], + final_state: [ + [ + 0xbb, 0x73, 0x92, 0x3b, 0x95, 0x2e, 0x75, 0x56, 0x17, 0x3c, 0xb0, 0xdb, 0x98, + 0x8f, 0x61, 0x74, 0xa7, 0x2c, 0x71, 0x89, 0xec, 0xd3, 0x61, 0x71, 0xbe, 0x6b, + 0xdb, 0xaf, 0x4f, 0x82, 0xea, 0x05, + ], + [ + 0x22, 0x49, 0xea, 0x38, 0xd9, 0x86, 0x9e, 0xd2, 0xf3, 0xc8, 0x94, 0xc7, 0x02, + 0x4d, 0xef, 0x6f, 0x5b, 0x75, 0x88, 0x4e, 0x13, 0x0a, 0xbe, 0x3a, 0x5c, 0x34, + 0xf0, 0x6b, 0x34, 0x4d, 0x95, 0x13, + ], + [ + 0xbc, 0xd4, 0x0e, 0xed, 0x83, 0x3c, 0x69, 0x38, 0x69, 0xd7, 0x02, 0x58, 0x67, + 0x91, 0x4a, 0x1b, 0x26, 0xf8, 0x83, 0x23, 0xac, 0xfa, 0x78, 0x91, 0xb9, 0xa7, + 0xbb, 0x65, 0x4f, 0xd8, 0x21, 0x07, + ], + ], + }, + TestVector { + initial_state: [ + [ + 0x71, 0x52, 0xf1, 0x39, 0x36, 0xa2, 0x70, 0x57, 0x26, 0x70, 0xdc, 0x82, 0xd3, + 0x90, 0x26, 0xc6, 0xcb, 0x4c, 0xd4, 0xb0, 0xf7, 0xf5, 0xaa, 0x2a, 0x4f, 0x5a, + 0x53, 0x41, 0xec, 0x5d, 0xd7, 0x15, + ], + [ + 0x40, 0x6f, 0x2f, 0xdd, 0x2a, 0xfa, 0x73, 0x3f, 0x5f, 0x64, 0x1c, 0x8c, 0x21, + 0x86, 0x2a, 0x1b, 0xaf, 0xce, 0x26, 0x09, 0xd9, 0xee, 0xcf, 0xa1, 0x58, 0xcf, + 0xb5, 0xcd, 0x79, 0xf8, 0x80, 0x08, + ], + [ + 0xe2, 0x15, 0xdc, 0x7d, 0x96, 0x57, 0xba, 0xd3, 0xfb, 0x88, 0xb0, 0x1e, 0x99, + 0x38, 0x44, 0x54, 0x36, 0x24, 0xc2, 0x5f, 0xa9, 0x59, 0xcc, 0x97, 0x48, 0x9c, + 0xe7, 0x57, 0x45, 0x82, 0x4b, 0x37, + ], + ], + final_state: [ + [ + 0xf9, 0xc6, 0x42, 0x74, 0xbb, 0xb8, 0xf2, 0x01, 0x2d, 0xd0, 0xa5, 0xe9, 0x94, + 0xd2, 0x35, 0x9f, 0xbe, 0x09, 0x28, 0xe6, 0xc8, 0x22, 0xb3, 0xf5, 0x1a, 0x22, + 0xe0, 0x0e, 0x56, 0xc7, 0xe8, 0x0c, + ], + [ + 0xb7, 0xf7, 0x5e, 0xd0, 0x4b, 0xd8, 0xb0, 0x88, 0xc5, 0xdc, 0x10, 0xfa, 0x7f, + 0x05, 0x6d, 0x41, 0x3b, 0x25, 0xd4, 0x97, 0x06, 0xfb, 0xbf, 0xd1, 0x69, 0x27, + 0x35, 0xac, 0xa7, 0x14, 0x67, 0x28, + ], + [ + 0x6d, 0x64, 0x81, 0xdf, 0x9d, 0xf5, 0x68, 0x72, 0xc2, 0xdb, 0xff, 0x63, 0x1a, + 0x63, 0xa0, 0x29, 0x77, 0x6d, 0xbc, 0x52, 0x71, 0x2b, 0xad, 0xbb, 0x1f, 0x36, + 0xc8, 0xf7, 0xde, 0x00, 0x8b, 0x12, + ], + ], + }, + TestVector { + initial_state: [ + [ + 0x86, 0x8c, 0x53, 0x23, 0x9c, 0xfb, 0xdf, 0x73, 0xca, 0xec, 0x65, 0x60, 0x40, + 0x37, 0x31, 0x4f, 0xaa, 0xce, 0xb5, 0x62, 0x18, 0xc6, 0xbd, 0x30, 0xf8, 0x37, + 0x4a, 0xc1, 0x33, 0x86, 0x79, 0x3f, + ], + [ + 0x21, 0xa9, 0xfb, 0x80, 0xad, 0x03, 0xbc, 0x0c, 0xda, 0x4a, 0x44, 0x94, 0x6c, + 0x00, 0xe1, 0xb1, 0xa1, 0xdf, 0x0e, 0x5b, 0x87, 0xb5, 0xbe, 0xce, 0x47, 0x7a, + 0x70, 0x96, 0x49, 0xe9, 0x50, 0x06, + ], + [ + 0x04, 0x91, 0x39, 0x48, 0x25, 0x64, 0xf1, 0x85, 0xc7, 0x90, 0x0e, 0x83, 0xc7, + 0x38, 0x07, 0x0a, 0xf6, 0x55, 0x6d, 0xf6, 0xed, 0x4b, 0x4d, 0xdd, 0x3d, 0x9a, + 0x69, 0xf5, 0x33, 0x57, 0xd7, 0x36, + ], + ], + final_state: [ + [ + 0x05, 0x59, 0x21, 0x7c, 0x04, 0x8d, 0x25, 0x49, 0x7f, 0x45, 0x52, 0x61, 0x47, + 0x91, 0xc3, 0x20, 0xfd, 0x9e, 0xe7, 0x4f, 0x0e, 0x72, 0x8b, 0xa3, 0x48, 0xbd, + 0x0f, 0x03, 0xe7, 0x9d, 0xb3, 0x37, + ], + [ + 0xb0, 0xaf, 0x82, 0x16, 0x25, 0x32, 0x77, 0x4a, 0x45, 0xed, 0x0e, 0xd9, 0x9b, + 0xf7, 0xaa, 0x2f, 0x98, 0xec, 0xc0, 0x2f, 0x93, 0xa0, 0xbb, 0x97, 0xe5, 0x0b, + 0x41, 0x80, 0x59, 0xf0, 0xc2, 0x21, + ], + [ + 0x66, 0xf6, 0x53, 0x50, 0x6d, 0xbc, 0x5c, 0xc2, 0x99, 0x25, 0x4b, 0xf2, 0x4c, + 0x1b, 0x56, 0xfc, 0x24, 0x72, 0x7c, 0xce, 0x45, 0xdf, 0xc0, 0x85, 0xe5, 0xd6, + 0xe2, 0x04, 0xfd, 0x86, 0x8c, 0x08, + ], + ], + }, + TestVector { + initial_state: [ + [ + 0x7d, 0x4f, 0x5c, 0xcb, 0x01, 0x64, 0x3c, 0x31, 0xdb, 0x84, 0x5e, 0xec, 0xd5, + 0xd6, 0x3d, 0xc1, 0x6a, 0x95, 0xe3, 0x02, 0x5b, 0x97, 0x92, 0xff, 0xf7, 0xf2, + 0x44, 0xfc, 0x71, 0x62, 0x69, 0x39, + ], + [ + 0x26, 0xd6, 0x2e, 0x95, 0x96, 0xfa, 0x82, 0x5c, 0x6b, 0xf2, 0x1a, 0xff, 0x9e, + 0x68, 0x62, 0x5a, 0x19, 0x24, 0x40, 0xea, 0x06, 0x82, 0x81, 0x23, 0xd9, 0x78, + 0x84, 0x80, 0x6f, 0x15, 0xfa, 0x08, + ], + [ + 0xd9, 0x52, 0x75, 0x4a, 0x23, 0x64, 0xb6, 0x66, 0xff, 0xc3, 0x0f, 0xdb, 0x01, + 0x47, 0x86, 0xda, 0x3a, 0x61, 0x28, 0xae, 0xf7, 0x84, 0xa6, 0x46, 0x10, 0xa8, + 0x9d, 0x1a, 0x70, 0x99, 0x21, 0x2d, + ], + ], + final_state: [ + [ + 0xe9, 0x14, 0x81, 0x20, 0x7d, 0x99, 0xad, 0x96, 0x5b, 0x13, 0xf6, 0xb8, 0xf0, + 0xa4, 0x5a, 0xa3, 0x3c, 0x2b, 0x8e, 0x5f, 0xe4, 0x21, 0x92, 0x97, 0xf0, 0x49, + 0x9c, 0x16, 0x7c, 0x55, 0xde, 0x3b, + ], + [ + 0x6f, 0x72, 0xcd, 0xe9, 0x21, 0x4b, 0x09, 0xe3, 0x59, 0xc3, 0x71, 0x28, 0x1a, + 0x45, 0xa5, 0x2d, 0xfb, 0xd4, 0x14, 0x93, 0x35, 0x99, 0x63, 0x4e, 0x86, 0x66, + 0x8d, 0x11, 0xf2, 0x85, 0x96, 0x0c, + ], + [ + 0x74, 0x22, 0x6e, 0xda, 0x06, 0xc1, 0xee, 0xef, 0x3f, 0xa3, 0x39, 0x4e, 0x03, + 0x7b, 0x48, 0xc0, 0x7d, 0xc2, 0x86, 0x95, 0x88, 0x8c, 0xfb, 0x59, 0x58, 0x8c, + 0x34, 0xe7, 0x12, 0xb2, 0x2b, 0x1f, + ], + ], + }, + ] +} + +pub(crate) fn hash() -> Vec { + use HashTestVector as TestVector; + + // From https://github.com/zcash-hackworks/zcash-test-vectors/blob/master/orchard_poseidon_hash.py + vec![ + TestVector { + input: [ + [ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + ], + [ + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + ], + ], + output: [ + 0xc0, 0x17, 0xb5, 0x55, 0xe8, 0x05, 0x7c, 0x49, 0x1d, 0x44, 0x4f, 0xbd, 0xb0, 0x0a, + 0x83, 0xf6, 0x4d, 0xa8, 0x90, 0x53, 0x87, 0xb4, 0xc8, 0x13, 0xc0, 0xea, 0xdc, 0x86, + 0x33, 0x58, 0x8c, 0x14, + ], + }, + TestVector { + input: [ + [ + 0x5c, 0x7a, 0x8f, 0x73, 0xad, 0xfc, 0x70, 0xfb, 0x3f, 0x13, 0x94, 0x49, 0xac, + 0x6b, 0x57, 0x07, 0x4c, 0x4d, 0x6e, 0x66, 0xb1, 0x64, 0x93, 0x9d, 0xaf, 0xfa, + 0x2e, 0xf6, 0xee, 0x69, 0x21, 0x08, + ], + [ + 0x1a, 0xdd, 0x86, 0xb3, 0xf2, 0xe1, 0xbd, 0xa6, 0x2a, 0x5d, 0x2e, 0x0e, 0x98, + 0x2b, 0x77, 0xe6, 0xb0, 0xef, 0x9c, 0xa3, 0xf2, 0x49, 0x88, 0xc7, 0xb3, 0x53, + 0x42, 0x01, 0xcf, 0xb1, 0xcd, 0x0d, + ], + ], + output: [ + 0xa1, 0x86, 0x2f, 0x7c, 0xa6, 0x16, 0xa3, 0x77, 0xe6, 0x01, 0x06, 0x89, 0x19, 0x20, + 0x3a, 0x0e, 0x06, 0xe9, 0xa9, 0x03, 0x93, 0xc4, 0x01, 0xa5, 0x9c, 0x55, 0x40, 0xe5, + 0xad, 0x2b, 0x0a, 0x00, + ], + }, + TestVector { + input: [ + [ + 0xbd, 0x69, 0xb8, 0x25, 0x32, 0xb6, 0x94, 0x0f, 0xf2, 0x59, 0x0f, 0x67, 0x9b, + 0xa9, 0xc7, 0x27, 0x1f, 0xe0, 0x1f, 0x7e, 0x9c, 0x8e, 0x36, 0xd6, 0xa5, 0xe2, + 0x9d, 0x4e, 0x30, 0xa7, 0x35, 0x14, + ], + [ + 0xbc, 0x50, 0x98, 0x42, 0x55, 0xd6, 0xaf, 0xbe, 0x9e, 0xf9, 0x28, 0x48, 0xed, + 0x5a, 0xc0, 0x08, 0x62, 0xc2, 0xfa, 0x7b, 0x2f, 0xec, 0xbc, 0xb6, 0x4b, 0x69, + 0x68, 0x91, 0x2a, 0x63, 0x81, 0x0e, + ], + ], + output: [ + 0x50, 0x25, 0xee, 0xb4, 0x24, 0x55, 0x4c, 0x39, 0xe8, 0xae, 0xf7, 0x00, 0xdd, 0xb8, + 0xb6, 0x1e, 0x20, 0xe6, 0x9f, 0xc2, 0x86, 0x69, 0xd6, 0x7b, 0xa6, 0x8e, 0x48, 0xdb, + 0x75, 0x2f, 0x7f, 0x14, + ], + }, + TestVector { + input: [ + [ + 0x3d, 0xc1, 0x66, 0xd5, 0x6a, 0x1d, 0x62, 0xf5, 0xa8, 0xd7, 0x55, 0x1d, 0xb5, + 0xfd, 0x93, 0x13, 0xe8, 0xc7, 0x20, 0x3d, 0x99, 0x6a, 0xf7, 0xd4, 0x77, 0x08, + 0x37, 0x56, 0xd5, 0x9a, 0xf8, 0x0d, + ], + [ + 0x05, 0xa7, 0x45, 0xf4, 0x5d, 0x7f, 0xf6, 0xdb, 0x10, 0xbc, 0x67, 0xfd, 0xf0, + 0xf0, 0x3e, 0xbf, 0x81, 0x30, 0xab, 0x33, 0x36, 0x26, 0x97, 0xb0, 0xe4, 0xe4, + 0xc7, 0x63, 0xcc, 0xb8, 0xf6, 0x36, + ], + ], + output: [ + 0x46, 0xd5, 0x2f, 0x0f, 0xde, 0xd6, 0x08, 0xb1, 0x90, 0x27, 0x28, 0x63, 0x7f, 0xdb, + 0x93, 0x51, 0xc2, 0x9c, 0xb1, 0x98, 0xc3, 0x48, 0x03, 0x8b, 0x0e, 0xf4, 0x6e, 0xbd, + 0x77, 0x16, 0x03, 0x33, + ], + }, + TestVector { + input: [ + [ + 0x49, 0x5c, 0x22, 0x2f, 0x7f, 0xba, 0x1e, 0x31, 0xde, 0xfa, 0x3d, 0x5a, 0x57, + 0xef, 0xc2, 0xe1, 0xe9, 0xb0, 0x1a, 0x03, 0x55, 0x87, 0xd5, 0xfb, 0x1a, 0x38, + 0xe0, 0x1d, 0x94, 0x90, 0x3d, 0x3c, + ], + [ + 0x3d, 0x0a, 0xd3, 0x36, 0x1f, 0xec, 0x09, 0x77, 0x90, 0xd9, 0xbe, 0x0e, 0x42, + 0x98, 0x8d, 0x7d, 0x25, 0xc9, 0xa1, 0x38, 0xf4, 0x9b, 0x1a, 0x53, 0x7e, 0xdc, + 0xf0, 0x4b, 0xe3, 0x4a, 0x98, 0x11, + ], + ], + output: [ + 0x7a, 0xee, 0xb4, 0xbd, 0x13, 0x6c, 0x7e, 0x32, 0x13, 0xf9, 0x4e, 0x39, 0x2b, 0x87, + 0xeb, 0xdc, 0x39, 0xb9, 0x1c, 0x02, 0x54, 0x96, 0x5b, 0xe6, 0x96, 0x69, 0x40, 0xe3, + 0xb0, 0x94, 0xc3, 0x16, + ], + }, + TestVector { + input: [ + [ + 0xa4, 0xaf, 0x9d, 0xb6, 0xd2, 0x7b, 0x50, 0x72, 0x83, 0x5f, 0x0c, 0x3e, 0x88, + 0x39, 0x5e, 0xd7, 0xa4, 0x1b, 0x00, 0x52, 0xad, 0x80, 0x84, 0xa8, 0xb9, 0xda, + 0x94, 0x8d, 0x32, 0x0d, 0xad, 0x16, + ], + [ + 0x4d, 0x54, 0x31, 0xe6, 0x43, 0x7d, 0x0b, 0x5b, 0xed, 0xbb, 0xcd, 0xaf, 0x34, + 0x5b, 0x86, 0xc4, 0x12, 0x1f, 0xc0, 0x0f, 0xe7, 0xf2, 0x35, 0x73, 0x42, 0x76, + 0xd3, 0x8d, 0x47, 0xf1, 0xe1, 0x11, + ], + ], + output: [ + 0xe3, 0x47, 0xad, 0x3f, 0x1f, 0x45, 0x68, 0x11, 0x15, 0x02, 0xe4, 0x0a, 0x62, 0x5a, + 0x63, 0xc4, 0xd1, 0x85, 0xd9, 0x28, 0x33, 0xff, 0xc7, 0x47, 0x13, 0x95, 0x0b, 0x2c, + 0xcf, 0x23, 0xa7, 0x08, + ], + }, + TestVector { + input: [ + [ + 0xdd, 0x0c, 0x7a, 0x1d, 0x81, 0x1c, 0x7d, 0x9c, 0xd4, 0x6d, 0x37, 0x7b, 0x3f, + 0xde, 0xab, 0x3f, 0xb6, 0x79, 0xf3, 0xdc, 0x60, 0x1d, 0x00, 0x82, 0x85, 0xed, + 0xcb, 0xda, 0xe6, 0x9c, 0xe8, 0x3c, + ], + [ + 0x19, 0xe4, 0xaa, 0xc0, 0x35, 0x90, 0x17, 0xec, 0x85, 0xa1, 0x83, 0xd2, 0x20, + 0x53, 0xdb, 0x33, 0xf7, 0x34, 0x76, 0xf2, 0x1a, 0x48, 0x2e, 0xc9, 0x37, 0x83, + 0x65, 0xc8, 0xf7, 0x39, 0x3c, 0x14, + ], + ], + output: [ + 0x4b, 0x8a, 0x3c, 0xfd, 0x9e, 0xa3, 0x0e, 0x27, 0x13, 0xf4, 0x24, 0xcf, 0x87, 0xaa, + 0x5a, 0x4f, 0xc8, 0x75, 0xdb, 0x9f, 0xed, 0x56, 0xe4, 0x48, 0x53, 0x40, 0xf6, 0x68, + 0x0e, 0x50, 0xf2, 0x25, + ], + }, + TestVector { + input: [ + [ + 0xe2, 0x88, 0x53, 0x15, 0xeb, 0x46, 0x71, 0x09, 0x8b, 0x79, 0x53, 0x5e, 0x79, + 0x0f, 0xe5, 0x3e, 0x29, 0xfe, 0xf2, 0xb3, 0x76, 0x66, 0x97, 0xac, 0x32, 0xb4, + 0xf4, 0x73, 0xf4, 0x68, 0xa0, 0x08, + ], + [ + 0xe6, 0x23, 0x89, 0xfc, 0x16, 0x57, 0xe0, 0xde, 0xf0, 0xb6, 0x32, 0xc6, 0xae, + 0x25, 0xf9, 0xf7, 0x83, 0xb2, 0x7d, 0xb5, 0x9a, 0x4a, 0x15, 0x3d, 0x88, 0x2d, + 0x2b, 0x21, 0x03, 0x59, 0x65, 0x15, + ], + ], + output: [ + 0xcd, 0xc9, 0x0c, 0x38, 0x24, 0x2f, 0xd9, 0xf4, 0x0d, 0x1e, 0x83, 0xca, 0xdd, 0x37, + 0x0d, 0x5a, 0xae, 0xa4, 0x91, 0x4b, 0x2c, 0x20, 0x9e, 0x8a, 0xc3, 0x0e, 0x97, 0x4e, + 0x97, 0x5f, 0xe0, 0x36, + ], + }, + TestVector { + input: [ + [ + 0xeb, 0x94, 0x94, 0xc6, 0xd2, 0x27, 0xe2, 0x16, 0x3b, 0x46, 0x99, 0xd9, 0x91, + 0xf4, 0x33, 0xbf, 0x94, 0x86, 0xa7, 0xaf, 0xcf, 0x4a, 0x0d, 0x9c, 0x73, 0x1e, + 0x98, 0x5d, 0x99, 0x58, 0x9c, 0x0b, + ], + [ + 0xb7, 0x38, 0xe8, 0xaa, 0x0a, 0x15, 0x26, 0xa5, 0xbd, 0xef, 0x61, 0x31, 0x20, + 0x37, 0x2e, 0x83, 0x1a, 0x20, 0xda, 0x8a, 0xba, 0x18, 0xd1, 0xdb, 0xeb, 0xbc, + 0x86, 0x2d, 0xed, 0x42, 0x43, 0x1e, + ], + ], + output: [ + 0xac, 0x31, 0xe3, 0x4c, 0xb3, 0x68, 0x69, 0x55, 0x29, 0x9d, 0xd3, 0x30, 0x4a, 0x1f, + 0x90, 0x27, 0xd9, 0x39, 0xa0, 0xe0, 0x85, 0xca, 0xac, 0xe1, 0x16, 0x19, 0x2d, 0xed, + 0x3e, 0xb0, 0x07, 0x38, + ], + }, + TestVector { + input: [ + [ + 0x91, 0x47, 0x69, 0x30, 0xe3, 0x38, 0x5c, 0xd3, 0xe3, 0x37, 0x9e, 0x38, 0x53, + 0xd9, 0x34, 0x67, 0xe0, 0x01, 0xaf, 0xa2, 0xfb, 0x8d, 0xc3, 0x43, 0x6d, 0x75, + 0xa4, 0xa6, 0xf2, 0x65, 0x72, 0x10, + ], + [ + 0x4b, 0x19, 0x22, 0x32, 0xec, 0xb9, 0xf0, 0xc0, 0x24, 0x11, 0xe5, 0x25, 0x96, + 0xbc, 0x5e, 0x90, 0x45, 0x7e, 0x74, 0x59, 0x39, 0xff, 0xed, 0xbd, 0x12, 0x86, + 0x3c, 0xe7, 0x1a, 0x02, 0xaf, 0x11, + ], + ], + output: [ + 0x9e, 0xe9, 0xcc, 0x52, 0x0f, 0xc6, 0xea, 0xc7, 0x7e, 0xf0, 0x03, 0x90, 0x26, 0xa9, + 0xe8, 0x21, 0x5e, 0x88, 0x92, 0x2c, 0x8e, 0x8e, 0x79, 0xfe, 0x00, 0xaa, 0xbe, 0x81, + 0x64, 0x14, 0x1b, 0x2a, + ], + }, + TestVector { + input: [ + [ + 0x7b, 0x41, 0x7a, 0xdb, 0x63, 0xb3, 0x71, 0x22, 0xa5, 0xbf, 0x62, 0xd2, 0x6f, + 0x1e, 0x7f, 0x26, 0x8f, 0xb8, 0x6b, 0x12, 0xb5, 0x6d, 0xa9, 0xc3, 0x82, 0x85, + 0x7d, 0xee, 0xcc, 0x40, 0xa9, 0x0d, + ], + [ + 0x5e, 0x29, 0x35, 0x39, 0x71, 0xb3, 0x49, 0x94, 0xb6, 0x21, 0xb0, 0xb2, 0x61, + 0xae, 0xb3, 0x78, 0x6d, 0xd9, 0x84, 0xd5, 0x67, 0xdb, 0x28, 0x57, 0xb9, 0x27, + 0xb7, 0xfa, 0xe2, 0xdb, 0x58, 0x31, + ], + ], + output: [ + 0xd5, 0x03, 0xb7, 0x39, 0xaa, 0x03, 0x29, 0x51, 0xfb, 0x9a, 0x3e, 0xec, 0x0b, 0x91, + 0xd3, 0x25, 0x18, 0x82, 0xa2, 0xda, 0x32, 0x8b, 0x31, 0x75, 0x20, 0xa7, 0x3c, 0x14, + 0x35, 0x31, 0x5c, 0x17, + ], + }, + ] +}