woodpecker/common/gravatar/gravatar.go
2015-04-07 01:20:55 -07:00

16 lines
316 B
Go

package gravatar
import (
"crypto/md5"
"fmt"
"strings"
)
// helper function to create a Gravatar Hash
// for the given Email address.
func Generate(email string) string {
email = strings.ToLower(strings.TrimSpace(email))
hash := md5.New()
hash.Write([]byte(email))
return fmt.Sprintf("%x", hash.Sum(nil))
}