fix staticcheck suggestions

This commit is contained in:
Aneurin Barker Snook
2023-11-25 16:51:25 +00:00
parent be4c5b5387
commit 7606bd558a
+6 -6
View File
@@ -8,20 +8,20 @@ import (
// SHA256 creates a hex-encoded SHA256 checksum for a string input. // SHA256 creates a hex-encoded SHA256 checksum for a string input.
func SHA256(value string) string { func SHA256(value string) string {
b := sha256.Sum256([]byte(value)) sum := sha256.Sum256([]byte(value))
hash := []byte{} hash := []byte{}
for _, byte := range b { for _, b := range sum {
hash = append(hash, byte) hash = append(hash, b)
} }
return hex.EncodeToString(hash) return hex.EncodeToString(hash)
} }
// SHA512 creates a hex-encoded SHA512 checksum for a string input. // SHA512 creates a hex-encoded SHA512 checksum for a string input.
func SHA512(value string) string { func SHA512(value string) string {
b := sha512.Sum512([]byte(value)) sum := sha512.Sum512([]byte(value))
hash := []byte{} hash := []byte{}
for _, byte := range b { for _, b := range sum {
hash = append(hash, byte) hash = append(hash, b)
} }
return hex.EncodeToString(hash) return hex.EncodeToString(hash)
} }