提交 665a4464 编写于 作者: O obscuren

Generic hashing method

上级 48125a25
package ethchain
import (
"github.com/ethereum/go-ethereum/ethtrie"
"github.com/ethereum/go-ethereum/ethutil"
)
type DerivableList interface {
Len() int
GetRlp(i int) []byte
}
func DeriveSha(list DerivableList) []byte {
trie := ethtrie.New(ethutil.Config.Db, "")
for i := 0; i < list.Len(); i++ {
trie.Update(string(ethutil.NewValue(i).Encode()), string(list.GetRlp(i)))
}
return trie.GetRoot()
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册