Last active
December 27, 2017 17:04
-
-
Save bboe/89b37bcf7ad396d4ff9a3336da6c7f4f to your computer and use it in GitHub Desktop.
Level XM17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
010000 1 | |
010010 1 | |
001010 4 | |
110010 0 | |
100010 4 | |
100010 4 | |
110101 3 | |
010011 1 | |
010110 1 | |
001000 2 | |
110000 1 | |
001110 4 | |
011011 2 | |
111101 2 | |
010110 1 | |
001001 5 | |
010010 4 | |
101000 2 | |
100010 0 | |
111110 2 | |
011100 1 | |
010111 5 | |
010010 4 | |
101001 2 | |
011011 2 | |
001110 2 | |
110010 1 | |
100100 0 | |
000111 5 | |
110110 4 | |
010001 1 | |
001011 2 | |
110000 1 | |
101110 0 | |
010010 4 | |
110010 4 | |
001101 3 | |
111101 2 | |
100110 0 | |
110001 0 | |
010000 1 | |
000110 4 | |
011110 3 | |
100001 0 | |
110011 1 | |
101000 0 | |
111001 5 | |
000000 ? | |
101010 2 | |
000110 4 | |
101011 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
import sys | |
import bitcoin | |
B58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' | |
# It turns out inverting and the white circles ended up being useless. | |
# The following is sufficient to find the key. | |
def main(): | |
with open('bits.txt') as fp: | |
numbers = [] | |
for line in fp: | |
data = line.strip().split(' ') | |
if not data: | |
continue | |
bits = data[0] | |
numbers.append(bits) | |
count = 0 | |
for i in range(6): | |
bit_order = [x % 6 for x in range(i, i + 6)] | |
for rotate in range(7): | |
key = '' | |
for number in numbers: | |
number = ''.join([number[x] for x in bit_order]) | |
bit_order = bit_order[rotate:] + bit_order[:rotate] | |
value = int(number, 2) | |
key += B58[value % 58] | |
count += 1 | |
try: | |
bitcoin.decode_privkey(key) | |
print('B58Key: {}'.format(key)) | |
except AssertionError: | |
pass | |
print(count) | |
if __name__ == '__main__': | |
sys.exit(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment