-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Apply hash abstraction over aztec-nr (#2958)
- Loading branch information
1 parent
69c1d66
commit 52f01ae
Showing
31 changed files
with
118 additions
and
104 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
use dep::std::hash; | ||
use crate::constants_gen::GENERATOR_INDEX__CONTRACT_ADDRESS; | ||
use crate::hash::pedersen_hash; | ||
|
||
pub fn compute_address(pub_key_x: Field, pub_key_y: Field, partial_address: Field) -> Field { | ||
hash::pedersen_with_separator([pub_key_x, pub_key_y, partial_address], GENERATOR_INDEX__CONTRACT_ADDRESS)[0] | ||
pedersen_hash([pub_key_x, pub_key_y, partial_address], GENERATOR_INDEX__CONTRACT_ADDRESS) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
use dep::std::hash::{pedersen, pedersen_with_separator}; | ||
use crate::hash::pedersen_hash; | ||
use crate::constants_gen::{GENERATOR_INDEX__UNIQUE_COMMITMENT, GENERATOR_INDEX__SILOED_COMMITMENT}; | ||
|
||
pub fn compute_inner_hash(storage_slot: Field, note_hash: Field) -> Field { | ||
// TODO(#1205) Do we need a generator index here? | ||
pedersen([storage_slot, note_hash])[0] | ||
pedersen_hash([storage_slot, note_hash],0) | ||
} | ||
|
||
pub fn compute_siloed_hash(contract_address: Field, inner_note_hash: Field) -> Field { | ||
let inputs = [contract_address, inner_note_hash]; | ||
pedersen_with_separator(inputs, GENERATOR_INDEX__SILOED_COMMITMENT)[0] | ||
pedersen_hash(inputs, GENERATOR_INDEX__SILOED_COMMITMENT) | ||
} | ||
|
||
pub fn compute_unique_hash(nonce: Field, siloed_note_hash: Field) -> Field { | ||
let inputs = [nonce, siloed_note_hash]; | ||
pedersen_with_separator(inputs, GENERATOR_INDEX__UNIQUE_COMMITMENT)[0] | ||
pedersen_hash(inputs, GENERATOR_INDEX__UNIQUE_COMMITMENT) | ||
} |
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
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.