Exemple #1
0
// DoubleSha256 calculates sha256(sha256(b)) and returns the resulting bytes.
func DoubleSha256(b []byte) []byte {
	hasher := fastsha256.New()
	hasher.Write(b)
	sum := hasher.Sum(nil)
	hasher.Reset()
	hasher.Write(sum)
	return hasher.Sum(nil)
}
Exemple #2
0
// Sha256 calculates sha256(b)) and returns the resulting bytes.
func Sha256(b []byte) []byte {
	hasher := fastsha256.New()
	hasher.Write(b)
	return hasher.Sum(nil)
}