Skip to content

Instantly share code, notes, and snippets.

@joshbeard
Created December 6, 2022 03:14
Show Gist options
  • Save joshbeard/dccf8458d966b5c59dd9988caec392eb to your computer and use it in GitHub Desktop.
Save joshbeard/dccf8458d966b5c59dd9988caec392eb to your computer and use it in GitHub Desktop.
Go: sha512 checksum
package main
import (
"crypto/sha512"
"fmt"
)
// shaSum returns a SHA512 checksum of a string.
func shaSum(s string) string {
sha_512 := sha512.New()
sha_512.Write([]byte(s))
sum := fmt.Sprintf("%x", sha_512.Sum(nil))
return sum
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment