Пример #1
0
func doHash(g *state.Game, thing, name string) string {
	digest := g.GetHash()
	io.WriteString(digest, thing)
	io.WriteString(digest, name)
	sum := digest.Sum(nil)
	return strings.TrimRight(base64.URLEncoding.EncodeToString(sum), "=")
}
Пример #2
0
func pwdHash(g *state.Game, name, password string) []byte {
	digest := g.GetHash()
	io.WriteString(digest, "password/")
	io.WriteString(digest, name)
	io.WriteString(digest, ":")
	io.WriteString(digest, password)
	return digest.Sum(nil)
}