Module base58_monero::base58 [−][src]
Expand description
Base58 encoder and decoder functions and constants
Stream Examples
Async streams can be used with the stream
feature:
use futures_util::pin_mut;
use futures_util::stream::StreamExt;
use base58_monero::{encode_stream, Error};
async {
let mut input: &[u8] = b"Hello World";
let mut w: Vec<char> = vec![];
let s = encode_stream(&mut input);
pin_mut!(s);
while let Some(value) = s.next().await {
w.push(value?);
}
let s: String = w.into_iter().collect();
assert_eq!("D7LMXYjUbXc1fS9Z", &s[..]);
}
Async decoding with decode_stream
and decode_stream_check
is available with the features check
and
stream
enabled:
use futures_util::pin_mut;
use futures_util::stream::StreamExt;
use base58_monero::{decode_stream_check, Error};
async {
let mut input: &[u8] = b"D7LMXYjUbXc5LVkq6vWDY";
let mut w: Vec<u8> = vec![];
let s = decode_stream_check(&mut input);
pin_mut!(s);
while let Some(value) = s.next().await {
w.push(value?);
}
assert_eq!(b"Hello World", &w[..]);
}
Enums
Possible errors when encoding/decoding base58 and base58-check strings
Constants
Base58 alphabet, does not contains visualy similar characters
Size of checksum
Resulted block size given a 0..=8
bytes block
Maximum size of block to encode
Size of an encoded 8 bytes block, i.e. maximum encoded block size
Functions
Decode base58-encoded string into a byte vector
check
Decode base58-encoded with 4 bytes checksum string into a byte vector
stream
Decode base58-encoded stream in a byte stream
check
and stream
Decode base58-encoded stream with a 4 bytes checksum in a decoded byte stream
Encode a byte vector into a base58-encoded string
check
Encode a byte vector into a base58-check string, adds 4 bytes checksum
stream
Encdoe a byte stream in a base58 stream of characters
check
and stream
Encode a byte stream in a base58 stream of characters with a 4 bytes checksum
Type Definitions
Utility type for handling results with base58 error type