Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

keccak.gno

0.30 Kb · 17 lines
 1package types
 2
 3import "crypto/keccak256"
 4
 5// Keccak hashes bz with keccak256 and returns the result as an H256.
 6// Exported for realm callers (core commits state roots with it).
 7func Keccak(bz []byte) H256 {
 8	sum := keccak256.Sum256(bz)
 9
10	var out H256
11
12	for i := range out {
13		out[i] = sum[i]
14	}
15
16	return out
17}