Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- generateClientKey(ip, x){
- if(!ip.length || !x.byteLength) return null
- let a = null
- let b = 1540483477
- let c = ip.match(/(ws+:\/\/)([^:]*)(:\d+)/)[2]
- let d = c.length + x.byteLength
- let e = new Uint8Array(d)
- for(let i = 0; i < c.length; i++) e[i] = c.charCodeAt(i)
- e.set(x, c.length)
- let f = new DataView(e.buffer)
- let g = d - 1
- let h = (g - 4 & -4) + 4 | 0
- let i = g ^ 255
- let j = 0
- while(g > 3){
- a = Math.imul(f.getInt32(j, true), b) | 0
- i = (Math.imul(a >>> 24 ^ a, b) | 0) ^ (Math.imul(i, b) | 0)
- g -= 4
- j += 4
- }
- switch(g){
- case 3:
- i = e[h + 2] << 16 ^ i
- i = e[h + 1] << 8 ^ i
- break
- case 2:
- i = e[h + 1] << 8 ^ i
- break
- case 1:
- break
- default:
- a = i
- }
- if(a !== i) a = Math.imul(e[h] ^ i, b) | 0
- i = a >>> 13
- a = i ^ a
- a = Math.imul(a, b) | 0
- i = a >>> 15
- a = i ^ a
- return a
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement