Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from binascii import crc32
- def get_checksum(phrase):
- """Given a mnemonic word string, return a string of the computed checksum.
- :rtype: str
- """
- phrase_split = phrase.split(" ")
- phrase = phrase_split[:24]
- 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]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement