group: Take scalar by reference in CurveProjective::recommended_wnaf_for_scalar
This commit is contained in:
parent
97c21e0c1a
commit
6e53cf3c4c
|
@ -423,7 +423,7 @@ impl CurveProjective for Fr {
|
|||
*self
|
||||
}
|
||||
|
||||
fn recommended_wnaf_for_scalar(_: <Self::Scalar as PrimeField>::Repr) -> usize {
|
||||
fn recommended_wnaf_for_scalar(_: &<Self::Scalar as PrimeField>::Repr) -> usize {
|
||||
3
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ pub trait CurveProjective:
|
|||
|
||||
/// Recommends a wNAF window table size given a scalar. Always returns a number
|
||||
/// between 2 and 22, inclusive.
|
||||
fn recommended_wnaf_for_scalar(scalar: <Self::Scalar as PrimeField>::Repr) -> usize;
|
||||
fn recommended_wnaf_for_scalar(scalar: &<Self::Scalar as PrimeField>::Repr) -> usize;
|
||||
|
||||
/// Recommends a wNAF window size given the number of scalars you intend to multiply
|
||||
/// a base by. Always returns a number between 2 and 22, inclusive.
|
||||
|
|
|
@ -115,7 +115,7 @@ impl<G: CurveProjective> Wnaf<(), Vec<G>, Vec<i64>> {
|
|||
scalar: <<G as CurveProjective>::Scalar as PrimeField>::Repr,
|
||||
) -> Wnaf<usize, &mut Vec<G>, &[i64]> {
|
||||
// Compute the appropriate window size for the scalar.
|
||||
let window_size = G::recommended_wnaf_for_scalar(scalar);
|
||||
let window_size = G::recommended_wnaf_for_scalar(&scalar);
|
||||
|
||||
// Compute the wNAF form of the scalar.
|
||||
wnaf_form(&mut self.scalar, scalar, window_size);
|
||||
|
|
|
@ -674,7 +674,7 @@ macro_rules! curve_impl {
|
|||
(*self).into()
|
||||
}
|
||||
|
||||
fn recommended_wnaf_for_scalar(scalar: <Self::Scalar as PrimeField>::Repr) -> usize {
|
||||
fn recommended_wnaf_for_scalar(scalar: &<Self::Scalar as PrimeField>::Repr) -> usize {
|
||||
Self::empirical_recommended_wnaf_for_scalar(scalar)
|
||||
}
|
||||
|
||||
|
@ -1014,7 +1014,7 @@ pub mod g1 {
|
|||
}
|
||||
|
||||
impl G1 {
|
||||
fn empirical_recommended_wnaf_for_scalar(scalar: FrRepr) -> usize {
|
||||
fn empirical_recommended_wnaf_for_scalar(scalar: &FrRepr) -> usize {
|
||||
let num_bits = scalar.num_bits() as usize;
|
||||
|
||||
if num_bits >= 130 {
|
||||
|
@ -1733,7 +1733,7 @@ pub mod g2 {
|
|||
}
|
||||
|
||||
impl G2 {
|
||||
fn empirical_recommended_wnaf_for_scalar(scalar: FrRepr) -> usize {
|
||||
fn empirical_recommended_wnaf_for_scalar(scalar: &FrRepr) -> usize {
|
||||
let num_bits = scalar.num_bits() as usize;
|
||||
|
||||
if num_bits >= 103 {
|
||||
|
|
Loading…
Reference in New Issue