Encode idents to hex instead of base64

base64 strings may contain characters rejected by ident clients such
as "+". Use hex encoding and shorten the string a little.

git-svn-id: file:///srv/svn/repo/suika/trunk@395 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This commit is contained in:
contact 2020-08-19 09:24:25 +00:00
parent 143f8d8f90
commit 4ab774fcd4

View File

@ -2,8 +2,8 @@ package soju
import (
"crypto/sha256"
"encoding/base64"
"encoding/binary"
"encoding/hex"
"fmt"
"time"
@ -110,7 +110,7 @@ func userIdent(u *User) string {
var b [64]byte
binary.LittleEndian.PutUint64(b[:], uint64(u.ID))
h := sha256.Sum256(b[:])
return base64.RawStdEncoding.EncodeToString(h[:])
return hex.EncodeToString(h[:16])
}
func (net *network) run() {