A couple of months ago (around the same time that I was looking into the sources of the .Net version of KeepPass) I ran into this page: an algorithm to generate pronounceable passwords1. Well, at least a bit more pronounceable than the ones generated by password generators like the one that is used in KeepPass.

The original code was written in Java (by Thom van Vleck, if I’m not wrong) and it appears that there’s also a C++ version available.

Not to be outdone by these formidable programmers, I converted most of the code to C#: I don’t dare to say ‘porting’, which it obviously isn’t. However, I made drastical changes to how the GPWData class is being called: all of the functionality now is IN this class (including password generation and initialization). This makes more sense and it’s also a bit more elegant to use, as shown in the following example:

            GPWData npdata = new GPWData();            
            npdata.GeneratePasswords((int)numPasswords.Value , 
                (int) numPasswordL.Value);
            foreach (string s in npdata.Items)
                textPasswords.Text += s + "\n";

I dumped the code in the Public Domain which means that you can use it for whatever you wish to use it as long as you credit me and the original authors. Go grab the sources. The zip-file only contains the sources: I generally don’t add executables to full-source projects. Also, the target platform is .Net 2.0.

1 From that Multics page: The routine was modeled after Morrie Gasser’s ‘Random Word Generator for Pronounceable Passwords’. The original routine was then standardized (adapted might be a better word) by the NIST

This entry was posted in Programming and tagged , . Bookmark the permalink.