MCPcopy Create free account
hub / github.com/chain/txvm / Example_sum

Function Example_sum

crypto/sha3/sha3_test.go:287–295  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

285func BenchmarkSha3_512_1MiB(b *testing.B) { benchmarkHash(b, New512(), 1024, 1024) }
286
287func Example_sum() {
288 buf := []byte("some data to hash")
289 // A hash needs to be 64 bytes long to have 256-bit collision resistance.
290 h := make([]byte, 64)
291 // Compute a 64-byte hash of buf and put it in h.
292 ShakeSum256(h, buf)
293 fmt.Printf("%x\n", h)
294 // Output: 0f65fe41fc353e52c55667bb9e2b27bfcc8476f2c413e9437d272ee3194a4e3146d05ec04a25d16b8f577c19b82d16b1424c3e022e783d2b4da98de3658d363d
295}
296
297func Example_mac() {
298 k := []byte("this is a secret key; you should generate a strong random key that's at least 32 bytes long")

Callers

nothing calls this directly

Calls 1

ShakeSum256Function · 0.85

Tested by

no test coverage detected