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.

18 lines
331 B

  1. package trie
  2. import (
  3. "golang.org/x/crypto/blake2b"
  4. )
  5. // Hasher exports default hash function for trie
  6. var Hasher = func(data ...[]byte) []byte {
  7. hasher, err := blake2b.New256(nil)
  8. if err != nil {
  9. panic(err)
  10. }
  11. //hasher := sha256.New()
  12. for i := 0; i < len(data); i++ {
  13. hasher.Write(data[i])
  14. }
  15. return hasher.Sum(nil)
  16. }