Alyssa

Python Krist Addr Gen

Feb 5th, 2016
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.29 KB | None | 0 0
  1. import hashlib
  2. import math
  3. def base_36(number):
  4.     addr_chars = ["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","e"]
  5.     div = math.floor(number/7)
  6.     return addr_chars[div]
  7.  
  8. def sha256(to_hash):
  9.     hash_obj = hashlib.sha256()
  10.     hash_obj.update(to_hash.encode("utf-8"))
  11.     output = hash_obj.hexdigest()
  12.     return output
  13.  
  14. def makev2(master_key):
  15.     protein = []
  16.     stick = sha256(sha256(master_key))
  17.     n = 0
  18.     result_addr = "k"
  19.     while n < 9:
  20.         protein.append(stick[0:2])
  21.         stick = sha256(sha256(stick))
  22.         n = n+1
  23.     n = 0
  24.     while n < 9:
  25.         link = int(stick[(2*n):2+(2*n)],16) % 9
  26.         if n == 8:
  27.             nc = 0
  28.             while nc < 9:
  29.                 if not protein[nc] == "":
  30.                     result_addr = result_addr + base_36(int(protein[nc],16))
  31.                     protein[nc] = ""
  32.                     n = n+1
  33.                 nc = nc+1
  34.         elif not protein[link] == "":
  35.             result_addr = result_addr + base_36(int(protein[link],16))
  36.             protein[link] = ""
  37.             n = n+1
  38.         else:
  39.             stick = sha256(stick)
  40.     return result_addr
  41.  
  42. def gen(pass_key,lean=False):
  43.     if lean == False:
  44.         password = sha256("KRISTWALLET"+pass_key)
  45.         master_key = password+"-000"
  46.     else:
  47.         master_key = pass_key
  48.     v1_address = sha256(master_key)[0:10]
  49.     v2_address = makev2(master_key)
  50.     return v2_address, master_key
Advertisement
Add Comment
Please, Sign In to add comment