This commit is contained in:
Lain Iwakura 2025-06-22 22:42:22 +03:00
parent 04fe51933a
commit 4def0cedc2
No known key found for this signature in database
GPG Key ID: C7C18257F2ADC6F8
2 changed files with 8 additions and 5 deletions

View File

@ -1,7 +1,7 @@
module.exports = { module.exports = {
server: { server: {
host: "127.0.0.1", host: "127.0.0.1",
port: 9339, port: 3456,
}, },
auth: { auth: {

View File

@ -70,13 +70,16 @@ class Crypto {
generateNonce() { generateNonce() {
const timestamp = Date.now() 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) 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, 8)
nonceBuffer.writeUInt32BE(random ^ timestamp, 12) nonceBuffer.writeUInt32BE((random ^ low) >>> 0, 12)
return nonceBuffer return nonceBuffer
} }