Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to search with a range #24

Open
floouok opened this issue Jan 20, 2022 · 1 comment
Open

how to search with a range #24

floouok opened this issue Jan 20, 2022 · 1 comment

Comments

@floouok
Copy link

floouok commented Jan 20, 2022

I'm looking to generate the private key from a specific rage I figured it would be something like changing priv_key = urandom(32) to something that lets me select a range.

my experience is complete noobish beginner so everything I tried stopped the programme from running

@floouok
Copy link
Author

floouok commented Jan 20, 2022

actually managed to fix this myself, not sure if its the best way though
hex_num = "%03x" % random.randint(0x8000000000000000, 0xffffffffffffffff)
add_zero = (str(hex_num).zfill(64))
byte_array = bytearray.fromhex(add_zero)
priv_key = byte_array
fullkey = '80' + binascii.hexlify(priv_key).decode()
sha256a = hashlib.sha256(binascii.unhexlify(fullkey)).hexdigest()
sha256b = hashlib.sha256(binascii.unhexlify(sha256a)).hexdigest()
WIF = base58.b58encode(binascii.unhexlify(fullkey+sha256b[:8]))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant