Skip to content

Commit

Permalink
fix: use ec library instead of standard library (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored Nov 27, 2024
1 parent 7b459ce commit af7daa8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ authors = [""]
compiler_version = ">=0.37.0"

[dependencies]
ec = { tag = "v0.1.2", git = "https://github.com/noir-lang/ec" }
2 changes: 1 addition & 1 deletion src/lib.nr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mod scalar_field;
mod test;
mod bjj;

use crate::scalar_field::ScalarField;
pub use crate::scalar_field::ScalarField;

pub struct Curve<Params> {
x: Field,
Expand Down
8 changes: 4 additions & 4 deletions src/scalar_field.nr
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
///
/// N.B. ScalarField bit values are not constrained to be smaller than the TE curve group order.
/// ScalarField is used when performing scalar multiplications, where all operations wrap modulo the curve order
struct ScalarField<let N: u32> {
base4_slices: [u8; N],
skew: bool,
pub struct ScalarField<let N: u32> {
pub(crate) base4_slices: [u8; N],
pub(crate) skew: bool,
}

unconstrained fn get_wnaf_slices<let N: u32>(x: Field) -> ([u8; N], bool) {
Expand Down Expand Up @@ -148,7 +148,7 @@ impl<let N: u32> std::convert::Into<Field> for ScalarField<N> {

impl<let N: u32> ScalarField<N> {

fn new() -> Self {
pub fn new() -> Self {
Self { base4_slices: [0; N], skew: false }
}
fn get(self, idx: u64) -> u8 {
Expand Down
4 changes: 2 additions & 2 deletions src/test.nr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::bjj::BabyJubJubParams;
use crate::Curve;
use crate::scalar_field::ScalarField;
use std::ec::consts::te::baby_jubjub;
use std::ec::tecurve::affine::Point as TEPoint;

use ec::{consts::te::baby_jubjub, tecurve::affine::Point as TEPoint};

type BabyJubJub = Curve<BabyJubJubParams>;

Expand Down

0 comments on commit af7daa8

Please sign in to comment.