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§
- Batch
Error - Why a batch of base58 strings could not be turned into bytes
- Decode
Error - Why a base58 string could not be turned into bytes
- Encode
Error - 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