fix: 用高精度时间产生地址

This commit is contained in:
chaosBreaking
2019-09-06 23:40:18 +08:00
parent b87c73ea77
commit dab7e3a45a

View File

@@ -5,7 +5,7 @@ const tools = require('./crypto');
const getPath = uid => { const getPath = uid => {
const pre = Date.now() + ''; const pre = Date.now() + '';
let seed = pre + uid; let seed = pre + uid;
if (seed.length < 19) seed += (Date.now() + '').slice(seed.length - 19); if (seed.length < 19) seed += process.hrtime().join('').slice(seed.length - 19);
const frag1 = seed.slice(0, 6); const frag1 = seed.slice(0, 6);
const frag2 = seed.slice(6, 12); const frag2 = seed.slice(6, 12);
const frag3 = seed.slice(-8); const frag3 = seed.slice(-8);