From 07ebb2f141b33322506e90b6676f42a6c909929c Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Fri, 23 Sep 2016 18:11:40 -0700 Subject: Add more peer ID entropy This still keeps the peer ID printable as ascii, while adding lots more entropy --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'index.js') diff --git a/index.js b/index.js index 0c59ff9..ab091ac 100644 --- a/index.js +++ b/index.js @@ -65,7 +65,7 @@ function WebTorrent (opts) { } else if (Buffer.isBuffer(opts.peerId)) { self.peerId = opts.peerId.toString('hex') } else { - self.peerId = Buffer.from(VERSION_PREFIX + randombytes(6).toString('hex')).toString('hex') + self.peerId = Buffer.from(VERSION_PREFIX + randombytes(9).toString('base64')).toString('hex') } self.peerIdBuffer = Buffer.from(self.peerId, 'hex') -- cgit v1.2.3