From 6b3a87e48ae4b6d737282ec3518cf8f2933656e1 Mon Sep 17 00:00:00 2001 From: pilinux Date: Thu, 29 Aug 2024 03:27:23 +0200 Subject: [PATCH] example: blake3 hash using github.com/zeebo/blake3 --- _example/hashing/main.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/_example/hashing/main.go b/_example/hashing/main.go index 9419c86..61b37ad 100644 --- a/_example/hashing/main.go +++ b/_example/hashing/main.go @@ -8,6 +8,7 @@ import ( "golang.org/x/crypto/blake2b" "golang.org/x/crypto/sha3" + // "github.com/zeebo/blake3" ) /* @@ -111,4 +112,24 @@ func main() { fmt.Println(blake2b512Sum) fmt.Printf("hex: %x\n", blake2b512Sum) fmt.Println("length", len(blake2b512Sum)) + fmt.Println("") + + // calculate BLAKE3-256 hash + /* + blake3Hash256 := blake3.Sum256(data) + fmt.Println("blake3Hash256:") + fmt.Println(blake3Hash256) + fmt.Printf("hex: %x\n", blake3Hash256) + fmt.Println("length", len(blake3Hash256)) + fmt.Println("") + */ + + // calculate BLAKE3-512 hash + /* + blake3Hash512 := blake3.Sum512(data) + fmt.Println("blake3Hash512:") + fmt.Println(blake3Hash512) + fmt.Printf("hex: %x\n", blake3Hash512) + fmt.Println("length", len(blake3Hash512)) + */ }