Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose poseidon internals #6491

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions noir_stdlib/src/hash/poseidon2.nr
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl Poseidon2 {
}
}

pub(crate) fn new(iv: Field) -> Poseidon2 {
pub fn new(iv: Field) -> Poseidon2 {
let mut result =
Poseidon2 { cache: [0; 3], state: [0; 4], cache_size: 0, squeeze_mode: false };
result.state[RATE] = iv;
Expand All @@ -39,7 +39,7 @@ impl Poseidon2 {
self.state = crate::hash::poseidon2_permutation(self.state, 4);
}

fn absorb(&mut self, input: Field) {
pub fn absorb(&mut self, input: Field) {
assert(!self.squeeze_mode);
if self.cache_size == RATE {
// If we're absorbing, and the cache is full, apply the sponge permutation to compress the cache
Expand All @@ -53,7 +53,7 @@ impl Poseidon2 {
}
}

fn squeeze(&mut self) -> Field {
pub fn squeeze(&mut self) -> Field {
assert(!self.squeeze_mode);
// If we're in absorb mode, apply sponge permutation to compress the cache.
self.perform_duplex();
Expand Down
Loading