-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFull MiniKey SHA256
More file actions
35 lines (30 loc) · 1.33 KB
/
Copy pathFull MiniKey SHA256
File metadata and controls
35 lines (30 loc) · 1.33 KB
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
30
31
32
33
34
35
import hashlib
import base58
# The SHA256 of your BIP38-encrypted key
sha_hex = "88bb58efa98dcabaf5711efe40eaaa885701c209262f65c1655e0e0a47279e77"
# MiniKey validation function
def is_valid_minikey(minikey: str) -> bool:
return hashlib.sha256((minikey + '?').encode()).digest()[0] == 0x00
# Convert MiniKey to WIF
def minikey_to_wif(minikey: str) -> str:
privkey = hashlib.sha256(minikey.encode()).digest()
extended = b'\x80' + privkey
checksum = hashlib.sha256(hashlib.sha256(extended).digest()).digest()[:4]
return base58.b58encode(extended + checksum).decode()
# Generate miniKey candidates using SHA hash as base
def try_minikey_from_sha(sha_hex: str):
for i in range(len(sha_hex)):
for length in range(20, 31): # Try 20 to 30 character lengths
candidate = "S" + sha_hex[i:i + length - 1]
if len(candidate) < 22:
continue
if is_valid_minikey(candidate):
print(f"✅ Found valid MiniKey: {candidate}")
wif = minikey_to_wif(candidate)
print(f"🔑 WIF from MiniKey: {wif}")
return candidate, wif
print("❌ Still no valid MiniKey found.")
return None, None
# Run it
minikey, wif = try_minikey_from_sha(sha_hex)
#Be sure to replace values where neccessary. I have left notes to follow in this one.