NamespacedHash

Type Alias NamespacedHash 

Source
pub type NamespacedHash = NamespacedHash<NS_SIZE>;
Expand description

Hash that carries info about minimum and maximum Namespace of the hashed data.

NamespacedHash can represent leaves or internal nodes of the Nmt.

If it is a hash of a leaf, then it will be constructed like so:

leaf_namespace | leaf_namespace | Sha256(0x00 | leaf_namespace | data)

If it is a hash of its children nodes, then it will be constructed like so:

min_namespace | max_namespace | Sha256(0x01 | left | right)

Aliased Type§

pub struct NamespacedHash { /* private fields */ }

Trait Implementations§

Source§

impl NamespacedHashExt for NamespacedHash

Source§

fn empty_root() -> NamespacedHash

Get the hash of the root of an empty Nmt.
Source§

fn from_raw(bytes: &[u8]) -> Result<NamespacedHash>

Try to decode NamespacedHash from the raw bytes.
Source§

fn to_vec(&self) -> Vec<u8>

Encode NamespacedHash into Vec.
Source§

fn to_array(&self) -> RawNamespacedHash

Encode NamespacedHash into array.
Source§

fn validate_namespace_order(&self) -> Result<()>

Validate if the Namespaces covered by this hash are in correct order. Read more