An optimized implementation of Base58 encoding/decoding for 32 and 64 byte numbers.
This library is based off of the original C implementation from Jump Crypto's Firedancer
repo which can be found here. These algorithms are significantly faster than the commonly used
bs58
library for 32 and 64 bytes.
Performance vs. bs58
(run on an AMD Ryzen 7 3700X)
Algorithm | bs58 (ns) | fd_bs58 (ns) |
---|---|---|
encode_32 |
999.66 | 112.58 |
encode_64 |
3842.3 | 289.57 |
decode_32 |
368.21 | 91.168 |
decode_64 |
1345.4 | 235.62 |
Rust crate: https://crates.io/crates/fd_bs58
To run the fuzzer: cargo-fuzz run decode_32
To run a benchmark: cargo bench encode_32