Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. import struct
  2.  
  3. def pack_hex_to_int_arr(hex_str):
  4. arr = []
  5. for i in hex_str:
  6. arr.append(struct.unpack("B", i)[0])
  7. return arr
  8.  
  9. if __name__ == "__main__":
  10. 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"
  11. 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]
  12. print(pack_hex_to_int_arr(test) == result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement