mirror of https://github.com/zcash/orchard.git
Poseidon instructions
This commit is contained in:
parent
5d57bee562
commit
363e6944ec
|
@ -1 +1,2 @@
|
||||||
pub(crate) mod ecc;
|
pub(crate) mod ecc;
|
||||||
|
pub(crate) mod poseidon;
|
||||||
|
|
|
@ -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>;
|
||||||
|
}
|
Loading…
Reference in New Issue