Official Go implementation of the Ethereum protocol
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-ethereum/trie/secure_trie.go

37 lines
874 B

10 years ago
package trie
10 years ago
import "github.com/ethereum/go-ethereum/crypto"
10 years ago
type SecureTrie struct {
*Trie
}
10 years ago
func NewSecure(root []byte, backend Backend) *SecureTrie {
10 years ago
return &SecureTrie{New(root, backend)}
}
10 years ago
func (self *SecureTrie) Update(key, value []byte) Node {
return self.Trie.Update(crypto.Sha3(key), value)
10 years ago
}
func (self *SecureTrie) UpdateString(key, value string) Node {
10 years ago
return self.Update([]byte(key), []byte(value))
10 years ago
}
10 years ago
func (self *SecureTrie) Get(key []byte) []byte {
return self.Trie.Get(crypto.Sha3(key))
10 years ago
}
func (self *SecureTrie) GetString(key string) []byte {
10 years ago
return self.Get([]byte(key))
10 years ago
}
10 years ago
func (self *SecureTrie) Delete(key []byte) Node {
return self.Trie.Delete(crypto.Sha3(key))
10 years ago
}
10 years ago
func (self *SecureTrie) DeleteString(key string) Node {
10 years ago
return self.Delete([]byte(key))
10 years ago
}
func (self *SecureTrie) Copy() *SecureTrie {
return &SecureTrie{self.Trie.Copy()}
}