Skip to content

Instantly share code, notes, and snippets.

@markeissler
Forked from sergiotapia/md5-example.go
Created April 21, 2020 16:08
Show Gist options
  • Save markeissler/3a2ed53a43ebf900c6b345dfcae9880c to your computer and use it in GitHub Desktop.
Save markeissler/3a2ed53a43ebf900c6b345dfcae9880c to your computer and use it in GitHub Desktop.
Golang - How to hash a string using MD5.
import (
"crypto/md5"
"encoding/hex"
)
func GetMD5Hash(text string) string {
hasher := md5.New()
hasher.Write([]byte(text))
return hex.EncodeToString(hasher.Sum(nil))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment