Skip to content

Commit

Permalink
chore(stdlib)!: Rename fixed_base_scalar_mul to be more descriptive (
Browse files Browse the repository at this point in the history
…#2488)

Co-authored-by: Tom French <[email protected]>
Co-authored-by: Maxim Vezenov <[email protected]>
  • Loading branch information
3 people authored Sep 4, 2023
1 parent 1d9bcd0 commit 6efc007
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ fn main(x: Field) {
let bytes = x.to_be_bytes(32);

let hash = std::hash::pedersen([x]);
let _p1 = std::scalar_mul::fixed_base(x);
let _p1 = std::scalar_mul::fixed_base_embedded_curve(x);

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ unconstrained fn main(
pub_x = b_pub_x;
pub_y = b_pub_y;
}
let res = std::scalar_mul::fixed_base(priv_key);
let res = std::scalar_mul::fixed_base_embedded_curve(priv_key);
assert(res[0] == pub_x);
assert(res[1] == pub_y);
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn main(
pub_x = b_pub_x;
pub_y = b_pub_y;
}
let res = std::scalar_mul::fixed_base(priv_key);
let res = std::scalar_mul::fixed_base_embedded_curve(priv_key);
assert(res[0] == pub_x);
assert(res[1] == pub_y);
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn main(
to_pubkey_y: Field,
) -> pub [Field; 2] {
// Compute public key from private key to show ownership
let pubkey = std::scalar_mul::fixed_base(priv_key);
let pubkey = std::scalar_mul::fixed_base_embedded_curve(priv_key);
let pubkey_x = pubkey[0];
let pubkey_y = pubkey[1];

Expand Down
8 changes: 7 additions & 1 deletion noir_stdlib/src/scalar_mul.nr
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
// Computes a fixed base scalar multiplication over the embedded curve.
// For bn254, We have Grumpkin and Baby JubJub.
// For bls12-381, we have JubJub and Bandersnatch.
//
// The embedded curve being used is decided by the
// underlying proof system.
#[foreign(fixed_base_scalar_mul)]
fn fixed_base(_input : Field) -> [Field; 2] {}
fn fixed_base_embedded_curve(_input : Field) -> [Field; 2] {}

0 comments on commit 6efc007

Please sign in to comment.