diff --git a/modules/library/chauth.lua b/modules/library/chauth.lua new file mode 100644 index 0000000..70070d0 --- /dev/null +++ b/modules/library/chauth.lua @@ -0,0 +1,23 @@ +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