Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. generateClientKey(ip, x){
  2. if(!ip.length || !x.byteLength) return null
  3. let a = null
  4. let b = 1540483477
  5. let c = ip.match(/(ws+:\/\/)([^:]*)(:\d+)/)[2]
  6. let d = c.length + x.byteLength
  7. let e = new Uint8Array(d)
  8. for(let i = 0; i < c.length; i++) e[i] = c.charCodeAt(i)
  9. e.set(x, c.length)
  10. let f = new DataView(e.buffer)
  11. let g = d - 1
  12. let h = (g - 4 & -4) + 4 | 0
  13. let i = g ^ 255
  14. let j = 0
  15. while(g > 3){
  16. a = Math.imul(f.getInt32(j, true), b) | 0
  17. i = (Math.imul(a >>> 24 ^ a, b) | 0) ^ (Math.imul(i, b) | 0)
  18. g -= 4
  19. j += 4
  20. }
  21. switch(g){
  22. case 3:
  23. i = e[h + 2] << 16 ^ i
  24. i = e[h + 1] << 8 ^ i
  25. break
  26. case 2:
  27. i = e[h + 1] << 8 ^ i
  28. break
  29. case 1:
  30. break
  31. default:
  32. a = i
  33. }
  34. if(a !== i) a = Math.imul(e[h] ^ i, b) | 0
  35. i = a >>> 13
  36. a = i ^ a
  37. a = Math.imul(a, b) | 0
  38. i = a >>> 15
  39. a = i ^ a
  40. return a
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement