mirror of
https://github.com/saymrwulf/pasta_curves-source.git
synced 2026-09-04 20:03:39 +00:00
Merge pull request #15 from zcash/wnaf-group
Enable Pasta curve elements to be used with `group::Wnaf`
This commit is contained in:
commit
b786a0c488
1 changed files with 19 additions and 0 deletions
|
|
@ -96,6 +96,25 @@ macro_rules! new_curve_impl {
|
|||
}
|
||||
}
|
||||
|
||||
impl group::WnafGroup for $name {
|
||||
fn recommended_wnaf_for_num_scalars(num_scalars: usize) -> usize {
|
||||
// Copied from bls12_381::g1, should be updated.
|
||||
const RECOMMENDATIONS: [usize; 12] =
|
||||
[1, 3, 7, 20, 43, 120, 273, 563, 1630, 3128, 7933, 62569];
|
||||
|
||||
let mut ret = 4;
|
||||
for r in &RECOMMENDATIONS {
|
||||
if num_scalars > *r {
|
||||
ret += 1;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ret
|
||||
}
|
||||
}
|
||||
|
||||
impl CurveExt for $name {
|
||||
type ScalarExt = $scalar;
|
||||
type Base = $base;
|
||||
|
|
|
|||
Loading…
Reference in a new issue