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.
This commit is contained in:
parent
ca40e79855
commit
78361f0b1e
4
user.go
4
user.go
@ -2,8 +2,8 @@ package soju
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"encoding/base64"
|
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ func userIdent(u *User) string {
|
|||||||
var b [64]byte
|
var b [64]byte
|
||||||
binary.LittleEndian.PutUint64(b[:], uint64(u.ID))
|
binary.LittleEndian.PutUint64(b[:], uint64(u.ID))
|
||||||
h := sha256.Sum256(b[:])
|
h := sha256.Sum256(b[:])
|
||||||
return base64.RawStdEncoding.EncodeToString(h[:])
|
return hex.EncodeToString(h[:16])
|
||||||
}
|
}
|
||||||
|
|
||||||
func (net *network) run() {
|
func (net *network) run() {
|
||||||
|
Loading…
Reference in New Issue
Block a user