package peer import ( "crypto/rand" "encoding/hex" ) func NewID() []byte { src := make([]byte, 10) dst := make([]byte, hex.EncodedLen(len(src))) rand.Read(src) hex.Encode(dst, src) return dst } func NewIDFixed() [20]byte { ret := [20]byte{} copy(ret[:], NewID()) return ret }