Esempio n. 1
0
 def create_packet(key_phase, packet_number):
     buf = Buffer(capacity=100)
     buf.push_uint8(PACKET_FIXED_BIT | key_phase << 2 | 1)
     buf.push_bytes(binascii.unhexlify("8394c8f03e515708"))
     buf.push_uint16(packet_number)
     return buf.data, b"\x00\x01\x02\x03"
Esempio n. 2
0
 def test_push_uint16(self):
     buf = Buffer(capacity=2)
     buf.push_uint16(0x0807)
     self.assertEqual(buf.data, b"\x08\x07")
     self.assertEqual(buf.tell(), 2)