Python Tool of Base58 Decode Check
Base58 originates from bitcoin where the inventor Satoshi intentionally removes "iILloO0" which are confusing letters/digits when they appear in printing..
Base58 uses the following character set:
123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz
In Blockchain such as bitcoins or Tron, the public wallet address is computed from private keys (256 bit random bytes). The wallet address is a base58 string, and we can decode and check the checksum. The following is a Python command line tool that uses the base58 library to perform the b58decode_check for the addresses.
import sys
def address_hex(address):
arr = base58.b58decode_check(address).hex().lower()
s = []
for i in range(0, len(arr) - 1, 2):
s.append("0x" + arr[i] + arr[i + 1])
return "{" + ",".join(s) + "}"
if len(sys.argv) <= 1:
print("Usage: " + sys.argv[0] + " str1 str2 ...")
exit()
for i in sys.argv[1:]:
print(i)
print(address_hex(i))
For example:
$ python3 b58.py TFczxzPhnThNSqr5by8tvxsdCFRRz6cPNq TSSMHYeV2uE9qYH95DqyoCuNCzEL1NvU3S
TFczxzPhnThNSqr5by8tvxsdCFRRz6cPNq
{0x41,0x3d,0xfe,0x63,0x7b,0x2b,0x9a,0xe4,0x19,0x0a,0x45,0x8b,0x5f,0x3e,0xfc,0x19,0x69,0xaf,0xe2,0x78,0x19}
TSSMHYeV2uE9qYH95DqyoCuNCzEL1NvU3S
{0x41,0xb4,0xa4,0x28,0xab,0x70,0x92,0xc2,0xf1,0x39,0x5f,0x37,0x6c,0xe2,0x97,0x03,0x3b,0x3b,0xb4,0x46,0xc1}
Reposted to Blog
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Thank you for reading ^^^^^^^^^^^^^^^
NEW! Following my Trail (Upvote or/and Downvote)
Follow me for topics of Algorithms, Blockchain and Cloud.
I am @justyy - a Steem Witness
https://steemyy.com
My contributions
- Video Downloader
- Steem Blockchain Tools
- Free Cryptos API
- VPS Database
- Computing Technology Blog
- A few useless tools
- And some other online software/tools
- Merge Files/Videos
- LOGO Turtle Programming Chrome Extension
- Teaching Kids Programming - Youtube Channel and All Contents
Delegation Service
Support me
If you like my work, please:
- Buy Me a Coffee, Thanks!
- Become my Sponsor, Thanks!
- Voting for me:
https://steemit.com/~witnesses type in justyy and click VOTE
- Delegate SP: https://steemyy.com/sp-delegate-form/?delegatee=justyy
- Vote @justyy as Witness: https://steemyy.com/witness-voting/?witness=justyy&action=approve
- Set @justyy as Proxy: https://steemyy.com/witness-voting/?witness=justyy&action=proxy
Alternatively, you can vote witness or set proxy here: https://steemit.com/~witnesses
Hola siguiendote.
hi @justyy,..i delegate steem to you, but you give a very small upvote for me. this really makes me want to confirm it with you. I wish you always success and this platform is more advanced and growing.. greetings by @abughaisan84