[][src]Struct hycon_rust::common::merkle::MerkleTree

pub struct MerkleTree { /* fields omitted */ }

A merkle tree

Methods

impl MerkleTree[src]

pub fn length_for(length: usize) -> usize[src]

Calculate and return the length of vector required to build a tree for the input vector length

pub fn couple_hash(left: &Blake2bResult, right: &Blake2bResult) -> Blake2bResult[src]

Calculate a hash value for the concatenated value of two hash values

pub fn empty_tree() -> MerkleTree[src]

Construct a tree that has only one element containing the hash value of empty byte vector

pub fn from(hashes: Vec<Blake2bResult>) -> MerkleTree[src]

Construct the merkle tree containing the input vector and their ancestors that are built with couple_hash

Example

let input = Vec::new();

input.push(hash(tx_object,32));

let merkle_tree=MerkleTree::from(input);

pub fn root(&self) -> &[u8][src]

Return the hash value stored in the root element of this tree

pub fn size(&self) -> usize[src]

Return the size of merkle tree

Auto Trait Implementations

impl Send for MerkleTree

impl Sync for MerkleTree

Blanket Implementations

impl<T> From for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

impl<T, U> TryInto 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> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized

impl<T> Erased for T

impl<T> Same for T

type Output = T

Should always be Self