//! Gadget and chips for the Poseidon algebraic hash function. use std::fmt; use halo2::{ arithmetic::FieldExt, circuit::{Chip, Layouter}, plonk::Error, }; mod pow5t3; pub use pow5t3::{Pow5T3Chip, Pow5T3Config}; use crate::primitives::poseidon::{Spec, State}; /// The set of circuit instructions required to use the Poseidon permutation. pub trait PoseidonInstructions, const T: usize, const RATE: usize>: Chip { /// Variable representing the word over which the Poseidon permutation operates. type Word: fmt::Debug; /// Applies the Poseidon permutation to the given state. fn permute( &self, layouter: &mut impl Layouter, initial_state: &State, ) -> Result, Error>; }