diff --git a/Config/config.js b/Config/config.js index 3c7439a..b31f75c 100644 --- a/Config/config.js +++ b/Config/config.js @@ -1,7 +1,7 @@ module.exports = { server: { host: "127.0.0.1", - port: 9339, + port: 3456, }, auth: { diff --git a/Utils/Crypto.js b/Utils/Crypto.js index 85a89cf..ef553ca 100644 --- a/Utils/Crypto.js +++ b/Utils/Crypto.js @@ -70,13 +70,16 @@ class Crypto { generateNonce() { const timestamp = Date.now() - const random = Math.floor(Math.random() * 0xffffffff) + const high = Math.floor(timestamp / 0x100000000) >>> 0 + const low = (timestamp >>> 0) + const random = Math.floor(Math.random() * 0xffffffff) >>> 0 const nonceBuffer = Buffer.alloc(16) - nonceBuffer.writeUInt32BE(timestamp >> 32, 0) - nonceBuffer.writeUInt32BE(timestamp & 0xffffffff, 4) + + nonceBuffer.writeUInt32BE(high, 0) + nonceBuffer.writeUInt32BE(low, 4) nonceBuffer.writeUInt32BE(random, 8) - nonceBuffer.writeUInt32BE(random ^ timestamp, 12) + nonceBuffer.writeUInt32BE((random ^ low) >>> 0, 12) return nonceBuffer }