Skip to content

Commit

Permalink
Merge pull request #55 from vuvoth/export-hasher-chip
Browse files Browse the repository at this point in the history
Public a poseidon hasher chip
  • Loading branch information
kilic authored Jan 5, 2023
2 parents 52d5f25 + 52841ec commit 5bf79a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions transcript/src/hasher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct AssignedState<F: FieldExt, const T: usize>(pub(super) [AssignedValue<
/// `HasherChip` is basically responsible for contraining permutation part of
/// transcript pipeline
#[derive(Debug, Clone)]
pub(crate) struct HasherChip<
pub struct HasherChip<
F: FieldExt,
const NUMBER_OF_LIMBS: usize,
const BIT_LEN: usize,
Expand All @@ -33,7 +33,7 @@ impl<
> HasherChip<F, NUMBER_OF_LIMBS, BIT_LEN, T, RATE>
{
// Constructs new hasher chip with assigned initial state
pub(crate) fn new(
pub fn new(
// TODO: we can remove initial state assingment in construction
ctx: &mut RegionCtx<'_, F>,
spec: &Spec<F, T, RATE>,
Expand Down Expand Up @@ -71,7 +71,7 @@ impl<
> HasherChip<F, NUMBER_OF_LIMBS, BIT_LEN, T, RATE>
{
/// Construct main gate
pub(super) fn main_gate(&self) -> MainGate<F> {
pub fn main_gate(&self) -> MainGate<F> {
MainGate::<_>::new(self.main_gate_config.clone())
}

Expand Down Expand Up @@ -259,7 +259,7 @@ impl<
}

/// Constrains poseidon permutation while mutating the given state
pub(crate) fn permutation(
pub fn permutation(
&mut self,
ctx: &mut RegionCtx<'_, F>,
inputs: Vec<AssignedValue<F>>,
Expand Down Expand Up @@ -298,7 +298,7 @@ impl<
Ok(())
}

pub(crate) fn hash(&mut self, ctx: &mut RegionCtx<'_, F>) -> Result<AssignedValue<F>, Error> {
pub fn hash(&mut self, ctx: &mut RegionCtx<'_, F>) -> Result<AssignedValue<F>, Error> {
// Get elements to be hashed
let input_elements = self.absorbing.clone();
// Flush the input que
Expand Down
1 change: 1 addition & 0 deletions transcript/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ mod transcript;
pub use ecc;
pub use ecc::halo2;
pub use ecc::maingate;
pub use hasher::HasherChip;

pub use crate::transcript::*;

Expand Down

0 comments on commit 5bf79a8

Please sign in to comment.