Insert serializes key into binary and computes its hash, then stores the (hash(key), value) into the trie.
(key []byte, value []byte)
| 38 | // Insert serializes key into binary and computes its hash, |
| 39 | // then stores the (hash(key), value) into the trie. |
| 40 | func (trie *Trie) Insert(key []byte, value []byte) (inserted bool) { |
| 41 | hashedKey := hash.HashB(key) |
| 42 | |
| 43 | inserted = trie.trie.Insert(hashedKey, value) |
| 44 | return |
| 45 | } |
| 46 | |
| 47 | // Get returns the value according to the key. |
| 48 | func (trie *Trie) Get(key []byte) ([]byte, error) { |