Trait winter_crypto::Digest

source ·
pub trait Digest: Debug + Default + Copy + Clone + Eq + PartialEq + Send + Sync + Serializable + Deserializable {
    // Required method
    fn as_bytes(&self) -> [u8; 32];
}
Expand description

Defines output type for a cryptographic hash function.

Required Methods§

source

fn as_bytes(&self) -> [u8; 32]

Returns this digest serialized into an array of bytes.

Ideally, the length of the returned array should be defined by an associated constant, but using associated constants in const generics is not supported by Rust yet. Thus, we put an upper limit on the possible digest size. For digests which are smaller than 32 bytes, the unused bytes should be set to 0.

Object Safety§

This trait is not object safe.

Implementors§