tmhash: add Sum function
This commit is contained in:
parent
4663ffdf08
commit
c2636c3c6b
|
@ -34,8 +34,15 @@ func (h sha256trunc) BlockSize() int {
|
|||
return h.sha256.BlockSize()
|
||||
}
|
||||
|
||||
// New returns a new hash.Hash.
|
||||
func New() hash.Hash {
|
||||
return sha256trunc{
|
||||
sha256: sha256.New(),
|
||||
}
|
||||
}
|
||||
|
||||
// Sum returns the first 20 bytes of SHA256 of the bz.
|
||||
func Sum(bz []byte) []byte {
|
||||
hash := sha256.Sum256(bz)
|
||||
return hash[:Size]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue