Changeset 395 in code for trunk/user.go


Ignore:
Timestamp:
Aug 19, 2020, 9:24:25 AM (5 years ago)
Author:
contact
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/user.go

    r385 r395  
    33import (
    44        "crypto/sha256"
    5         "encoding/base64"
    65        "encoding/binary"
     6        "encoding/hex"
    77        "fmt"
    88        "time"
     
    111111        binary.LittleEndian.PutUint64(b[:], uint64(u.ID))
    112112        h := sha256.Sum256(b[:])
    113         return base64.RawStdEncoding.EncodeToString(h[:])
     113        return hex.EncodeToString(h[:16])
    114114}
    115115
Note: See TracChangeset for help on using the changeset viewer.