Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import struct
- def pack_hex_to_int_arr(hex_str):
- arr = []
- for i in hex_str:
- arr.append(struct.unpack("B", i)[0])
- return arr
- if __name__ == "__main__":
- test = "\xfcg\xb2I\x00\x00\x00\x00s\x0e@\x00\x00\x00\x00\x00\x18 `\x00\x00\x00\x00\x00\x8c\x06@\x00\x00\x00\x00\x00w\x0c@\x00\x00\x00\x00\x00"
- result = [252, 103, 178, 73, 0, 0, 0, 0, 115, 14, 64, 0, 0, 0, 0, 0, 24, 32, 96, 0, 0, 0, 0, 0, 140, 6, 64, 0, 0, 0, 0, 0, 119, 12, 64, 0, 0, 0, 0, 0]
- print(pack_hex_to_int_arr(test) == result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement