Expand description
Base32 and base64, in the two exact dialects atproto uses.
Both are strict, because the one property this whole crate exists to hold is that a value has exactly one encoding. Each refuses padding, and each refuses a final character whose unused low bits are set, which would decode to the same bytes and re-encode to a different string.
- base32, lowercase, no padding, RFC 4648 alphabet. This is multibase
b, which is the only string form atproto permits for a CID. - base64, standard alphabet (
+and/, not the URL-safe pair), no padding. This is the$bytesrepresentation in the JSON form of the data model, and thebase64crate’sSTANDARD_NO_PADengine, which refuses both.
Enums§
- Decode
Error - Why a string is not valid lowercase unpadded base32.
Constants§
- BASE32 🔒
- The lowercase RFC 4648 base32 alphabet, which is multibase
b.
Functions§
- base32_
decode - Decodes lowercase unpadded base32.
- base32_
encode - Encodes lowercase unpadded base32.
- base64_
decode - Decodes standard unpadded base64.
- base64_
encode - Encodes standard unpadded base64.
- decode 🔒
- Decodes a bit-packed string in
alphabet,bitsbits per character, under both strictness rules: no padding, and no set bits beyond the last whole byte. - encode 🔒
- Encodes bytes bit-packed into
alphabet,bitsbits per character.