Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2016-09-24 04:11:40 +0300
committerFeross Aboukhadijeh <feross@feross.org>2016-09-24 04:11:40 +0300
commit07ebb2f141b33322506e90b6676f42a6c909929c (patch)
treec2568bf331a7f76f5602cdca4493df4b7735f7d7 /index.js
parent2fc07a53a4e1a6c8f65a81f3cdc5d08071274691 (diff)
Add more peer ID entropy
This still keeps the peer ID printable as ascii, while adding lots more entropy
Diffstat (limited to 'index.js')
-rw-r--r--index.js2
1 files changed, 1 insertions, 1 deletions
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')