[][src]Enum exonum_merkledb::HashTag

#[repr(u8)]
pub enum HashTag {
    Blob,
    ListBranchNode,
    ListNode,
    MapNode,
    MapBranchNode,
}

MerkleDB hash prefixes.

Variants

Blob

Hash prefix of a blob.

ListBranchNode

Hash prefix of a branch node of the merkle tree.

ListNode

Hash prefix of the list object.

MapNode

Hash prefix of the map object.

MapBranchNode

Hash prefix of the map branch node object.

Methods

impl HashTag[src]

Calculate hash value with the specified prefix.

In MerkleDB, all data is presented as objects. Objects are divided into blobs and collections (lists / maps), which in their turn are divided into hashable and non-hashable. ProofListIndex and ProofMapIndex relate to hashable collections. For these collections, one can define a hash, which is used to build proof for their contents. In the future, these hashes will be used to build proofs for object hierarchies.

Different hashes for leaf and branch nodes of the list are used to secure merkle tree from the pre-image attack.

See more information here.

pub fn hash_leaf(value: &[u8]) -> Hash[src]

Convenience method to obtain a hashed value of the merkle tree leaf.

pub fn hash_node(left_hash: &Hash, right_hash: &Hash) -> Hash[src]

Convenience method to obtain hashed value of the merkle tree node.

pub fn hash_single_node(hash: &Hash) -> Hash[src]

Convenience method to obtain a hashed value of the merkle tree node with one child.

pub fn hash_list_node(len: u64, root: Hash) -> Hash[src]

Hash of the list object.

h = sha-256( HashTag::ListNode || len as u64 || merkle_root )

pub fn empty_list_hash() -> Hash[src]

Hash of the empty list object.

Empty list hash:

h = sha-256( HashTag::ListNode || 0 || Hash::default() )

pub fn hash_list(hashes: &[Hash]) -> Hash[src]

Computes a list hash for the given list of hashes.

pub fn hash_map_node(root: Hash) -> Hash[src]

Hash of the map object.

h = sha-256( HashTag::MapNode || merkle_root )

pub fn hash_map_branch(branch_node: &[u8]) -> Hash[src]

Hash of the map branch node.

h = sha-256( HashTag::MapBranchNode || <left_key> || <right_key> || <left_hash> || <right_hash> )

pub fn hash_single_entry_map(path: &ProofPath, h: &Hash) -> Hash[src]

Hash of the map with single entry.

h = sha-256( HashTag::MapBranchNode || <key> || <child_hash> )

pub fn empty_map_hash() -> Hash[src]

Hash of the empty map object.

Empty map hash:

sha-256( HashTag::MapNode || Hash::default() )

Trait Implementations

impl Clone for HashTag[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Copy for HashTag[src]

impl Debug for HashTag[src]

Auto Trait Implementations

impl Sync for HashTag

impl Send for HashTag

impl Unpin for HashTag

impl RefUnwindSafe for HashTag

impl UnwindSafe for HashTag

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,