mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-11-02 12:27:02 +00:00
Various improvements to BLS implementation:
* Switch from rayon to crossbeam * Allow windows to be reused per batch exp * Allow batchexp to take vector by value * Allow access to thread-local engine context * Allow cloning of Engine * Clean up wNAF abstractions to reduce heap allocation
This commit is contained in:
@@ -24,7 +24,7 @@ fn test_multiexp<E: Engine, G: Group<E>>(e: &E) {
|
||||
let s: Vec<E::Fr> = (0..1000).map(|_| E::Fr::random(e, rng)).collect();
|
||||
|
||||
let naive = naiveexp::<E, G>(e, &g, &s);
|
||||
let multi = e.multiexp::<G>(&g, &s);
|
||||
let multi = e.multiexp::<G>(&g, &s).unwrap();
|
||||
|
||||
assert!(naive.is_equal(e, &multi));
|
||||
assert!(multi.is_equal(e, &naive));
|
||||
@@ -36,11 +36,19 @@ fn test_multiexp<E: Engine, G: Group<E>>(e: &E) {
|
||||
let s = vec![E::Fr::from_str(e, "3435973836800000000000000000000000").unwrap(), E::Fr::from_str(e, "3435973836700000000000000000000000").unwrap()];
|
||||
|
||||
let naive = naiveexp::<E, G>(e, &g, &s);
|
||||
let multi = e.multiexp::<G>(&g, &s);
|
||||
let multi = e.multiexp::<G>(&g, &s).unwrap();
|
||||
|
||||
assert!(naive.is_equal(e, &multi));
|
||||
assert!(multi.is_equal(e, &naive));
|
||||
}
|
||||
|
||||
{
|
||||
let rng = &mut rand::thread_rng();
|
||||
let s = vec![E::Fr::one(e); 100];
|
||||
let g = vec![G::random(e, rng).to_affine(e); 101];
|
||||
|
||||
assert!(e.multiexp::<G>(&g, &s).is_err());
|
||||
}
|
||||
}
|
||||
|
||||
fn test_bilinearity<E: Engine>(e: &E) {
|
||||
|
||||
Reference in New Issue
Block a user