INNER CODE UNIT · JavaScript
hashNumber
jonasstrehle/supercookie · server/main.js:9
const hashNumber = (value) => crypto.createHash("MD5")
.update(value.toString())
.digest("hex").slice(-12).split(/(?=(?:..)*$)/)
.join(' ').toUpperCase();
const createRoutes = (base, count) => {
const array = [];
for (let i = 0; i < count; i++)
array.push(crypto.createHash("MD5")
.update(`${base}${i.toString()}`).digest("base64")
.replace(/(\=|\+|\/)/g, '0').substring(0, 22));
return array;
};
class Storage {
constructor() {
this._path = path.join(path.resolve(), "data.json");
this._content = {};
if (!this.existsPersistent())
this.createPersistent();