[−][src]Enum exonum_merkledb::HashTag
Prefixes for different types of objects stored in the database. These prefixes are necessary to provide domain separation among hashed objects of different types.
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. The hashable collections are ProofListIndex
and ProofMapIndex
.
For these collections, one can define a single hash which would reflect the entire
collection contents. This hash can then be used that a collection contains (or does not contain)
certain elements.
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.
Variants (Non-exhaustive)
Hash prefix of a blob (i.e., a type implementing BinaryValue
, which is stored in the DB
as byte sequence).
Hash prefix of a branch node in a Merkle tree built for a Merkelized list.
Hash prefix of a Merkelized list.
Hash prefix of a Merkelized map.
Hash prefix of a branch node in a Merkle Patricia tree built for a Merkelized map.
Methods
impl HashTag
[src]
pub fn hash_leaf(value: &[u8]) -> Hash
[src]
Obtains a hashed value of a leaf in a Merkle tree.
pub fn hash_node(left_hash: &Hash, right_hash: &Hash) -> Hash
[src]
Obtains a hashed value of a branch in a Merkle tree.
pub fn hash_single_node(hash: &Hash) -> Hash
[src]
Obtains a hashed value of a Merkle tree branch with one child.
pub fn hash_list_node(len: u64, root: Hash) -> Hash
[src]
Obtains hash of a Merkelized list. len
is the length of the list, and root
is
the hash of the root node of the Merkle tree corresponding to the list.
h = sha256( HashTag::ListNode || len as u64 || merkle_root )
pub fn empty_list_hash() -> Hash
[src]
Obtains hash of an empty Merkelized list.
h = sha256( HashTag::ListNode || 0 || Hash::zero() )
pub fn hash_list<V: BinaryValue + ?Sized>(values: &[V]) -> Hash
[src]
Computes the hash for a Merkelized list containing the given values.
pub fn hash_map_node(root: Hash) -> Hash
[src]
Obtains hash of a Merkelized map. root
is the recursively defined
hash of the root node of the binary Patricia Merkle tree corresponding to the map.
h = sha256( HashTag::MapNode || merkle_root )
pub fn hash_map_branch(branch_node: &[u8]) -> Hash
[src]
Obtains hash of a branch node in a Merkle Patricia tree.
branch_node
is the binary serialization of the node.
h = sha256( HashTag::MapBranchNode || branch_node )
See ProofMapIndex
for details how branch nodes are serialized.
pub fn hash_single_entry_map(path: &ProofPath, child_hash: &Hash) -> Hash
[src]
Obtains hash of a Merkelized map with a single entry.
h = sha256( HashTag::MapBranchNode || path || child_hash )
See ProofMapIndex
for details how path
is serialized.
pub fn empty_map_hash() -> Hash
[src]
Obtains hash of an empty Merkelized map.
The hash is computed as
sha256( HashTag::MapNode || Hash::zero() )
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for HashTag
impl Send for HashTag
impl Sync for HashTag
impl Unpin for HashTag
impl UnwindSafe for HashTag
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,