--
This commit is contained in:
parent
24f3d27984
commit
6b60015c02
9588 changed files with 1149251 additions and 49 deletions
23
node_modules/uuid/lib/bytesToUuid.js
generated
vendored
Normal file
23
node_modules/uuid/lib/bytesToUuid.js
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* Convert array of 16 byte values to UUID string format of the form:
|
||||
* XXXXXXXX-XXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
||||
*/
|
||||
var byteToHex = [];
|
||||
for (var i = 0; i < 256; ++i) {
|
||||
byteToHex[i] = (i + 0x100).toString(16).substr(1);
|
||||
}
|
||||
|
||||
function bytesToUuid(buf, offset) {
|
||||
var i = offset || 0;
|
||||
var bth = byteToHex;
|
||||
return bth[buf[i++]] + bth[buf[i++]] +
|
||||
bth[buf[i++]] + bth[buf[i++]] + '-' +
|
||||
bth[buf[i++]] + bth[buf[i++]] + '-' +
|
||||
bth[buf[i++]] + bth[buf[i++]] + '-' +
|
||||
bth[buf[i++]] + bth[buf[i++]] + '-' +
|
||||
bth[buf[i++]] + bth[buf[i++]] +
|
||||
bth[buf[i++]] + bth[buf[i++]] +
|
||||
bth[buf[i++]] + bth[buf[i++]];
|
||||
}
|
||||
|
||||
module.exports = bytesToUuid;
|
||||
33
node_modules/uuid/lib/rng-browser.js
generated
vendored
Normal file
33
node_modules/uuid/lib/rng-browser.js
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// Unique ID creation requires a high quality random # generator. In the
|
||||
// browser this is a little complicated due to unknown quality of Math.random()
|
||||
// and inconsistent support for the `crypto` API. We do the best we can via
|
||||
// feature-detection
|
||||
var rng;
|
||||
|
||||
var crypto = global.crypto || global.msCrypto; // for IE 11
|
||||
if (crypto && crypto.getRandomValues) {
|
||||
// WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
|
||||
var rnds8 = new Uint8Array(16);
|
||||
rng = function whatwgRNG() {
|
||||
crypto.getRandomValues(rnds8);
|
||||
return rnds8;
|
||||
};
|
||||
}
|
||||
|
||||
if (!rng) {
|
||||
// Math.random()-based (RNG)
|
||||
//
|
||||
// If all else fails, use Math.random(). It's fast, but is of unspecified
|
||||
// quality.
|
||||
var rnds = new Array(16);
|
||||
rng = function() {
|
||||
for (var i = 0, r; i < 16; i++) {
|
||||
if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
|
||||
rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
|
||||
}
|
||||
|
||||
return rnds;
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = rng;
|
||||
10
node_modules/uuid/lib/rng.js
generated
vendored
Normal file
10
node_modules/uuid/lib/rng.js
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// Unique ID creation requires a high quality random # generator. In node.js
|
||||
// this is prett straight-forward - we use the crypto API.
|
||||
|
||||
var rb = require('crypto').randomBytes;
|
||||
|
||||
function rng() {
|
||||
return rb(16);
|
||||
};
|
||||
|
||||
module.exports = rng;
|
||||
Loading…
Reference in a new issue