Skip to main content

HashTreeRoot

Trait HashTreeRoot 

Source
pub trait HashTreeRoot {
    // Required method
    fn hash_tree_root<D: Digest<OutputSize = U32>>(&self) -> [u8; 32];
}
Expand description

Computes a 32-byte hash tree root for SSZ types.

Generic over the hash function so callers can plug in SHA-256, Blake2b, etc. Requires OutputSize = U32, i.e. a 32-byte digest.

Required Methods§

Source

fn hash_tree_root<D: Digest<OutputSize = U32>>(&self) -> [u8; 32]

Compute the hash tree root using D as the underlying hash.

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 HashTreeRoot for bool

Source§

fn hash_tree_root<D: Digest<OutputSize = U32>>(&self) -> [u8; 32]

Source§

impl HashTreeRoot for u8

Source§

fn hash_tree_root<D: Digest<OutputSize = U32>>(&self) -> [u8; 32]

Source§

impl HashTreeRoot for u16

Source§

fn hash_tree_root<D: Digest<OutputSize = U32>>(&self) -> [u8; 32]

Source§

impl HashTreeRoot for u32

Source§

fn hash_tree_root<D: Digest<OutputSize = U32>>(&self) -> [u8; 32]

Source§

impl HashTreeRoot for u64

Source§

fn hash_tree_root<D: Digest<OutputSize = U32>>(&self) -> [u8; 32]

Source§

impl HashTreeRoot for u128

Source§

fn hash_tree_root<D: Digest<OutputSize = U32>>(&self) -> [u8; 32]

Source§

impl HashTreeRoot for NonZeroU32

Source§

fn hash_tree_root<D: Digest<OutputSize = U32>>(&self) -> [u8; 32]

Source§

impl<A: HashTreeRoot, B: HashTreeRoot> HashTreeRoot for (A, B)

Source§

fn hash_tree_root<D: Digest<OutputSize = U32>>(&self) -> [u8; 32]

Source§

impl<K: HashTreeRoot + Ord + Encode, V: HashTreeRoot + Encode> HashTreeRoot for BTreeMap<K, V>

Source§

fn hash_tree_root<D: Digest<OutputSize = U32>>(&self) -> [u8; 32]

Source§

impl<T: HashTreeRoot + Encode> HashTreeRoot for Vec<T>

Source§

fn hash_tree_root<D: Digest<OutputSize = U32>>(&self) -> [u8; 32]

Source§

impl<T: HashTreeRoot> HashTreeRoot for Option<T>

Source§

fn hash_tree_root<D: Digest<OutputSize = U32>>(&self) -> [u8; 32]

Source§

impl<const N: usize> HashTreeRoot for [u8; N]

Source§

fn hash_tree_root<D: Digest<OutputSize = U32>>(&self) -> [u8; 32]

Source§

impl<const N: usize> HashTreeRoot for [u64; N]

Source§

fn hash_tree_root<D: Digest<OutputSize = U32>>(&self) -> [u8; 32]

Implementors§