-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhash160_hunter.py
More file actions
56 lines (45 loc) · 2.08 KB
/
hash160_hunter.py
File metadata and controls
56 lines (45 loc) · 2.08 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
import hashlib
import coincurve
def load_hash160(filename):
"""Membaca file hash160.txt dan mengembalikan daftar hash160."""
with open(filename, 'r') as file:
return set(line.strip() for line in file)
def save_result(filename, private_key_hex, address, hash160):
"""Menyimpan hasil yang cocok ke file result.txt."""
with open(filename, 'a') as file:
file.write(f"Private Key (HEX): {private_key_hex}\n")
file.write(f"Bitcoin Address: {address}\n")
file.write(f"Hash160: {hash160}\n\n")
def generate_btc_address(hash160_set, result_file):
"""Mencari alamat Bitcoin yang cocok dengan daftar hash160."""
counter = 0 # Counter untuk melacak jumlah percobaan
while True:
# Generate a random private key in HEX format
private_key_hex = os.urandom(32).hex()
# Calculate hash160
private_key = bytes.fromhex(private_key_hex)
public_key = coincurve.PublicKey.from_secret(private_key).format(compressed=True) # Diubah ke compressed
sha256_hash = hashlib.sha256(public_key).digest()
ripemd160_hash = hashlib.new('ripemd160', sha256_hash).digest()
pubkey_hash = ripemd160_hash.hex()
# Increment counter
counter += 1
# Tampilkan status setiap 1.000.000 percobaan
if counter % 1_000_000 == 0:
print(f"Generated {counter:,} addresses...")
# Check if the hash160 exists in the hash160 set
if pubkey_hash in hash160_set:
print(f"Match found after {counter:,} attempts!")
print(f"Private Key (HEX): {private_key_hex}")
print(f"Hash160: {pubkey_hash}")
save_result(result_file, private_key_hex, "", pubkey_hash)
if __name__ == "__main__":
# File yang berisi daftar hash160
hash160_file = "hash160.txt"
# File untuk menyimpan hasil yang cocok
result_file = "result.txt"
# Memuat daftar hash160 dari file
hash160_set = load_hash160(hash160_file)
# Menjalankan pencarian
generate_btc_address(hash160_set, result_file)