Trait risc0_zkp::core::sha::Sha

source ·
pub trait Sha: Clone + Debug {
    type DigestPtr: Deref<Target = Digest> + Debug;

    fn hash_bytes(&self, bytes: &[u8]) -> Self::DigestPtr;
    fn hash_raw_words(&self, words: &[u32]) -> Self::DigestPtr;
    fn compress(
        &self,
        state: &Digest,
        block_half1: &Digest,
        block_half2: &Digest
    ) -> Self::DigestPtr; fn hash_raw_pod_slice<T: Pod>(&self, slice: &[T]) -> Self::DigestPtr; fn mix(&self, pool: &mut Self::DigestPtr, val: &Digest); fn hash_words(&self, words: &[u32]) -> Self::DigestPtr { ... } fn hash_pair(&self, a: &Digest, b: &Digest) -> Self::DigestPtr { ... } }
Expand description

An implementation that provides SHA-256 hashing services.

Required Associated Types§

A pointer to the created digest.

This may either be a Box or some other pointer in case the implementation wants to manage its own memory.

Required Methods§

Generate a SHA from a slice of bytes, padding to block size and adding the SHA trailer.

Generate a SHA from a slice of words without adding padding or length.

Execute the sha256 “compress” operation. The block is specified as two half-blocks. Not all implementations provide this.

Generate a SHA from a slice of anything that can be represented as plain old data. Pads up to the Sha block boundry, but does not add the standard SHA trailer.

Generate a new digest by mixing two digests together via XOR, and storing into the first digest.

Provided Methods§

Generate a SHA from a slice of words, padding to block size and adding the SHA trailer.

Generate a SHA from a pair of Digests.

Implementors§