Skip to content

Instantly share code, notes, and snippets.

@matthijskooijman
Created August 8, 2015 13:22
Show Gist options
  • Save matthijskooijman/2aa47010cfc3d1feb2bb to your computer and use it in GitHub Desktop.
Save matthijskooijman/2aa47010cfc3d1feb2bb to your computer and use it in GitHub Desktop.
matthijs@grubby:~$ cat check.py
line = "10001000 10001000 10001000 10001000 10001000 00100100 11000000 01110000 01000000 00000000 00000000 00000000 00000000 00110001"
summed = 0
for byte in line.split(" "):
reversed = byte[::-1]
b = int(reversed, 2)
summed += b
print ("B: " + hex(b))
print ("S: " + hex(summed))
matthijs@grubby:~$ python3 check.py
B: 0x11
S: 0x11
B: 0x11
S: 0x22
B: 0x11
S: 0x33
B: 0x11
S: 0x44
B: 0x11
S: 0x55
B: 0x24
S: 0x79
B: 0x3
S: 0x7c
B: 0xe
S: 0x8a
B: 0x2
S: 0x8c
B: 0x0
S: 0x8c
B: 0x0
S: 0x8c
B: 0x0
S: 0x8c
B: 0x0
S: 0x8c
B: 0x8c
S: 0x118
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment