Encoding: base-256 to base-58
The input byte string is treated as one large base-256 integer and repeatedly divided by 58; each remainder maps to one alphabet character. Division yields the least-significant digit first, so the remainders are collected in that order and then reversed so the output reads most-significant digit first. Any leading 0x00 bytes in the input become leading '1' characters in the output rather than being consumed by the division, which preserves the original byte length on decode.