Iterate from the beginning until you reach a non-zero byte. Base58 encode the non-zero byte and the following, and add
1s before the base58 string you made for each initial one zero byte (
0x00) you counted.
Zero bytes after the first non-zero byte don’t need special treatment.
(0, 13, 36), is encoded as
1211 since the value is
1 in base58 alphabet is
2. From here, you see that if it’s a multiple of 58, no special treatment is needed since the encoding is big endian and the
1s caused by 58’s powers are automatically appended to the back