import os import pickle import struct with open('packet_dump','rb') as ff: packet = pickle.load(ff) def get_3byte_hash(packet): hashed = 0; for x in packet: hashed = (hashed*31 + x) % 0xFFFFFF return hashed def get_bytes(value): return list(value.to_bytes(4, byteorder='little')) to_id = packet[0] from_id = packet[1] msg_format = packet[2] msg_type = packet[3] name = packet[4:14] wheel_diameter = packet[14:24] battery_reading = struct.unpack('<' + 'H', packet[24:26])[0] time_reading = struct.unpack('<'+'B'*5, packet[26:31]) wheel_counts = struct.unpack('<'+'H'*15, packet[31:61]) b1, b2, b3 = struct.unpack('