A quick base58 encoder/decoder implementation written in C, with Python bindings.
pip install qbase58
import qbase58
string = b"Hello, World!"
encoded = qbase58.encode(string)
print(f"Encoded: {encoded}")
decoded = qbase58.decode(encoded)
print(f"Decoded: {decoded}")
Comparing with the two other Python base58 libraries:
--- Data Set: SMALL (size=100 bytes) ---
base58 => avg: 45.1845 ms (std: 2.7698 ms) over 1000 iterations
based58 => avg: 12.7324 ms (std: 0.1445 ms) over 1000 iterations
qbase58 => avg: 6.5189 ms (std: 0.0414 ms) over 1000 iterations
--- Data Set: MEDIUM (size=1000 bytes) ---
base58 => avg: 763.2404 ms (std: 3.9402 ms) over 500 iterations
based58 => avg: 646.2393 ms (std: 2.4316 ms) over 500 iterations
qbase58 => avg: 320.7714 ms (std: 1.1277 ms) over 500 iterations
--- Data Set: LARGE (size=5000 bytes) ---
base58 => avg: 319.6193 ms (std: 1.5274 ms) over 10 iterations
based58 => avg: 320.4021 ms (std: 1.2545 ms) over 10 iterations
qbase58 => avg: 162.0134 ms (std: 0.7824 ms) over 10 iterations
See scripts/benchmark.py
for benchmarking details.