Enum winter_prover::HashFunction
source · pub enum HashFunction {
Blake3_192,
Blake3_256,
Sha3_256,
}
Expand description
Defines a set of available hash function for STARK protocol.
Choice of a hash function has a direct impact on proof generation time, proof size, and proof soundness. In general, sounds of the proof is bounded by the collision resistance of the hash function used by the protocol.
Variants
Blake3_192
BLAKE3 hash function with 192 bit output.
When this function is used in the STARK protocol, proof security cannot exceed 96 bits.
Blake3_256
BLAKE3 hash function with 256 bit output.
When this function is used in the STARK protocol, proof security cannot exceed 128 bits.
Sha3_256
SHA3 hash function with 256 bit output.
When this function is used in the STARK protocol, proof security cannot exceed 128 bits.
Implementations
sourceimpl HashFunction
impl HashFunction
sourcepub fn collision_resistance(&self) -> u32
pub fn collision_resistance(&self) -> u32
Returns collision resistance of this hash function in bits.
Trait Implementations
sourceimpl Clone for HashFunction
impl Clone for HashFunction
sourcefn clone(&self) -> HashFunction
fn clone(&self) -> HashFunction
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for HashFunction
impl Debug for HashFunction
sourceimpl Deserializable for HashFunction
impl Deserializable for HashFunction
sourcefn read_from<R>(source: &mut R) -> Result<HashFunction, DeserializationError>where
R: ByteReader,
fn read_from<R>(source: &mut R) -> Result<HashFunction, DeserializationError>where
R: ByteReader,
Reads a hash function enum from the specified source
.
sourcefn read_batch_from<R>(
source: &mut R,
num_elements: usize
) -> Result<Vec<Self, Global>, DeserializationError>where
R: ByteReader,
fn read_batch_from<R>(
source: &mut R,
num_elements: usize
) -> Result<Vec<Self, Global>, DeserializationError>where
R: ByteReader,
source
, attempts to deserialize these bytes
into a vector with the specified number of Self
elements, and returns the result. Read moresourceimpl PartialEq<HashFunction> for HashFunction
impl PartialEq<HashFunction> for HashFunction
sourcefn eq(&self, other: &HashFunction) -> bool
fn eq(&self, other: &HashFunction) -> bool
sourceimpl Serializable for HashFunction
impl Serializable for HashFunction
sourcefn write_into<W>(&self, target: &mut W)where
W: ByteWriter,
fn write_into<W>(&self, target: &mut W)where
W: ByteWriter,
Serializes self
and writes the resulting bytes into the target
.