Skip to content

Commit 7862950

Browse files
authored
k256: rename lincomb_generic to lincomb and expose it. (#955)
1 parent 8d3b67e commit 7862950

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

k256/src/arithmetic.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub(crate) mod scalar;
1212
mod dev;
1313

1414
pub use field::FieldElement;
15+
pub use mul::lincomb;
1516

1617
use self::{affine::AffinePoint, projective::ProjectivePoint, scalar::Scalar};
1718
use crate::Secp256k1;

k256/src/arithmetic/mul.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ fn static_zip_map<T: Copy, S: Copy, V: Copy, const N: usize>(
310310

311311
/// Calculates a linear combination `sum(x[i] * k[i])`, `i = 0..N`
312312
#[inline(always)]
313-
fn lincomb_generic<const N: usize>(xs: &[ProjectivePoint; N], ks: &[Scalar; N]) -> ProjectivePoint {
313+
pub fn lincomb<const N: usize>(xs: &[ProjectivePoint; N], ks: &[Scalar; N]) -> ProjectivePoint {
314314
let rs = static_map(
315315
|k| decompose_scalar(&k),
316316
ks,
@@ -429,7 +429,7 @@ impl MulByGenerator for ProjectivePoint {
429429

430430
#[inline(always)]
431431
fn mul(x: &ProjectivePoint, k: &Scalar) -> ProjectivePoint {
432-
lincomb_generic(&[*x], &[*k])
432+
lincomb(&[*x], &[*k])
433433
}
434434

435435
impl LinearCombination for ProjectivePoint {
@@ -439,7 +439,7 @@ impl LinearCombination for ProjectivePoint {
439439
y: &ProjectivePoint,
440440
l: &Scalar,
441441
) -> ProjectivePoint {
442-
lincomb_generic(&[*x, *y], &[*k, *l])
442+
lincomb(&[*x, *y], &[*k, *l])
443443
}
444444
}
445445

k256/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub mod test_vectors;
4444
pub use elliptic_curve::{self, bigint::U256};
4545

4646
#[cfg(feature = "arithmetic")]
47-
pub use arithmetic::{affine::AffinePoint, projective::ProjectivePoint, scalar::Scalar};
47+
pub use arithmetic::{affine::AffinePoint, lincomb, projective::ProjectivePoint, scalar::Scalar};
4848

4949
#[cfg(feature = "expose-field")]
5050
pub use arithmetic::FieldElement;

0 commit comments

Comments
 (0)