Struct twenty_first::shared_math::tip5::Tip5
source · pub struct Tip5 {}
Implementations§
source§impl Tip5
impl Tip5
pub const fn offset_fermat_cube_map(x: u16) -> u16
sourcepub fn trace(sponge: &mut Tip5State) -> [[BFieldElement; 16]; 6]
pub fn trace(sponge: &mut Tip5State) -> [[BFieldElement; 16]; 6]
Functionally equivalent to permutation
. Returns the trace of
applying the permutation; that is, the initial state of the sponge as well as its state
after each round.
sourcepub fn hash_10(input: &[BFieldElement; 10]) -> [BFieldElement; 5]
pub fn hash_10(input: &[BFieldElement; 10]) -> [BFieldElement; 5]
hash_10 Hash 10 elements, or two digests. There is no padding because the input length is fixed.
Trait Implementations§
source§impl AlgebraicHasher for Tip5
impl AlgebraicHasher for Tip5
source§fn sample_scalars(
state: &mut Self::SpongeState,
num_elements: usize
) -> Vec<XFieldElement>
fn sample_scalars( state: &mut Self::SpongeState, num_elements: usize ) -> Vec<XFieldElement>
Produce num_elements
random XFieldElement values.
- The randomness depends on
state
.
Since RATE is not divisible by EXTENSION_DEGREE, produce as many XFieldElement per
squeeze
as possible, and spill the remaining element(s). This causes some internal
fragmentation, but it greatly simplifies building [AlgebraicHasher::sample_xfield()] on
Triton VM.
source§fn hash_varlen(input: &[BFieldElement]) -> Digest
fn hash_varlen(input: &[BFieldElement]) -> Digest
Hash a variable-length sequence of BFieldElement. Read more
source§fn sample_indices(
state: &mut Self::SpongeState,
upper_bound: u32,
num_indices: usize
) -> Vec<u32>
fn sample_indices( state: &mut Self::SpongeState, upper_bound: u32, num_indices: usize ) -> Vec<u32>
source§impl BFieldCodec for Tip5
impl BFieldCodec for Tip5
source§impl<'de> Deserialize<'de> for Tip5
impl<'de> Deserialize<'de> for Tip5
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl GetSize for Tip5
impl GetSize for Tip5
source§fn get_stack_size() -> usize
fn get_stack_size() -> usize
Determines how may bytes this object occupies inside the stack. Read more
source§fn get_heap_size(&self) -> usize
fn get_heap_size(&self) -> usize
Determines how many bytes this object occupies inside the heap. Read more
source§impl PartialEq<Tip5> for Tip5
impl PartialEq<Tip5> for Tip5
source§impl SpongeHasher for Tip5
impl SpongeHasher for Tip5
const RATE: usize = 10usize
type SpongeState = Tip5State
source§fn init() -> Self::SpongeState
fn init() -> Self::SpongeState
Initialize a sponge state
source§fn absorb(sponge: &mut Self::SpongeState, input: &[BFieldElement; 10])
fn absorb(sponge: &mut Self::SpongeState, input: &[BFieldElement; 10])
Absorb an array of RATE field elements into the sponge’s state, mutating it.
source§fn squeeze(sponge: &mut Self::SpongeState) -> [BFieldElement; 10]
fn squeeze(sponge: &mut Self::SpongeState) -> [BFieldElement; 10]
Squeeze an array of RATE field elements out from the sponge’s state, mutating it.
source§fn absorb_repeatedly<'a, I>(sponge: &mut Self::SpongeState, input: I)where
I: Iterator<Item = &'a BFieldElement>,
fn absorb_repeatedly<'a, I>(sponge: &mut Self::SpongeState, input: I)where I: Iterator<Item = &'a BFieldElement>,
impl Eq for Tip5
impl StructuralEq for Tip5
impl StructuralPartialEq for Tip5
Auto Trait Implementations§
impl RefUnwindSafe for Tip5
impl Send for Tip5
impl Sync for Tip5
impl Unpin for Tip5
impl UnwindSafe for Tip5
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more