Skip to content

Instantly share code, notes, and snippets.

@jabgibson
Created February 13, 2019 16:50
Show Gist options
  • Save jabgibson/32776bcc44223326a7ee4a1cb8c3c6ca to your computer and use it in GitHub Desktop.
Save jabgibson/32776bcc44223326a7ee4a1cb8c3c6ca to your computer and use it in GitHub Desktop.
package main
import (
"crypto/sha256"
"encoding/hex"
"fmt"
"os"
)
func main() {
args := os.Args
if len(args) != 2 {
fmt.Println("Need an argument to hash")
return
}
h := sha256.New()
h.Write([]byte(args[1]))
fmt.Println(hex.EncodeToString(h.Sum(nil)))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment