I made a simple SHA3 Python script to generate Ethereum addresses and priv/pub keys. After that I sent some ETH to those addresses but then found out that priv keys do not correspond to the addresses I have. I think I misunderstood behavior of update method in Python keccak_256 implementation. Do I still have any chance to get priv keys for the addresses I got using this script?
from ecdsa import SigningKey, SECP256k1
import sha3, sys
n = 5
full_file = "addresses.txt"
keccak = sha3.keccak_256()
with open(full_file, "r") as f:
for i in range(n):
priv = SigningKey.generate(curve=SECP256k1)
pub = priv.get_verifying_key().to_string()
keccak.update(pub)
address = keccak.hexdigest()[24:]
print address
pr_key = str(priv.to_string().hex())
pub_key = str(pub.hex())
address_str = "0x" + address
f.write(address_str + " " + pr_key + " " + pub_key + "\n")
Thank you