Skip to content

Instantly share code, notes, and snippets.

@devlongs
Created September 14, 2024 17:28
Show Gist options
  • Save devlongs/4b6eba2e2b3d3418582f71d0e718d1b1 to your computer and use it in GitHub Desktop.
Save devlongs/4b6eba2e2b3d3418582f71d0e718d1b1 to your computer and use it in GitHub Desktop.
Hashing in Go using the crypto/sha256 library
package main
import (
"crypto/sha256"
"fmt"
)
func main() {
hash := sha256.New()
hash.Write([]byte("Hello, World!"))
hashed := hash.Sum(nil)
fmt.Printf("hashed value: %x\n", hashed)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment