base62.rs
A library for encoding/decoding byte arrays to/from a base62 strings.
Alphabet
This library defines the Base62 alphabet as the following characters:
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
How it works
A byte array (leading zeros allowed) is prepended with 0x01
and is treated
as a big-endian unsigned integer (num_bigint::BigUint
).
This number is repeatedly divided by our base, 62
, and each remainder is used as an index into our alphabet above,
producing the base62 encoded string.
To decode, we run the algorithm above in reverse.
Example