| 1 | #!/usr/bin/env python2
|
| 2 | """
|
| 3 | hexstring.py
|
| 4 | """
|
| 5 | from __future__ import print_function
|
| 6 |
|
| 7 | import sys
|
| 8 |
|
| 9 |
|
| 10 | def main(argv):
|
| 11 | hexdigits = '0123456789abcdef'
|
| 12 | for c in hexdigits:
|
| 13 | for d in hexdigits:
|
| 14 | for e in hexdigits:
|
| 15 | hexbyte = c + d + e #+ f
|
| 16 |
|
| 17 | byte = hexbyte
|
| 18 | byte = byte.replace('0', '0000')
|
| 19 | byte = byte.replace('1', '0001')
|
| 20 | byte = byte.replace('2', '0010')
|
| 21 | byte = byte.replace('3', '0011')
|
| 22 |
|
| 23 | byte = byte.replace('4', '0100')
|
| 24 | byte = byte.replace('5', '0101')
|
| 25 | byte = byte.replace('6', '0110')
|
| 26 | byte = byte.replace('7', '0111')
|
| 27 |
|
| 28 | byte = byte.replace('8', '1000')
|
| 29 | byte = byte.replace('9', '1001')
|
| 30 | byte = byte.replace('a', '1010')
|
| 31 | byte = byte.replace('b', '1011')
|
| 32 |
|
| 33 | byte = byte.replace('c', '1100')
|
| 34 | byte = byte.replace('d', '1101')
|
| 35 | byte = byte.replace('e', '1110')
|
| 36 | byte = byte.replace('f', '1111')
|
| 37 |
|
| 38 | #print(byte)
|
| 39 |
|
| 40 | ones = byte.replace('0', '')
|
| 41 | if len(ones) == 11:
|
| 42 | print(hexbyte, byte)
|
| 43 |
|
| 44 |
|
| 45 | if __name__ == '__main__':
|
| 46 | try:
|
| 47 | main(sys.argv)
|
| 48 | except RuntimeError as e:
|
| 49 | print('FATAL: %s' % e, file=sys.stderr)
|
| 50 | sys.exit(1)
|