示例#1
0
func TestImplementsHash(t *testing.T) {
	tsd, err := NewDigest(Version1)
	if err != nil {
		t.Fatal(err)
	}

	_ = hash.Hash(tsd)
}
示例#2
0
func fastSHA512() hash.Hash {
	scratch := buf.Alloc()
	C.sha512_init((*C.hash_state)(unsafe.Pointer(&scratch[0])))
	goo := fastSHA512State{scratch}
	return hash.Hash(goo)
}
示例#3
0
文件: skein.go 项目: dchest/skein
// NewMAC returns hash.Hash calculating Skein Message Authentication Code of the
// given length in bytes. A MAC is a cryptographic hash that uses a key to
// authenticate a message. The receiver verifies the hash by recomputing it
// using the same key.
func NewMAC(outLen uint64, key []byte) hash.Hash {
	return hash.Hash(New(outLen, &Args{Key: key}))
}
示例#4
0
文件: skein.go 项目: dchest/skein
// NewHash returns hash.Hash calculating checksum of the given length in bytes
// (for example, to calculate 256-bit hash, outLen must be set to 32).
func NewHash(outLen uint64) hash.Hash {
	return hash.Hash(New(outLen, nil))
}