Skip to content
This repository has been archived by the owner on Jul 28, 2021. It is now read-only.

Commit

Permalink
Merge pull request uuidjs#107 from danorton2/master
Browse files Browse the repository at this point in the history
Provide support of MSIE 11 msCrypto
  • Loading branch information
broofa committed Mar 18, 2015
2 parents bfce984 + da999e9 commit 95a9c54
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions uuid.js
Expand Up @@ -11,6 +11,9 @@
// returns 128-bits of randomness, since that's what's usually required
var _rng;

// Allow for MSIE11 msCrypto
var _crypto = _global.crypto || _global.msCrypto;

// Node.js crypto-based RNG - http://nodejs.org/docs/v0.6.2/api/crypto.html
//
// Moderately fast, high quality
Expand All @@ -21,13 +24,13 @@
} catch(e) {}
}

if (!_rng && _global.crypto && crypto.getRandomValues) {
if (!_rng && _crypto && _crypto.getRandomValues) {
// WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto
//
// Moderately fast, high quality
var _rnds8 = new Uint8Array(16);
_rng = function whatwgRNG() {
crypto.getRandomValues(_rnds8);
_crypto.getRandomValues(_rnds8);
return _rnds8;
};
}
Expand Down

0 comments on commit 95a9c54

Please sign in to comment.