Module nix_compat::nixbase32
source · Expand description
Implements the slightly odd “base32” encoding that’s used in Nix.
Nix uses a custom alphabet. Contrary to other implementations (RFC4648), encoding to “nix base32” doesn’t use any padding, and reads in characters in reverse order.
This is also the main reason why we can’t use data_encoding::Encoding
-
it gets things wrong if there normally would be a need for padding.
Constants§
- ALPHABET 🔒
- This maps a nixbase32-encoded character to its binary representation, which is also the index of the character in the alphabet. Invalid characters are mapped to 0xFF, which is itself an invalid value.
Functions§
- Returns decoded input
- Returns the decoded length of an input of length len.
- Returns encoded input
- Returns the encoded length of an input of length len