diff options
Diffstat (limited to 'third_party/rust/prio/tests/discrete_gauss.rs')
-rw-r--r-- | third_party/rust/prio/tests/discrete_gauss.rs | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/third_party/rust/prio/tests/discrete_gauss.rs b/third_party/rust/prio/tests/discrete_gauss.rs index 5b3ef4c5b3..d72138b64c 100644 --- a/third_party/rust/prio/tests/discrete_gauss.rs +++ b/third_party/rust/prio/tests/discrete_gauss.rs @@ -4,7 +4,7 @@ use num_bigint::{BigInt, BigUint}; use num_rational::Ratio; use num_traits::FromPrimitive; use prio::dp::distributions::DiscreteGaussian; -use prio::vdaf::xof::SeedStreamSha3; +use prio::vdaf::xof::SeedStreamTurboShake128; use rand::distributions::Distribution; use rand::SeedableRng; use serde::Deserialize; @@ -12,7 +12,7 @@ use serde::Deserialize; /// A test vector of discrete Gaussian samples, produced by the python reference /// implementation for [[CKS20]]. The script used to generate the test vector can /// be found in this gist: -/// https://gist.github.com/ooovi/529c00fc8a7eafd068cd076b78fc424e +/// https://gist.github.com/divergentdave/94cab188e84a4764db6cdd1288e6ead3 /// The python reference implementation is here: /// https://github.com/IBM/discrete-gaussian-differential-privacy /// @@ -29,20 +29,15 @@ pub struct DiscreteGaussTestVector { #[test] fn discrete_gauss_reference() { let test_vectors: Vec<DiscreteGaussTestVector> = vec![ - serde_json::from_str(include_str!(concat!("test_vectors/discrete_gauss_3.json"))).unwrap(), - serde_json::from_str(include_str!(concat!("test_vectors/discrete_gauss_9.json"))).unwrap(), - serde_json::from_str(include_str!(concat!( - "test_vectors/discrete_gauss_100.json" - ))) - .unwrap(), - serde_json::from_str(include_str!(concat!( - "test_vectors/discrete_gauss_41293847.json" - ))) - .unwrap(), - serde_json::from_str(include_str!(concat!( + serde_json::from_str(include_str!("test_vectors/discrete_gauss_3.json")).unwrap(), + serde_json::from_str(include_str!("test_vectors/discrete_gauss_9.json")).unwrap(), + serde_json::from_str(include_str!("test_vectors/discrete_gauss_100.json")).unwrap(), + serde_json::from_str(include_str!("test_vectors/discrete_gauss_41293847.json")).unwrap(), + serde_json::from_str(include_str!( "test_vectors/discrete_gauss_9999999999999999999999.json" - ))) + )) .unwrap(), + serde_json::from_str(include_str!("test_vectors/discrete_gauss_2.342.json")).unwrap(), ]; for test_vector in test_vectors { @@ -53,7 +48,7 @@ fn discrete_gauss_reference() { .unwrap(); // check samples are consistent - let mut rng = SeedStreamSha3::from_seed(test_vector.seed); + let mut rng = SeedStreamTurboShake128::from_seed(test_vector.seed); let samples: Vec<BigInt> = (0..test_vector.samples.len()) .map(|_| sampler.sample(&mut rng)) .collect(); |