For the love of computing: Did you mean 0 or O?

Prof Bill Buchanan OBE FRSE
Coinmonks
Published in
3 min readJul 30, 2018

--

We have all been in the position of not knowing if we have a zero (‘0’) or an ‘O’. So how do we avoid this? Well in the encoding of non-printing characters to printable ones we often Base-64, where we take six bits at a time and convert to a Base-64 character.

But what about similar-looking letters : 0 (zero), O (capital o), I (capital i) and l (lower case L), and non-alphanumeric characters of + (plus) and / (slash). The solution is Base-58 where we remove the characters which are similar looking.

In the conversion of a string to Base-58, we convert the ASCII characters into binary, and the keep dividing by 58 and convert the remainder to a Base-58 character. The alphabet becomes (notice that ‘0’ (zero), ‘O’ (capital ‘o’) and ‘I’ (capital ‘i’):

‘123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz’

So let’s take an example of ‘e’. With ‘e’ we have a decimal value of 101, so we divide by 58 to get:

1 remainder 43

and next we divide 1 by 58 and we get:

0 remainder 1

--

--

Prof Bill Buchanan OBE FRSE
Coinmonks

Professor of Cryptography. Serial innovator. Believer in fairness, justice & freedom. Based in Edinburgh. Old World Breaker. New World Creator. Building trust.