pub struct HashFunction { /* private fields */ }Expand description
A hash function that is used in Starknet.
Implementations§
Source§impl HashFunction
impl HashFunction
Sourcepub fn stateful(&self) -> StatefulHasher
pub fn stateful(&self) -> StatefulHasher
Creates a new stateful hasher with chosen hash function.
Sourcepub fn poseidon() -> HashFunction
pub fn poseidon() -> HashFunction
Creates a new Poseidon hash function.
Sourcepub fn blake2s() -> HashFunction
pub fn blake2s() -> HashFunction
Creates a new Blake2s hash function.
Sourcepub fn hash(&self, x: Felt, y: Felt) -> Felt
pub fn hash(&self, x: Felt, y: Felt) -> Felt
Computes the Starknet Poseidon hash of x and y with chosen hash function.
Sourcepub fn hash_single(&self, input: Felt) -> Felt
pub fn hash_single(&self, input: Felt) -> Felt
Computes the Starknet hash of a single Felt with chosen hash function.
Trait Implementations§
Source§impl Clone for HashFunction
impl Clone for HashFunction
Source§fn clone(&self) -> HashFunction
fn clone(&self) -> HashFunction
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HashFunction
impl Debug for HashFunction
Source§impl PartialEq for HashFunction
impl PartialEq for HashFunction
impl Copy for HashFunction
impl Eq for HashFunction
impl StructuralPartialEq for HashFunction
Auto Trait Implementations§
impl Freeze for HashFunction
impl RefUnwindSafe for HashFunction
impl Send for HashFunction
impl Sync for HashFunction
impl Unpin for HashFunction
impl UnwindSafe for HashFunction
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.