Esempio n. 1
0
func main() {
	for _, h := range []hash.Hash{md4.New(), md5.New(), sha1.New(),
		sha256.New224(), sha256.New(), sha512.New384(), sha512.New(),
		ripemd160.New()} {
		fmt.Printf("%x\n\n", h.Sum())
	}
}
Esempio n. 2
0
// hashFuncFromType returns a hash.Hash which corresponds to the given hash
// type byte. See RFC 4880, section 9.4.
func hashFuncFromType(hashType byte) hash.Hash {
	switch hashType {
	case 1:
		return md5.New()
	case 2:
		return sha1.New()
	case 3:
		return ripemd160.New()
	case 8:
		return sha256.New()
	case 9:
		return sha512.New384()
	case 10:
		return sha512.New()
	case 11:
		return sha256.New224()
	}

	return nil
}