예제 #1
0
파일: hashfuncs.go 프로젝트: ironbits/dcrd
// HashFuncH calculates hash(b) and returns the resulting bytes as a Hash.
func HashFuncH(b []byte) Hash {
	var outB [blake256.Size]byte
	a := blake256.New()
	a.Write(b)
	out := a.Sum(nil)
	for i, el := range out {
		outB[i] = el
	}

	return Hash(outB)
}
예제 #2
0
파일: hashfuncs.go 프로젝트: ironbits/dcrd
// HashFunc calculates the hash of the supplied bytes.
// TODO(jcv) Should modify blake256 so it has the same interface as blake2
// and fastsha256 so these function can look more like btcsuite.  Then should
// try to get it to the upstream blake256 repo
func HashFunc(data []byte) [blake256.Size]byte {
	var outB [blake256.Size]byte
	a := blake256.New()
	a.Write(data)
	out := a.Sum(nil)
	for i, el := range out {
		outB[i] = el
	}

	return outB
}
예제 #3
0
파일: hashfuncs.go 프로젝트: ironbits/dcrd
// HashFuncB calculates hash(b) and returns the resulting bytes.
func HashFuncB(b []byte) []byte {
	a := blake256.New()
	a.Write(b)
	out := a.Sum(nil)
	return out
}