コード例 #1
0
func BenchmarkBLAKE256(b *testing.B) {
	val := make([]byte, 1024)
	for i := 0; i < b.N; i++ {
		xaxa := blake256.New()
		xaxa.Write(val)
		xaxa.Sum(nil)
	}
}
コード例 #2
0
ファイル: hashfuncs.go プロジェクト: pkothbauer/dcraddrgen
// 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)
}
コード例 #3
0
ファイル: hashfuncs.go プロジェクト: pkothbauer/dcraddrgen
// 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
}
コード例 #4
0
ファイル: hashfuncs.go プロジェクト: pkothbauer/dcraddrgen
// 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
}