aboutsummaryrefslogtreecommitdiff
path: root/types/util.go
blob: dc8ccbab6795f07e65201dbba97603eae68deb40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
package types

import (
	"crypto/sha256"
)

func Hash(buf []byte) *[HashSize]byte {
	var ret [HashSize]byte
	hash := sha256.New()
	hash.Write(buf)
	copy(ret[:], hash.Sum(nil))
	return &ret
}