def __saltFunction(string): result = "" # from classWithGo result += str(len(string)) + hashsum._md5hash(string + "stufff...") salt13 = str(len(string) * 13) # from main.initialize salt2 = hashsum._md5hash(salt13 + str(len(salt13)) + str(len(string))) result += salt2 characterSum = 0 # calc sum of byte codes in a string for i in range(0, len(string)): characterSum += (ord(string[i]) & 255) result += str(characterSum) return result
def calcSig(self,sessionKey, requestId, authKey): if hasattr(self,'sig') and isinstance(self.sig,dict) and \ self.sig.has_key(str(requestId)): return hashsum._md5hash(self.sig[str(requestId)]) with open("sig\\bin\\keys.txt",'wt') as f: f.write(" ".join([authKey,str(requestId),sessionKey])) cwd = os.getcwd() os.chdir("sig") subprocess.call(["Run.cmd"]) os.chdir(cwd) with open("sig\\bin\\sig.txt",'rt') as f: data=f.read() self.sig=eval(data) return hashsum._md5hash(self.sig[str(requestId)]) raise GameError("No sig for %s"%(" ".join([authKey, str(requestId), sessionKey])))
def calcSig(self, sessionKey, requestId, authKey): if hasattr(self,'sig') and isinstance(self.sig,dict) and \ self.sig.has_key(str(requestId)): return hashsum._md5hash(self.sig[str(requestId)]) with open("sig\\bin\\keys.txt", 'wt') as f: f.write(" ".join([authKey, str(requestId), sessionKey])) cwd = os.getcwd() os.chdir("sig") subprocess.call(["Run.cmd"]) os.chdir(cwd) with open("sig\\bin\\sig.txt", 'rt') as f: data = f.read() self.sig = eval(data) return hashsum._md5hash(self.sig[str(requestId)]) raise GameError( "No sig for %s" % (" ".join([authKey, str(requestId), sessionKey])))
def calcAuth(requestId, authKey): auth = str(requestId) + authKey auth += __saltFunction(auth) sig = hashsum._md5hash(auth) return sig
def calcSig(sessionKey, requestId, authKey): sig = sessionKey + str(requestId) + authKey sig += __saltFunction(sig) sig = hashsum._md5hash(sig) return sig
def calcCRC(string): return hashsum._md5hash(string + __saltFunction(string))
def calcSig(sessionKey, requestId, authKey): Sig = sessionKey + str(requestId) + authKey Sig += __saltFunction(Sig) Sig = hashsum._md5hash(Sig) return Sig