1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
| var randomBytes = require('./randomBytes');
| exports = function() {
| var b = randomBytes(16);
| b[6] = (b[6] & 0x0f) | 0x40;
| b[8] = (b[8] & 0x3f) | 0x80;
| return (
| hexBytes[b[0]] +
| hexBytes[b[1]] +
| hexBytes[b[2]] +
| hexBytes[b[3]] +
| '-' +
| hexBytes[b[4]] +
| hexBytes[b[5]] +
| '-' +
| hexBytes[b[6]] +
| hexBytes[b[7]] +
| '-' +
| hexBytes[b[8]] +
| hexBytes[b[9]] +
| '-' +
| hexBytes[b[10]] +
| hexBytes[b[11]] +
| hexBytes[b[12]] +
| hexBytes[b[13]] +
| hexBytes[b[14]] +
| hexBytes[b[15]]
| );
| };
| var hexBytes = [];
| for (var i = 0; i < 256; i++) {
| hexBytes[i] = (i + 0x100).toString(16).substr(1);
| }
|
| module.exports = exports;
|
|