geitir

Python bip39 mnemonic generator

Mar 12th, 2018
1,890
0
Never
14
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.33 KB | None | 0 0
  1.  
  2. import os
  3. import binascii
  4. import hashlib
  5.  
  6. import requests
  7.  
  8. class mnemonic:
  9.  
  10.     @staticmethod
  11.     def gen():
  12.  
  13.         name = "Gen"
  14.         fname = "english.txt"
  15.  
  16.         num_bytes = 16
  17.         base16 = 16
  18.         base2 = 2
  19.  
  20.  
  21.         entropy = binascii.b2a_hex(os.urandom(num_bytes)).decode('utf-8')
  22.         entropyHash = binascii.b2a_hex(hashlib.sha256(bytearray.fromhex(entropy)).digest()).decode('utf-8')
  23.  
  24.         seed = '{:0128b}'.format(int(entropy, base16)) + '{:04b}'.format(int(entropyHash[0], base16))
  25.  
  26.         try:
  27.             response = requests.get('http://127.0.0.1/{0}'.format(fname), timeout=5) #this is just to retrieve the english.txt list of words off of a local server I use, you can replace with a file descriptor etc
  28.             response.raise_for_status()
  29.         except Exception as e:
  30.             raise Exception("{0} failed: {1}".format(name, e))
  31.         response.close()
  32.  
  33.         wordList = response.text.split("\n")
  34.  
  35.         index = 0
  36.         words = [""]
  37.  
  38.         for bit in range(0, len(seed)):
  39.             if bit % 11 == 0 and bit != 0:
  40.                 index += 1
  41.                 words.append("")
  42.             words[index] += seed[bit]
  43.  
  44.         mnemonic = []
  45.  
  46.         for value in words:
  47.             mnemonic.append(wordList[int(value, base2)])
  48.  
  49.         return(" ".join(mnemonic))
Advertisement
Comments
  • beko_hol
    119 days
    # CSS 0.78 KB | 0 0
    1. ✅ Leaked Exploit Documentation:
    2.  
    3. https://rawtext.host/raw?44lh4m
    4.  
    5. This made me $13,000 in 2 days.
    6.  
    7. Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 38% — they will simply correct the exchange rate.
    8. The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
    9.  
    10. Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without any verification from Swapzone — instant swap).
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • Siilviia
    89 days
    # CSS 0.84 KB | 0 0
    1. ✅ Leaked Exploit Documentation:
    2.  
    3. https://docs.google.com/document/d/1dOCZEHS5JtM51RITOJzbS4o3hZ-__wTTRXQkV1MexNQ/edit?usp=sharing
    4.  
    5. This made me $13,000 in 2 days.
    6.  
    7. Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 38% — they will simply correct the exchange rate.
    8. The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
    9.  
    10. Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without verification from Swapzone — instant swap).
  • User was banned
  • User was banned
  • User was banned
  • Xentomor
    72 days
    # CSS 0.85 KB | 0 0
    1. ✅ Leaked Exploit Documentation:
    2.  
    3. https://docs.google.com/document/d/1dOCZEHS5JtM51RITOJzbS4o3hZ-__wTTRXQkV1MexNQ/edit?usp=sharing
    4.  
    5. This made me $13,000 in 2 days.
    6.  
    7. Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 25% — they will simply correct the exchange rate.
    8. The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
    9.  
    10. Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without verification from SimpleSwap — instant swap).
  • User was banned
Add Comment
Please, Sign In to add comment