From b0a00e05007f7dd4937006e4a401e02a45c47a80 Mon Sep 17 00:00:00 2001 From: tinsel-grumble <87134505+tinsel-grumble@users.noreply.github.com> Date: Wed, 12 Jan 2022 21:20:57 +0000 Subject: [PATCH 1/2] add blake2 hash --- utils.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/utils.go b/utils.go index 794b0a5..f865f28 100644 --- a/utils.go +++ b/utils.go @@ -5,7 +5,10 @@ import ( "crypto/sha1" "crypto/sha256" "crypto/sha512" + "crypto/blake2b" "fmt" + "golang.org/x/crypto/blake2b" + "golang.org/x/crypto/blake2s" "hash/adler32" "hash/crc32" "io" @@ -53,6 +56,10 @@ func checksum(r io.Reader, method string) (string, error) { return strconv.FormatUint(uint64(adler32.Checksum(b)), 10), nil case "crc32": return strconv.FormatUint(uint64(crc32.ChecksumIEEE(b)), 10), nil + case "blake2b": + return fmt.Sprintf("%x", blake2b.Sum256(b)), nil + case "blake2s": + return fmt.Sprintf("%x", blake2s.Sum256(b)), nil } return "", fmt.Errorf("Hashing method %s is not supported", method) From f57eb724a4cb92d4c20b7a0ec1b79cd4d25b45d1 Mon Sep 17 00:00:00 2001 From: tinsel-grumble <87134505+tinsel-grumble@users.noreply.github.com> Date: Wed, 12 Jan 2022 21:23:56 +0000 Subject: [PATCH 2/2] remove bad import --- utils.go | 1 - 1 file changed, 1 deletion(-) diff --git a/utils.go b/utils.go index f865f28..fc97dbb 100644 --- a/utils.go +++ b/utils.go @@ -5,7 +5,6 @@ import ( "crypto/sha1" "crypto/sha256" "crypto/sha512" - "crypto/blake2b" "fmt" "golang.org/x/crypto/blake2b" "golang.org/x/crypto/blake2s"