-
-
Save birchmd/a336269596651992ed9b742c843b9b0f to your computer and use it in GitHub Desktop.
Converts hex input on stdin to base58
This file contains 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
#!/usr/bin/python3 | |
# -*- coding: utf-8 -*- | |
import base58, sys | |
hex_chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'] | |
if __name__ == '__main__': | |
for line in sys.stdin: | |
input = line.strip().replace('0x', '').lower() | |
hex_only = ''.join(c for c in input if c in hex_chars) | |
print(base58.b58encode(bytes.fromhex(hex_only)).decode('utf8')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment