aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert <albert@semmle.com>2019-01-30 16:33:41 +0000
committerAlbert <albert@semmle.com>2019-01-30 16:33:41 +0000
commit90473eeb0511c466714a1e288d569931d588b3f0 (patch)
tree3312cbf464d0a21600ab13b44f901b47e149827d
parent0b3e7839ebf4ed8b6c180aca0abafa28c67aee6d (diff)
downloadperl-software-in-gnu-guix-90473eeb0511c466714a1e288d569931d588b3f0.tar
perl-software-in-gnu-guix-90473eeb0511c466714a1e288d569931d588b3f0.tar.gz
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..4a4f3de 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(array)
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 );