This commit is contained in:
Tutur33
2023-11-24 22:35:41 +01:00
parent 3c0b507a93
commit 7644b2a0f7
45165 changed files with 4803356 additions and 3 deletions
+12
View File
@@ -0,0 +1,12 @@
var pad = require('./pad.js');
var env = typeof window === 'object' ? window : self;
var globalCount = Object.keys(env).length;
var mimeTypesLength = navigator.mimeTypes ? navigator.mimeTypes.length : 0;
var clientId = pad((mimeTypesLength +
navigator.userAgent.length).toString(36) +
globalCount.toString(36), 4);
module.exports = function fingerprint () {
return clientId;
};
+18
View File
@@ -0,0 +1,18 @@
var pad = require('./pad.js');
var os = require('os'),
padding = 2,
pid = pad(process.pid.toString(36), padding),
hostname = os.hostname(),
length = hostname.length,
hostId = pad(hostname
.split('')
.reduce(function (prev, char) {
return +prev + char.charCodeAt(0);
}, +length + 36)
.toString(36),
padding);
module.exports = function fingerprint () {
return pid + hostId;
};
+8
View File
@@ -0,0 +1,8 @@
var pad = require('./pad.js');
var globalCount = Object.keys(global);
var clientId = pad(globalCount.toString(36), 4);
module.exports = function fingerprint () {
return clientId;
};
+18
View File
@@ -0,0 +1,18 @@
var getRandomValue;
var crypto = typeof window !== 'undefined' &&
(window.crypto || window.msCrypto) ||
typeof self !== 'undefined' &&
self.crypto;
if (crypto) {
var lim = Math.pow(2, 32) - 1;
getRandomValue = function () {
return Math.abs(crypto.getRandomValues(new Uint32Array(1))[0] / lim);
};
} else {
getRandomValue = Math.random;
}
module.exports = getRandomValue;
+9
View File
@@ -0,0 +1,9 @@
var crypto = require('crypto');
var lim = Math.pow(2, 32) - 1;
module.exports = function random () {
return Math.abs(crypto.randomBytes(4)
.readInt32BE() / lim);
};
+2
View File
@@ -0,0 +1,2 @@
module.exports = Math.random;
+4
View File
@@ -0,0 +1,4 @@
module.exports = function pad (num, size) {
var s = '000000000' + num;
return s.substr(s.length - size);
};