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§
Required Methods§
sourcefn hash_bytes(&self, bytes: &[u8]) -> Self::DigestPtr
fn hash_bytes(&self, bytes: &[u8]) -> Self::DigestPtr
Generate a SHA from a slice of bytes, padding to block size and adding the SHA trailer.
sourcefn hash_raw_words(&self, words: &[u32]) -> Self::DigestPtr
fn hash_raw_words(&self, words: &[u32]) -> Self::DigestPtr
Generate a SHA from a slice of words without adding padding or length.
sourcefn compress(
&self,
state: &Digest,
block_half1: &Digest,
block_half2: &Digest
) -> Self::DigestPtr
fn compress(
&self,
state: &Digest,
block_half1: &Digest,
block_half2: &Digest
) -> Self::DigestPtr
Execute the sha256 “compress” operation. The block is specified as two half-blocks. Not all implementations provide this.
sourcefn hash_raw_pod_slice<T: Pod>(&self, slice: &[T]) -> Self::DigestPtr
fn hash_raw_pod_slice<T: Pod>(&self, slice: &[T]) -> Self::DigestPtr
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.
Provided Methods§
sourcefn hash_words(&self, words: &[u32]) -> Self::DigestPtr
fn hash_words(&self, words: &[u32]) -> Self::DigestPtr
Generate a SHA from a slice of words, padding to block size and adding the SHA trailer.