pub struct Tip5 {
pub state: [BFieldElement; 16],
}
Fields§
§state: [BFieldElement; 16]
Implementations§
Source§impl Tip5
impl Tip5
pub const fn new(domain: Domain) -> Self
pub const fn offset_fermat_cube_map(x: u16) -> u16
pub fn permutation(&mut self)
Sourcepub fn trace(&mut self) -> [[BFieldElement; 16]; 6]
pub fn trace(&mut self) -> [[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 hash<T: BFieldCodec>(value: &T) -> Digest
fn hash<T: BFieldCodec>(value: &T) -> Digest
Thin wrapper around
hash_varlen
.Source§fn hash_varlen(input: &[BFieldElement]) -> Digest
fn hash_varlen(input: &[BFieldElement]) -> Digest
Hash a variable-length sequence of
BFieldElement
. Read moreSource§fn sample_indices(&mut self, upper_bound: u32, num_indices: usize) -> Vec<u32>
fn sample_indices(&mut self, upper_bound: u32, num_indices: usize) -> Vec<u32>
Produce
num_indices
random integer values in the range [0, upper_bound)
. The
upper_bound
must be a power of 2. Read moreSource§fn sample_scalars(&mut self, num_elements: usize) -> Vec<XFieldElement>
fn sample_scalars(&mut self, num_elements: usize) -> Vec<XFieldElement>
Source§impl<'arbitrary> Arbitrary<'arbitrary> for Tip5
impl<'arbitrary> Arbitrary<'arbitrary> for Tip5
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of
Self
from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of
Self
from the entirety of the given
unstructured data. Read moreSource§impl BFieldCodec for Tip5
impl BFieldCodec for Tip5
type Error = Tip5BFieldDecodingError
fn decode(sequence: &[BFieldElement]) -> Result<Box<Self>, Self::Error>
fn encode(&self) -> Vec<BFieldElement>
Source§fn static_length() -> Option<usize>
fn static_length() -> Option<usize>
Returns the length in number of BFieldElements if it is known at compile-time.
Otherwise, None.
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_heap_size(&self) -> usize
fn get_heap_size(&self) -> usize
Determines how many bytes this object occupies inside the heap. Read more
Source§fn get_stack_size() -> usize
fn get_stack_size() -> usize
Determines how may bytes this object occupies inside the stack. Read more
impl Eq for Tip5
impl StructuralPartialEq for Tip5
Auto Trait Implementations§
impl Freeze for Tip5
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more