File: crypto.js

package info (click to toggle)
node-seedrandom 2.4.3%2Bdfsg-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 488 kB
  • sloc: javascript: 5,392; sh: 3; makefile: 2
file content (11 lines) | stat: -rw-r--r-- 245 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
// mimic a subset of node's crypto API for the browser

function randomBytes(width) {
  var out = new Uint8Array(width);
  (global.crypto || global.msCrypto).getRandomValues(out);
  return out;
}

module.exports = {
  randomBytes: randomBytes
}