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