yabase/base32/crockford
Values
pub fn decode(
input: String,
) -> Result(BitArray, encoding.CodecError)
Decode a Crockford Base32 string to a BitArray. Accepts hyphens (ignored). O->0, I/L->1. Case-insensitive.
pub fn decode_check(
input: String,
) -> Result(BitArray, encoding.CodecError)
Decode a Crockford Base32 string with check symbol verification. The last character is the check symbol; the rest is the encoded data. Returns Error(InvalidChecksum) if the check symbol does not match.
pub fn encode(data: BitArray) -> String
Encode a BitArray to Crockford Base32 string. The input is treated as a big-endian unsigned integer and converted to base 32 using Crockford’s alphabet.
pub fn encode_check(data: BitArray) -> String
Encode a BitArray to Crockford Base32 with a check symbol appended. The check symbol is computed as the numeric value of the data mod 37, mapped to the 37-character check alphabet (0-9A-Z plus *~$=U).