mirror of https://github.com/zcash/halo2.git
poseidon: Update code comments
Also fixes some clippy lints (public docs linking to private items). Co-authored-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
a64e2d64a8
commit
5948a4977a
|
@ -147,15 +147,15 @@ fn poseidon_sponge<F: FieldExt, S: Spec<F, T, RATE>, const T: usize, const RATE:
|
||||||
Squeezing(output)
|
Squeezing(output)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The state of the [`Sponge`].
|
/// The state of the `Sponge`.
|
||||||
// TODO: Seal this trait?
|
// TODO: Seal this trait?
|
||||||
pub trait SpongeMode {}
|
pub trait SpongeMode {}
|
||||||
|
|
||||||
/// The absorbing state of the [`Sponge`].
|
/// The absorbing state of the `Sponge`.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Absorbing<F, const RATE: usize>(pub(crate) SpongeRate<F, RATE>);
|
pub struct Absorbing<F, const RATE: usize>(pub(crate) SpongeRate<F, RATE>);
|
||||||
|
|
||||||
/// The squeezing state of the [`Sponge`].
|
/// The squeezing state of the `Sponge`.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Squeezing<F, const RATE: usize>(pub(crate) SpongeRate<F, RATE>);
|
pub struct Squeezing<F, const RATE: usize>(pub(crate) SpongeRate<F, RATE>);
|
||||||
|
|
||||||
|
@ -307,8 +307,8 @@ impl<F: FieldExt, const RATE: usize, const L: usize> Domain<F, RATE> for Constan
|
||||||
fn padding(input_len: usize) -> Self::Padding {
|
fn padding(input_len: usize) -> Self::Padding {
|
||||||
assert_eq!(input_len, L);
|
assert_eq!(input_len, L);
|
||||||
// For constant-input-length hashing, we pad the input with zeroes to a multiple
|
// For constant-input-length hashing, we pad the input with zeroes to a multiple
|
||||||
// of RATE. On its own this is not sponge-compliant padding, but the Poseidon
|
// of RATE. On its own this would not be sponge-compliant padding, but the
|
||||||
// authors instead encode the constant length into the capacity element, ensuring
|
// Poseidon authors encode the constant length into the capacity element, ensuring
|
||||||
// that inputs of different lengths do not share the same permutation.
|
// that inputs of different lengths do not share the same permutation.
|
||||||
let k = (L + RATE - 1) / RATE;
|
let k = (L + RATE - 1) / RATE;
|
||||||
iter::repeat(F::zero()).take(k * RATE - L)
|
iter::repeat(F::zero()).take(k * RATE - L)
|
||||||
|
|
Loading…
Reference in New Issue