aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2019-02-18 15:14:39 +0100
committerGitHub <noreply@github.com>2019-02-18 15:14:39 +0100
commit27b70ed0bab93aa05dfb62717042ce22c9a027be (patch)
tree1f34df86bdd0af341c29a0b2bc94aeb364c0bb10
parent2d57981261056d47ef1c24fa82c6ad10c03e37ca (diff)
parent9e3a52f14a8e80441520933a7b654c86ed730da3 (diff)
downloadperl-software-in-gnu-guix-27b70ed0bab93aa05dfb62717042ce22c9a027be.tar
perl-software-in-gnu-guix-27b70ed0bab93aa05dfb62717042ce22c9a027be.tar.gz
Merge pull request #2312 from albert-ziegler/improve_random_number_generation
impove randomness
-rw-r--r--plugin/multiplex/index.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/plugin/multiplex/index.js b/plugin/multiplex/index.js
index 8195f04..f11639b 100644
--- a/plugin/multiplex/index.js
+++ b/plugin/multiplex/index.js
@@ -44,7 +44,8 @@ app.get("/", function(req, res) {
app.get("/token", function(req,res) {
var ts = new Date().getTime();
- var rand = Math.floor(Math.random()*9999999);
+ var rand = new Uint32Array(1);
+ window.crypto.getRandomValues(rand)
var secret = ts.toString() + rand.toString();
res.send({secret: secret, socketId: createHash(secret)});
});
@@ -61,4 +62,4 @@ var brown = '\033[33m',
green = '\033[32m',
reset = '\033[0m';
-console.log( brown + "reveal.js:" + reset + " Multiplex running on port " + green + opts.port + reset ); \ No newline at end of file
+console.log( brown + "reveal.js:" + reset + " Multiplex running on port " + green + opts.port + reset );