Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed Jul 18, 2024
1 parent 101f375 commit a0e9158
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
3 changes: 0 additions & 3 deletions noir/noir-repo/noir_stdlib/src/embedded_curve_ops.nr
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@ fn multi_scalar_mul_array_return<let N: u32>(points: [EmbeddedCurvePoint; N], sc
#[foreign(multi_scalar_mul)]
pub(crate) fn multi_scalar_mul_slice(points: [EmbeddedCurvePoint], scalars: [EmbeddedCurveScalar]) -> [Field; 3] {}

#[foreign(multi_scalar_mul)]
pub(crate) fn multi_scalar_mul_slice(points: [EmbeddedCurvePoint], scalars: [EmbeddedCurveScalar]) -> [Field; 3] {}

// docs:start:fixed_base_scalar_mul
pub fn fixed_base_scalar_mul(scalar: EmbeddedCurveScalar) -> EmbeddedCurvePoint
// docs:end:fixed_base_scalar_mul
Expand Down
16 changes: 15 additions & 1 deletion noir/noir-repo/noir_stdlib/src/hash/mod.nr
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@ pub fn pedersen_commitment<let N: u32>(input: [Field; N]) -> EmbeddedCurvePoint
}

fn pedersen_commitment_with_separator<let N: u32>(input: [Field; N], separator: u32) -> EmbeddedCurvePoint {
let mut points = [EmbeddedCurveScalar { lo: 0, hi: 0 }; N];
let value = __pedersen_commitment_with_separator(input, separator);
if (value[0] == 0) & (value[1] == 0) {
EmbeddedCurvePoint { x: 0, y: 0, is_infinite: true }
} else {
EmbeddedCurvePoint { x: value[0], y: value[1], is_infinite: false }
}
}

fn pedersen_commitment_with_separator_noir<let N: u32>(input: [Field; N], separator: u32) -> EmbeddedCurvePoint {let mut points = [EmbeddedCurveScalar { lo: 0, hi: 0 }; N];
for i in 0..N {
// we use the unsafe version because the multi_scalar_mul will constraint the scalars.
points[i] = from_field_unsafe(input[i]);
Expand Down Expand Up @@ -64,6 +72,12 @@ pub fn pedersen_hash<let N: u32>(input: [Field; N]) -> Field
__pedersen_hash_with_separator(input, 0)
}

#[foreign(pedersen_hash)]
pub fn __pedersen_hash_with_separator<let N: u32>(input: [Field; N], separator: u32) -> Field {}

#[foreign(pedersen_commitment)]
fn __pedersen_commitment_with_separator<let N: u32>(input: [Field; N], separator: u32) -> [Field; 2] {}

#[field(bn254)]
fn derive_generators<let N: u32, let M: u32>(domain_separator_bytes: [u8; M], starting_index: u32) -> [EmbeddedCurvePoint; N] {
crate::assert_constant(domain_separator_bytes);
Expand Down

0 comments on commit a0e9158

Please sign in to comment.