Guest User

Untitled

a guest
Dec 29th, 2021
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.47 KB | None | 0 0
  1. from algosdk import wordlist, mnemonic
  2. from base64 import *
  3. from nacl.signing import SigningKey
  4. from time import time
  5.  
  6.  
  7. word_lookup = wordlist.word_list_raw().split('\n')[0:2048]
  8.  
  9.  
  10. def countup(bytes):
  11.     i = 31
  12.     while True:
  13.         if bytes[i] != 255:
  14.             bytes[i] += 1
  15.             return bytes
  16.         bytes[i] = 0
  17.         i = i-1
  18.  
  19.  
  20. actual_key = "require pizza romance quality asthma turtle tent obey address bless include scan table scrub rude fit shoe such trophy wheat ridge squirrel lab able festival"
  21. truncated_key = "require pizza romance quality asthma turtle tent obey address bless include scan table scrub rude fit shoe such trophy wheat ridge squirrel"
  22. address = "N4AMYWLZQQTITC7NYPY4N7K32AUCM3BP5DECD4SMWRU2OISXBTLDIPWVF4"
  23.  
  24. print(f'Actual key: {actual_key}')
  25. print(f'Truncated key: {truncated_key}')
  26.  
  27. start_time = time()
  28.  
  29. mm = truncated_key.split(' ')
  30. while len(mm) < 24:
  31.     mm.append(word_lookup[0])
  32. words = mnemonic._from_words(mm)
  33. bits = bytearray(mnemonic._to_bytes(words)[:32])
  34.  
  35. print(address)
  36.  
  37.  
  38. num_tested = 0
  39. while True:
  40.     privkey = SigningKey(bytes(bits))
  41.     pubkey = privkey.verify_key
  42.     if b32encode(pubkey.encode())[:32] == address[:32].encode():
  43.         print(f'found key: {mnemonic._from_key(bits)}')
  44.         print(f'Took: {time() - start_time:.1f}s')
  45.         break
  46.     bits = countup(bits)
  47.     num_tested += 1
  48.     if num_tested % 10000 == 0:
  49.         print(f'Tested {num_tested} keys in {time() - start_time:.1f}s')
  50.  
Add Comment
Please, Sign In to add comment