Base58 and Base58Check implementation.
Project description
base58
Base58 and Base58Check implementation compatible with what is used by the bitcoin network. Any other alternative alphabet (like the XRP one) can be used.
Starting from version 2.0.0 python2 is no longer supported the 1.x series will remain supported but no new features will be added.
Command line usage
$ printf "hello world" | base58
StV1DL6CwTryKyV
$ printf "hello world" | base58 -c
3vQB7B6MrGQZaxCuFg4oh
$ printf "3vQB7B6MrGQZaxCuFg4oh" | base58 -dc
hello world
$ printf "4vQB7B6MrGQZaxCuFg4oh" | base58 -dc
Invalid checksum
Module usage
>>> import base58
>>> base58.b58encode(b'hello world')
b'StV1DL6CwTryKyV'
>>> base58.b58decode(b'StV1DL6CwTryKyV')
b'hello world'
>>> base58.b58encode_check(b'hello world')
b'3vQB7B6MrGQZaxCuFg4oh'
>>> base58.b58decode_check(b'3vQB7B6MrGQZaxCuFg4oh')
b'hello world'
>>> base58.b58decode_check(b'4vQB7B6MrGQZaxCuFg4oh')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "base58.py", line 89, in b58decode_check
raise ValueError("Invalid checksum")
ValueError: Invalid checksum
# Use another alphabet. Here, using the built-in XRP/Ripple alphabet.
# RIPPLE_ALPHABET is provided as an option for compatibility with existing code
# It is recommended to use XRP_ALPHABET instead
>>> base58.b58encode(b'hello world', alphabet=base58.XRP_ALPHABET)
b'StVrDLaUATiyKyV'
>>> base58.b58decode(b'StVrDLaUATiyKyV', alphabet=base58.XRP_ALPHABET)
b'hello world'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
base58-2.1.1.tar.gz
(6.5 kB
view details)
Built Distribution
File details
Details for the file base58-2.1.1.tar.gz
.
File metadata
- Download URL: base58-2.1.1.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5d0cb3f5b6e81e8e35da5754388ddcc6d0d14b6c6a132cb93d69ed580a7278c |
|
MD5 | 3595b886f6d57b947fa8d38d4c92e5b3 |
|
BLAKE2b-256 | 7f458ae61209bb9015f516102fa559a2914178da1d5868428bd86a1b4421141d |
File details
Details for the file base58-2.1.1-py3-none-any.whl
.
File metadata
- Download URL: base58-2.1.1-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11a36f4d3ce51dfc1043f3218591ac4eb1ceb172919cebe05b52a5bcc8d245c2 |
|
MD5 | efa8296310fcf7b1b35e88bb31dfaf33 |
|
BLAKE2b-256 | 4a45ec96b29162a402fc4c1c5512d114d7b3787b9d1c2ec241d9568b4816ee23 |