Skip to content

Instantly share code, notes, and snippets.

@nmcv
Created November 23, 2014 19:29
Show Gist options
  • Save nmcv/3dcfa0e9892d037338c9 to your computer and use it in GitHub Desktop.
Save nmcv/3dcfa0e9892d037338c9 to your computer and use it in GitHub Desktop.
Test if L3 is L3 XOR {1} in the other case. H/W 1.
#!/usr/bin/env python3
import itertools
import string
from pprint import pprint
from binascii import unhexlify, hexlify
def cmp(a, b):
xored_b = ''.join(['{:02x}'.format(b ^ 0xFF) for b in unhexlify(b)])
if a == xored_b:
print('{}:{} matches'.format(a, b))
else:
print('{}:{} x '.format(a, b))
def main():
cmp('29634d75', '8d91d162')
cmp('25b14856', '107f0959')
cmp('6d4e0fdc', '92b1f023')
cmp('c3c36462', '3c3c9b9d')
cmp('fc617adb', '260568f5')
cmp('3a894ef6', '86d11f43')
cmp('ddd87290', '22278d6f')
cmp('91612be2', '6e9ed41d')
cmp('9ef66c9f', '60692649')
cmp('fb3549e8', 'a9a871d5')
main()
@nmcv
Copy link
Author

nmcv commented Nov 23, 2014

Output:

29634d75:8d91d162 x      
25b14856:107f0959 x      
6d4e0fdc:92b1f023 matches
c3c36462:3c3c9b9d matches
fc617adb:260568f5 x      
3a894ef6:86d11f43 x      
ddd87290:22278d6f matches
91612be2:6e9ed41d matches
9ef66c9f:60692649 x      
fb3549e8:a9a871d5 x      
[Finished in 0.2s]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment