From d5bed6c50a3c6cae3c7b6b4ef02ce7e6357b4b17 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Fri, 23 Sep 2016 21:14:50 +0200 Subject: [PATCH] Add more peer ID entropy (#960) --- src/renderer/webtorrent.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/renderer/webtorrent.js b/src/renderer/webtorrent.js index 514b5829..e1450db5 100644 --- a/src/renderer/webtorrent.js +++ b/src/renderer/webtorrent.js @@ -56,12 +56,8 @@ const VERSION_PREFIX = '-WD' + VERSION_STR + '-' /** * Generate an ephemeral peer ID each time. - * Once there are around 2^24 = ~8 million WebTorrent Desktops online at the same time, - * ID collisions will start happening. Birthday paradox. - * This is fine, though. Bad peers can already clone someone else's peer ID. - * The network is robust to occasional collisions. */ -const PEER_ID = Buffer.from(VERSION_PREFIX + crypto.randomBytes(6).toString('hex')) +const PEER_ID = Buffer.from(VERSION_PREFIX + crypto.randomBytes(9).toString('base64')) // Connect to the WebTorrent and BitTorrent networks. WebTorrent Desktop is a hybrid // client, as explained here: https://webtorrent.io/faq