Created
February 5, 2025 14:26
-
-
Save SerJaimeLannister/f5970b31a3d914dd539a883e4e6061a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import base36 | |
| import textwrap | |
| import subprocess | |
| import re | |
| import argparse | |
| # Argument parsing | |
| parser = argparse.ArgumentParser(description="Generate nano vanity addresses and extract original string.") | |
| parser.add_argument("--string", required=True, help="The input string to process (e.g., 'keshav').") | |
| parser.add_argument("--length", type=int, required=True, help="Length of segments for text wrapping.") | |
| args = parser.parse_args() | |
| y = base36.loads(args.string) | |
| y = str(y).replace("0", "a").replace("2", "b") | |
| array = textwrap.wrap(y, args.length) | |
| public_private_keys = {} | |
| for item in array: | |
| nano_string = "nano_1" + item # Changed to nano_1 | |
| cmd = f"/home/padhle/.cargo/bin/nano-vanity --generate-seed --threads 10 --no-progress --limit 1 --simple-output {nano_string}" | |
| print("Executing:", cmd) | |
| result = subprocess.run(cmd, shell=True, capture_output=True, text=True) | |
| match = re.search(r'([A-F0-9]+)\s+(nano_1[a-z0-9]+)', result.stdout) # Updated regex | |
| if match: | |
| public_private_keys[match.group(2)] = match.group(1) # Store as dictionary | |
| print("Extracted Keys:", public_private_keys) | |
| # Reverse extraction from public_private_keys | |
| target_keys = list(public_private_keys.keys()) | |
| part_1 = "" | |
| for item in target_keys: | |
| part = item[6:6 + args.length] # Extract characters dynamically based on input length | |
| part_1 += part | |
| print(part) | |
| part_1 = part_1.replace("b", "2").replace("a", "0") | |
| part_1 = part_1[:-2] # Removing last two characters | |
| original = base36.dumps(int(part_1)) | |
| print("Original:", original) | |
| ''' | |
| I've forgetten if it was caps lock or not but I think you can get the gist. (I am sorry for this unprofessionalism) | |
| I think it doesn't matter especially not in the https://www.unitconverters.net/numbers/base-36-to-base-10.htm since it converts my non caps lock into caps lock strange | |
| this is how I used to run | |
| uv run --python 3.12 --with base36 python hello.py - | |
| -string="hithere" --length=3 | |
| ''' | |
| ''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment