OC-MultICE/modules/library/chauth.lua

24 lines
560 B
Lua

function chauths(cA,nP,pW)
C.yield()
C.yield()
local rs=""
for i = 1, 16 do rs=rs..string.char(math.random(33,126)) end
ns(cA,nP,"char,"..rs)
while true do
if ev[1] == "net_msg" and ev[2] == cA and ev[3] == nP then
return (ev[4] == "chaa,"..string.format("%x",crc32.hash(pW..rs)))
end
C.yield()
end
end
function chauthc(sA,nP,pW)
while true do
if ev[1] == "net_msg" and ev[2] == sA and ev[3] == nP and ev[4]:sub(1,5) == "char," then
ns(sA,nP,"chaa,"..string.format("%x",crc32.hash(pW..ev[4]:sub(6))))
break
end
C.yield()
end
end