Skip to content

Commit

Permalink
chore: add SecretAndHash struct (#11293)
Browse files Browse the repository at this point in the history
Resolves #7921
  • Loading branch information
sklppy88 authored Jan 29, 2025
1 parent 13863eb commit f7da324
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions noir-projects/aztec-nr/aztec/src/utils/mod.nr
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ pub mod comparison;
pub mod field;
pub mod point;
pub mod to_bytes;
pub mod secrets;
14 changes: 14 additions & 0 deletions noir-projects/aztec-nr/aztec/src/utils/secrets.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use crate::{hash::compute_secret_hash, oracle::random::random};

pub struct SecretAndHash {
secret: Field,
hash: Field,
}

impl SecretAndHash {
unconstrained fn random() -> Self {
let secret = random();
let hash = compute_secret_hash(secret);
SecretAndHash { secret, hash }
}
}

0 comments on commit f7da324

Please sign in to comment.