mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-27 12:21:03 +00:00
16 lines
316 B
Go
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))
|
|
}
|