Saturday, June 07, 2008

I had a couple submissions for ideas to use in today's application, but decided I would use one of my own. Friday night and all: girlfriends like to go out on Friday evenings, we need to go shopping, and later we want to watch a little TV together, so I didn't feel tonight was the best night for a big project.

My idea is a simple yet very useful application for generating random passwords.

image

Pocket PasswordGen

Nothing too fancy here. It's a good looking application, but it didn't take much to make it so. Just clean layout and simple design. I did add a horizontal ruler line between the inputs and the outputs. It is actually two panels set to 1 pixel high each with ones back color set to light blue and the other pure white. The form's background is just a little off-white to add some warmth, but it is hard to tell directly.

The application engine is also clean and simple. There is a password class that has properties for each of the options, and there are two methods: Generate, and ConvertToPhonetic.

I have four character groups:

     static string  lowerCase = @"abcdefghijklmnopqrstuvwyxz";
     static string upperCase = @"ABCDEFGHIJKLMNOPQRSTUVWYXZ";
     static string numbers = @"0123456789";
     static string punctuation = @"~!@#$%^&*()-+='"",.?";

Based on options the user chooses a character list is created with all possible characters for the user's password.

Next I Generate PasswordLength worth's of characters for the password.

This is very important. I use RNGCryptoServiceProvider to generate a random seed number for the random number generator. We want real random numbers, not wishy-washy random numbers. This is a good source for how to use Crypto providers to make a password generator.

Pretty cool code, so check it out if you haven't ever generated random numbers before.

I pulled the Phonetic Alphabet off Wikipedia and made it into a generic dictionary object.

Lastly, I added a menu item that allow users to copy the password to their clipboard. I had to write some code to copy text into the clipboard. This is the best code I could find for doing so.

BTW, there is a bug in the above screenshot. Fixed in the current release. Can you see it? It's subtle. It has to do with the handle the last character. Good luck finding it.

Download executable: passwordGen.cab

Download Source Code: passwordGen.zip

Feedback

Nothing but positive feedback so far. I really appreciate. It seems we are off to a good start. Still I have another 24 days left, and only a handful of ideas I really like. So don't keep that good idea to yourself. One comment on the blog and you might have yourself your first Windows Mobile custom application.


Theme design by Jelle Druyts

Pick a theme: