-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git subrepo pull --force noir/noir-repo
subrepo: subdir: "noir/noir-repo" merged: "f2f8ecc833" upstream: origin: "https://github.com/noir-lang/noir" branch: "master" commit: "f2f8ecc833" git-subrepo: version: "0.4.6" origin: "???" commit: "???"
- Loading branch information
1 parent
b77204a
commit 64a16e2
Showing
88 changed files
with
1,388 additions
and
2,024 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
58e15edf7fd3d32267b0aed883fc84f6cee327c9 | ||
12af650f0d27c37dca06bb329bf76a5574534d78 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,4 @@ | ||
#!/usr/bin/env bash | ||
set -eu | ||
|
||
if [ command -v cargo-binstall &> /dev/null ]; then | ||
cargo-binstall cargo-binstall -y | ||
else | ||
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash | ||
fi | ||
|
||
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
noir/noir-repo/acvm-repo/acvm/src/pwg/blackbox/pedersen.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
use acir::{ | ||
circuit::opcodes::FunctionInput, | ||
native_types::{Witness, WitnessMap}, | ||
AcirField, | ||
}; | ||
|
||
use crate::{ | ||
pwg::{insert_value, witness_to_value, OpcodeResolutionError}, | ||
BlackBoxFunctionSolver, | ||
}; | ||
|
||
pub(super) fn pedersen<F: AcirField>( | ||
backend: &impl BlackBoxFunctionSolver<F>, | ||
initial_witness: &mut WitnessMap<F>, | ||
inputs: &[FunctionInput], | ||
domain_separator: u32, | ||
outputs: (Witness, Witness), | ||
) -> Result<(), OpcodeResolutionError<F>> { | ||
let scalars: Result<Vec<_>, _> = | ||
inputs.iter().map(|input| witness_to_value(initial_witness, input.witness)).collect(); | ||
let scalars: Vec<_> = scalars?.into_iter().cloned().collect(); | ||
|
||
let (res_x, res_y) = backend.pedersen_commitment(&scalars, domain_separator)?; | ||
|
||
insert_value(&outputs.0, res_x, initial_witness)?; | ||
insert_value(&outputs.1, res_y, initial_witness)?; | ||
|
||
Ok(()) | ||
} | ||
|
||
pub(super) fn pedersen_hash<F: AcirField>( | ||
backend: &impl BlackBoxFunctionSolver<F>, | ||
initial_witness: &mut WitnessMap<F>, | ||
inputs: &[FunctionInput], | ||
domain_separator: u32, | ||
output: Witness, | ||
) -> Result<(), OpcodeResolutionError<F>> { | ||
let scalars: Result<Vec<_>, _> = | ||
inputs.iter().map(|input| witness_to_value(initial_witness, input.witness)).collect(); | ||
let scalars: Vec<_> = scalars?.into_iter().cloned().collect(); | ||
|
||
let res = backend.pedersen_hash(&scalars, domain_separator)?; | ||
|
||
insert_value(&output, res, initial_witness)?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.