Crate b58

Source
Expand description

A Base58 encoding/decoding library with no external dependencies.

This library provides encoding and decoding functionality for Base58 format with support for multiple alphabets including Bitcoin (default), Ripple, and Flickr.

§Examples

use b58::{encode, decode, encode_with_alphabet, decode_with_alphabet, Alphabet};

// Using default Bitcoin alphabet
let data = b"Hello, World!";
let encoded = encode(data);
let decoded = decode(&encoded).unwrap();
assert_eq!(data, decoded.as_slice());

// Using Ripple alphabet
let encoded_ripple = encode_with_alphabet(data, Alphabet::Ripple);
let decoded_ripple = decode_with_alphabet(&encoded_ripple, Alphabet::Ripple).unwrap();
assert_eq!(data, decoded_ripple.as_slice());

Enums§

Alphabet
Enum representing different Base58 alphabets.
DecodeError
Error type for Base58 decoding failures.

Functions§

decode
Decodes a Base58 string into a byte vector using the default Bitcoin alphabet.
decode_with_alphabet
Decodes a Base58 string into a byte vector using the specified alphabet.
encode
Encodes a byte slice into a Base58 string using the default Bitcoin alphabet.
encode_with_alphabet
Encodes a byte slice into a Base58 string using the specified alphabet.