Function triehash::sec_trie_root [−][src]
pub fn sec_trie_root<H, I, A, B>(input: I) -> H::Out where
I: IntoIterator<Item = (A, B)>,
A: AsRef<[u8]>,
B: AsRef<[u8]>,
H: Hasher,
<H as Hasher>::Out: Ord,
Generates a key-hashed (secure) trie root hash for a vector of key-value tuples.
use hex_literal::hex; use ethereum_types::H256; use triehash::sec_trie_root; use keccak_hasher::KeccakHasher; let v = vec![ ("doe", "reindeer"), ("dog", "puppy"), ("dogglesworth", "cat"), ]; let root = H256::from(hex!("d4cd937e4a4368d7931a9cf51686b7e10abb3dce38a39000fd7902a092b64585")); assert_eq!(sec_trie_root::<KeccakHasher, _, _, _>(v), root.as_ref());