Skip to main content

Crate tape_base58

Crate tape_base58 

Source
Expand description

Base58 encoding and decoding for Solana-shaped data

Public keys and signatures get fixed-size paths that avoid the long division a general base58 codec performs. Everything else goes through a limb-based codec that is still far cheaper than the byte-at-a-time form. The widest instruction set the running machine supports is chosen at first use, so a build carrying no target flags still gets the fast path.

Enums§

BatchError
Why a batch of base58 strings could not be turned into bytes
DecodeError
Why a base58 string could not be turned into bytes
EncodeError
Why bytes could not be turned into a base58 string

Constants§

KEY_LEN
Bytes in a public key
MAX_ENCODED_32
Longest base58 encoding a 32-byte input can produce
MAX_ENCODED_64
Longest base58 encoding a 64-byte input can produce
MAX_VARIABLE_LEN
Longest input this codec converts in one piece
SIGNATURE_LEN
Bytes in a signature

Functions§

decode
Decode characters of any length up to the codec’s limit
decode_32
Decode a public key, rejecting anything that is not exactly 32 bytes wide
decode_64
Decode a signature, rejecting anything that is not exactly 64 bytes wide
decode_32_batch
Decode many public keys, one output each
decode_64_batch
Decode many signatures, one output each
decoded_len
Most bytes an encoding of this many characters can produce
encode
Encode bytes of any length up to the codec’s limit
encode_32
Encode a public key, returning how many bytes of the output were written
encode_64
Encode a signature, returning how many bytes of the output were written
encode_32_batch
Encode many public keys, one output slot of the maximum width each
encode_64_batch
Encode many signatures, one output slot of the maximum width each
encoded_len
Longest encoding an input of this many bytes can produce