Got the sending to work

This commit is contained in:
Daniil Gentili 2016-06-28 03:10:15 +02:00
parent 28193b99ad
commit 3b2ade94ba
3 changed files with 4 additions and 8 deletions

View File

@ -4,10 +4,6 @@ PHP implementation of MTProto, converted from [telepy](https://github.com/grigan
This is a WIP. This is a WIP.
The name of this project is inspired by [this person](https://s-media-cache-ak0.pinimg.com/736x/f0/a1/70/f0a170718baeb0e3817c612d96f5d1cf.jpg), due to the obvious signs of madness this project has in common with her. This project requires PHP 7. It might not work on big endian machines.
--- The name of this project is inspired by [this person](https://s-media-cache-ak0.pinimg.com/736x/f0/a1/70/f0a170718baeb0e3817c612d96f5d1cf.jpg).
I use PHP and I think that's absolutely fucking stupid.
~ Kenny

Binary file not shown.

View File

@ -89,7 +89,7 @@ class Session:
step1 = struct.pack('<II', len(message)+12, self.number) + message step1 = struct.pack('<II', len(message)+12, self.number) + message
step2 = step1 + struct.pack('<I', crc32(step1)) step2 = step1 + struct.pack('<I', crc32(step1))
print ":".join("{:02x}".format(ord(c)) for c in step2) print "".join("{:02x}".format(ord(c)) for c in struct.pack('<I', crc32(message_data)))
self.sock.send(step2) self.sock.send(step2)
self.number += 1 self.number += 1
@ -141,7 +141,7 @@ class Session:
def create_auth_key(self): def create_auth_key(self):
nonce = os.urandom(16) nonce = os.urandom(16)
#nonce = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' nonce = "a"
print("Requesting pq") print("Requesting pq")
ResPQ = self.method_call('req_pq', nonce=nonce) ResPQ = self.method_call('req_pq', nonce=nonce)