-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrandom_UWif.py
executable file
·29 lines (27 loc) · 1 KB
/
random_UWif.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import hashlib
import base58 # python3 -m pip install base58
import binascii
from bit import Key # python3 -m pip install bit
import random
import string_utils # python3 -m pip install python-string-utils
#123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz - Base58
#5H 5J 5K
alphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
iterations = 10
for _ in range(iterations):
string_utils.shuffle(alphabet)
start = '5J'
iterator = 51 - len(start)
for i in range(iterator):
start += random.choice(alphabet)
wif = start
first_encode = base58.b58decode(wif)
private_key_full = binascii.hexlify(first_encode)
private_key = private_key_full[2:-8]
private_key_hex = private_key.decode("utf-8")
print(f'Private key : {private_key_hex}')
keyU = Key.from_hex(private_key_hex)
keyU._public_key = keyU._pk.public_key.format(compressed=False)
print(f'WIF key : {keyU.to_wif()}')
print(f'Address : {keyU.address}')
print(' ')