aboutsummaryrefslogtreecommitdiff
path: root/peer/id.go
blob: fa8c6a991e468ac7d348c47b16edaff7eff55fcc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
}