Function triehash::ordered_trie_root
source · [−]pub fn ordered_trie_root<H, I>(input: I) -> H::Out where
I: IntoIterator,
I::Item: AsRef<[u8]>,
H: Hasher,
<H as Hasher>::Out: Ord,
Expand description
Generates a trie root hash for a vector of values
extern crate triehash;
extern crate keccak_hasher;
extern crate ethereum_types;
#[macro_use] extern crate hex_literal;
use ethereum_types::H256;
use triehash::ordered_trie_root;
use keccak_hasher::KeccakHasher;
fn main() {
let v = &["doe", "reindeer"];
let root = H256::from(hex!("e766d5d51b89dc39d981b41bda63248d7abce4f0225eefd023792a540bcffee3"));
assert_eq!(ordered_trie_root::<KeccakHasher, _>(v), root.as_ref());
}