base32_encode(string $data, bool $pad = true): string Encodes $data using the standard RFC 4648 alphabet (A-Z, 2-7). When $pad is true (default), pads output with = to a multiple of 8 characters.
base32_decode(string $encoded): string Decodes an RFC 4648 Base32 string (case-insensitive, padded or unpadded).
Crockford Base32
base32_crockford_encode(string $data): string Encodes $data using Douglas Crockford's Base32 alphabet (0-9, A-Z excluding I, L, O, U), without padding.
base32_crockford_decode(string $encoded): string Decodes a Crockford Base32 string. Case-insensitive; ignores - separators; maps I/L to 1 and O to 0.
Base58
base58_encode(string $data): string Encodes $data using the Bitcoin Base58 alphabet (123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz), preserving leading zero bytes as '1'.
base58_decode(string $encoded): string Decodes a Base58 string back to raw bytes.
Error Handling
All decoders validate input strictly and throw Exception with clear, descriptive messages prefixed with base32::
Invalid characters: base32: invalid character '!' at position 3
Invalid padding placement: base32: unexpected character 'A' after padding at position 4
Invalid padded length: base32: padded input length must be a multiple of 8, got 5