SHARE
TWEET

Untitled

a guest Jul 20th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top