//TODO: test and add to tests
//RIPEMD-160 operation for bitcoin address hashing
func Ripemd(b []byte) []byte {
	//ripemd hashing of the sha hash
	var h hash.Hash = ripemd160.New()
	h.Write(b)

	return h.Sum(nil) //return
}
Exemplo n.º 2
0
func Digest160(message []byte) (res []byte) {
	sha := sha256.New()
	sha.Write(message)
	res = sha.Sum(res)
	rip := ripemd160.New()
	rip.Write(res)
	res = rip.Sum(res[:0])
	return
}
//TODO: test and add to tests
//SHA-256 RIPEMD-160 operation for bitcoin address hashing
func SHARipemd(b []byte) []byte {

	//sha hashing of the input
	var h hash.Hash = sha256.New()
	h.Write(b)

	//ripemd hashing of the sha hash
	var h2 hash.Hash = ripemd160.New()
	h2.Write(h.Sum(nil))

	return h2.Sum(nil) //return
}