Skip to content

Commit

Permalink
Merge branch 'master-update' into jonch/trinity/glv
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-chuang committed Oct 5, 2020
2 parents c0845fb + b1918e3 commit aa38655
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion algebra-core/src/curves/models/short_weierstrass_affine.rs
Expand Up @@ -7,7 +7,7 @@ macro_rules! specialise_affine_to_proj {
biginteger::BigInteger,
curves::batch_arith::{decode_endo_from_u32, ENDO_CODING_BITS},
};

#[derive(Derivative)]
#[derivative(
Copy(bound = "P: Parameters"),
Expand Down
38 changes: 21 additions & 17 deletions algebra/src/tests/curves.rs
Expand Up @@ -12,6 +12,10 @@ use rand::{
distributions::{Distribution, Uniform},
SeedableRng,
};
use rand::{
distributions::{Distribution, Uniform},
SeedableRng,
};
use rand_xorshift::XorShiftRng;

use std::ops::Neg;
Expand Down Expand Up @@ -527,23 +531,23 @@ macro_rules! batch_verify_test {
now.elapsed().as_micros()
);

// for j in 0..10 {
// // Randomly insert random non-subgroup elems
// for k in 0..(1 << j) {
// tmp_elems[random_location.sample(&mut rng)] = non_subgroup_points[k];
// }
// let now = std::time::Instant::now();
// match batch_verify_in_subgroup::<$GroupAffine<P>, XorShiftRng>(&tmp_elems[..], SECURITY_PARAM, &mut rng) {
// Ok(_) => assert!(false, "did not detect non-subgroup elems"),
// _ => assert!(true),
// };
// println!(
// "Success: Not in subgroup. n: {}, non-subgroup elems: {}, time: {}",
// n_elems,
// (1 << (j + 1)) - 1,
// now.elapsed().as_micros()
// );
// }
for j in 0..10 {
// Randomly insert random non-subgroup elems
for k in 0..(1 << j) {
tmp_elems[random_location.sample(&mut rng)] = non_subgroup_points[k];
}
let now = std::time::Instant::now();
match batch_verify_in_subgroup::<$GroupAffine<P>, XorShiftRng>(&tmp_elems[..], SECURITY_PARAM, &mut rng) {
Ok(_) => assert!(false, "did not detect non-subgroup elems"),
_ => assert!(true),
};
println!(
"Success: Not in subgroup. n: {}, non-subgroup elems: {}, time: {}",
n_elems,
(1 << (j + 1)) - 1,
now.elapsed().as_micros()
);
}
}

// // We can induce a collision and thus failure to identify non-subgroup elements with the following
Expand Down

0 comments on commit aa38655

Please sign in to comment.