Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use UInt8Array for browser crypto-based RNGs

  • Loading branch information...
commit d57c574d32abdaaa984381595fb0640f9c18bb2b 1 parent 6e561f8
@broofa authored
Showing with 2 additions and 6 deletions.
  1. +2 −6 uuid.js
View
8 uuid.js
@@ -25,13 +25,9 @@
// WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto
//
// Moderately fast, high quality
- var _rnds8 = new Array(16), _rnds32 = new Uint32Array(4);
+ var _rnds8 = new Uint8Array(16);
_rng = function whatwgRNG() {
- crypto.getRandomValues(_rnds32);
-
- for (var c = 0 ; c < 16; c++) {
- _rnds8[c] = _rnds32[c >> 2] >>> ((c & 0x03) * 8) & 0xff;
- }
+ crypto.getRandomValues(_rnds8);
return _rnds8;
};
}
Please sign in to comment.
Something went wrong with that request. Please try again.