Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

Split permutation from sponge construction #30

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Oct 19, 2021

  1. Split permutation from sponge construction

    Work towards #29; this doesn't touch the constraint system implementation yet,
    in order to be able to get design feedback on the software part.
    
    - The `poseidon::PoseidonParameters` struct is renamed to `poseidon::Parameters`
    but otherwise remains unchanged.
    
    - The `poseidon::PoseidonSpongeState` struct is renamed to `poseidon::State`
      and redefined to hold just the state itself, as well as the parameters needed
    to run the permutation.  It exposes a `permute(&mut self)` method, `rate()` and
    `capacity()` accessors, as well as `Index`, `IndexMut`, `AsRef`, and `AsMut`
    impls that allow access to the state.
    
    - The `poseidon::PoseidonSponge` struct is renamed to `poseidon::Sponge` and
      holds a `State` and a `DuplexSpongeMode`.  In other words, it consists of the
    state, together with the extra data tracking how that state is being used to
    implement a higher-level duplex construction.
    
    - The `CryptographicSponge` trait is changed so that `new()` takes an owned,
      `Self::Parameters`, not a borrowed one.  This allows the caller to decide
    where to copy data, instead of forcing the sponge implementation to clone
    internally.  Or, a `CryptographicSponge` implementation could declare the
    associated `Parameters` type to be some shared type (like an `Arc` wrapper)
    that avoids the need to copy at all.
    
    - The `SpongeExt` trait that allows converting back and forth between a state
      and a sponge is deleted; it's not safe to pass between abstraction layers
    that way.
    hdevalence committed Oct 19, 2021
    Configuration menu
    Copy the full SHA
    a5468be View commit details
    Browse the repository at this point in the history

Commits on Oct 21, 2021

  1. fix no_std compile errors with review suggestions

    Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
    hdevalence and Pratyush authored Oct 21, 2021
    Configuration menu
    Copy the full SHA
    d82203c View commit details
    Browse the repository at this point in the history