Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from binascii import crc32
- from words import word_list
- def get_checksum(phrase):
- """Given a mnemonic word string, return a string of the computed checksum.
- :rtype: str
- """
- wstr = "".join(word[:3] for word in phrase)
- wstr = bytearray(wstr.encode('utf-8'))
- z = ((crc32(wstr) & 0xffffffff) ^ 0xffffffff ) >> 0
- z2 = ((z ^ 0xffffffff) >> 0) % len(phrase)
- return phrase_split[z2]
- def brute_force(phrase,checksum):
- phrase_split = phrase.split(" ")
- for word in words.word_list:
- for i in range(24):
- trial = phrase[:i] + [word] + phrase[i:]
- if checksum == get_checksum(trial):
- print(" ".join(trial.append(checksum)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement