# printing passwords: How can I differentiate l/1, o/O/0, etc and visualize spaces?

I would like to print randomly generated passwords, so that look-alike characters like zero and the letter "o" or one and the letter "l" are clearly distinguishable. I would also like to find a way to visualize spaces, I.e. I'm looking for a font that does that or an alternative to underscores (since the passwords may contain underscores)

So far the best I found is "Bitstream vera sans mono" in openoffice based on this: http://forums.overclockers.co.uk/showthread.PHP?p=16215032 (Strangely enough it's not listed in the font list, but if I type it in, it works. :/) "Lucida Console" doesn't seem to exist in openoffice/libreoffice.

I could of course regenerate the passwords without look-alike characters and spaces, but I would like to know if someone knows of a nice solution to this problem, ideally just a font with slashed zeroes and visible space characters.

-
You might simplify the problem a bit by eliminating a few troublesome characters such as space. Given the large character set of upper/lower letters, number and punctuation characters, I would eliminate spaces for instance without significantly reducing the combinatoric possibilities –  uSlackr May 27 '11 at 12:44
How about the OCR-A font? –  Linker3000 May 27 '11 at 12:48
Your OS might have DejaVu installed instead of Bitstream Vera. DejaVu is a fork of Bistream Vera that adds a lot of variants and extra support for other languages. –  afrazier May 27 '11 at 19:25

As @uSlackr said, eliminating the troublesome characters helps a lot, if you are generating these yourself.

That said, you'll want to look at fonts optimized for programmers, because they run into these kinds of problems all the time. Everyone's got an opinion, so Google for "programming fonts" and you'll finds lots of pages with samples to view, like this one. I'm very partial to Consolas myself:

Now, one thing you can do to help out with the visible whitespace is use Notepad2 as a text editor. (I use the Notepad2-Mod variant myself.) It has an option for visible whitespace, so tabs are denoted with an arrow and spaces with a small dot in the middle of the character space. This isn't just for display though, these will also print out. Below is a snapshot of a PDF created by printing from Notepad 2 with visible whitespace and indentation guides on:

All other Scintilla-based editors probably behave in the same way.

-

You could do it like banks print their PIN numbers - both normally and phonetically.

So the password 'h30yg28fi1' would be also written:

AICH THREE ZERO WHY GEE TWO EIGHT EFF EYE ONE

or something similar.

That would differenciate "oh", "OH" and "ZERO", "eye", "EYE", "ell", "ELL" and "ONE" quite well.

-

Sorry for the late feedback. I used this solution in the end (bitstream vera font in latex with verbatim*):

\documentclass{article}

\usepackage{bera}

\begin{document}

% text using bera font (Bitstream Vera), which has dotted zeroes
% the * after verbatim adds visible spaces
\begin{verbatim*}'1 l oO0}4 _i6D-WtF#q\end{verbatim*}

% visible space
hello\textvisiblespace world

% slashed zero
\o

\end{document}


I left a few of the other things I tried as well.

To create a pdf from it:

pdflatex password_printing_4.tex


If you get any errors, try simply installing texmaker. It depends on most necessary latex packages:

sudo apt-get install texmaker


I also tried the inconsolata font in latex, but it doesn't seem to be the same:

\documentclass{article}

\usepackage{inconsolata}
%\usepackage{bera}

% requires texlive-xetex package:
\usepackage[xetex]{graphicx}
%\usepackage{fontspec,xunicode}
%\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
%\setmainfont[Scale=.95]{Inconsolata}

\begin{document}

% text using bera font (Bitstream Vera), which has dotted zeroes
% the * after verbatim adds visible spaces
\begin{verbatim*}!=}k o6~-cRR1loO0\end{verbatim*}

%\renewcommand{\bera}{\inconsolata}
\texttt{This is Inconsolata. zero: 0}

%\renewcommand{\inconsolata}{\bera}
\texttt{This is Bera. zero: 0}

% visible space
hello\textvisiblespace world

% slashed zero
\o

\end{document}
`
-
This looks like the best answer and is also how the asker (you :)) chose to solve the problem in the end. Why not accept it? –  user112553 May 5 '13 at 19:03
Well, maybe because I posted it? Anyway, yes, accepted. :) –  KIAaze May 6 '13 at 15:45