Trait HashUtils

Source
pub trait HashUtils<U: AsRef<[u8]>> {
    // Required methods
    fn hash_empty(self) -> U;
    fn hash_leaf<T>(self, bytes: &T) -> U
       where T: Hashable;
    fn hash_nodes<T>(self, left: &T, right: &T) -> U
       where T: Hashable;
}
Expand description

The sole purpose of this trait is to extend the standard ring::algo::Algorithm type with a couple utility functions.

Required Methods§

Source

fn hash_empty(self) -> U

Compute the hash of the empty string

Source

fn hash_leaf<T>(self, bytes: &T) -> U
where T: Hashable,

Compute the hash of the given leaf

Source

fn hash_nodes<T>(self, left: &T, right: &T) -> U
where T: Hashable,

Compute the hash of the concatenation of left and right.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<H: From<[u8; 32]> + AsRef<[u8]>> HashUtils<H> for Sha3

Source§

fn hash_empty(self) -> H

Source§

fn hash_leaf<T>(self, bytes: &T) -> H
where T: Hashable,

Source§

fn hash_nodes<T>(self, left: &T, right: &T) -> H
where T: Hashable,

Implementors§