Tuesday, August 7, 2012

JavaScript Password Generator

With all the talk in the news today about securing our digital worlds, I thought it would be appropriate to throw together a simple javascript password generator.  The emphasis here is on "simple" because I see no reason to over-complicate things.  Here's how it works...

First, you supply a short phrase or word, choose whether or not the password should include spaces and then press "Go!"  That's it.  Give it a try:


  Include Spaces
    →     


If you'd like more detail, please, read on...


In short, the above password generator takes the word/phrase you provide and loops through each and every character.  In the process, each character is compared against an array of potential alternates/substitutions and a change is made.

For example, I've listed the following as potential substitutions for the letter "a":
  • a
  • A
  • @
Each time the letter "a" is present, the logic will randomly return one of the three characters listed above.  To see the entire list, check the source of this page.

If the "Include Spaces" option is selected, any spaces you include in your phrase will remain in place in the newly generated password.  Otherwise, all spaces will be stripped.  (Note:  In all cases, leading and trailing spaces are stripped.)

As I noted at the top of the article, this is a very simple password generator.  There are certainly more sophisticated and robust options out there, but I'm hopeful this will prove useful to at least a few readers of this blog.

~ b

No comments:

Post a Comment