From 78361f0b1e0b2f0d2a2bfbacccd35b833aacf0b9 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 19 Aug 2020 11:24:25 +0200 Subject: [PATCH] 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. --- user.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user.go b/user.go index 0eec316..0090321 100644 --- a/user.go +++ b/user.go @@ -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() {