source: trip-planner-front/node_modules/sockjs-client/lib/utils/browser-crypto.js@ bdd6491

Last change on this file since bdd6491 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 438 bytes
Line 
1'use strict';
2
3if (global.crypto && global.crypto.getRandomValues) {
4 module.exports.randomBytes = function(length) {
5 var bytes = new Uint8Array(length);
6 global.crypto.getRandomValues(bytes);
7 return bytes;
8 };
9} else {
10 module.exports.randomBytes = function(length) {
11 var bytes = new Array(length);
12 for (var i = 0; i < length; i++) {
13 bytes[i] = Math.floor(Math.random() * 256);
14 }
15 return bytes;
16 };
17}
Note: See TracBrowser for help on using the repository browser.