How to generate the random default “gravatars” like on Stack Overflow?

The ‘random’ colorful gravatars are displayed because this query string parameter is being added to every gravatar source URL: d=identicon This is done so that if the user doesn’t have a gravatar image associated with his email, this ‘random’ image is displayed, instead of the default blue gravatar image. The following displays the ‘default’ blue … Read more

How to go from []bytes to get hexadecimal

If I understood correctly you want to return the %x format: you can import “encoding/hex” and use the EncodeToString method str := hex.EncodeToString(h.Sum(nil)) or just Sprintf the value: func md(str string) string { h := md5.New() io.WriteString(h, str) return fmt.Sprintf(“%x”, h.Sum(nil)) } note that Sprintf is slower because it needs to parse the format string … Read more