Sunday, May 25, 2008

Generating Passwords

Choosing a good password is a difficult task. If you don't have to type it everyday (like your wireless home network's password for example), you can just generate a random string and use it as a password. Once you set up your computer you won't need to type it again. But you may want to be able to regenerate it in case somebody else wants to use your wireless connection. So you want to generate a random looking string and unless you have a really strong memory to actually remember the string, you want to remember how to generate it.

You can just use a random number generator with a definite seed and generate a random string. The only thing to remember is the seed and the random number generator itself then. But that of course makes your password easy to figure out with trial and error. The next step would be to add some math in it. Instead of the random number generator, you can use an irrational number for example. Digits of irrational numbers look like randomly generated numbers.

There are 94 printable ASCII characters excluding space. It's a good idea to use all of them. Here is a Mathematica code to generate a password based on the digits of Pi.

FromCharacterCode[First@RealDigits[Pi^3, 94, 50] + 33]

This basically calculates the first 50 digits of Pi^3 in the base 94, so the numbers we get are in the range [0, 93] and shifts the numbers to map them into the range [33, 126] which is the range of printable ASCII characters in Mathematica. Finally they are converted to the printable characters that you can use as your password. Here is the result:

@!XL>033D#%5GQ7-W~~PP/s(a(pcUI(WY#;Yo-3]Gu4Gi;eqNV

Not bad, huh? You can try different functional relations that you can easily remember and different constants of course. Have fun!

What is fmunu?

This is the first post and hopefully won't be the last one. I will write about things I find interesting. I feel like it's going to be mostly about science but we'll see...