Poseidon instructions

This commit is contained in:
Jack Grigg 2021-01-29 14:26:52 +00:00
parent 5d57bee562
commit 363e6944ec
2 changed files with 23 additions and 0 deletions

View File

@ -1 +1,2 @@
pub(crate) mod ecc; pub(crate) mod ecc;
pub(crate) mod poseidon;

View File

@ -0,0 +1,22 @@
//! Gadget and chips for the Poseidon algebraic hash function.
use std::fmt;
use halo2::{
arithmetic::FieldExt,
circuit::{Chip, Layouter},
plonk::Error,
};
/// The set of circuit instructions required to use the [`Poseidon`] gadget.
pub trait PoseidonInstructions<F: FieldExt>: Chip<F> {
/// Variable representing the state over which the Poseidon permutation operates.
type State: fmt::Debug;
/// Applies the Poseidon permutation to the given state.
fn permute(
&self,
layouter: &mut impl Layouter<F>,
initial_state: &Self::State,
) -> Result<Self::State, Error>;
}