pppassword.ahk
This AutoHotkey script generates a pseudo-random password and outputs it to the currently active text field. Just press the p
key three times in succession to generate a new password.
I wanted to make the text easy to remember, but hard to crack with a brute force attack (explained nicely by XKCD-936 and more in detail on the wiki page).
There are a two main things that I wanted to accomplish with this quick script:
- Create a semi-strong password that will be easy to remember, but hard to crack.
- Be able to give someone the password over the phone without being complicated (“Okay, your new password is '!!FishHook66871', but the O's are zeros, and the I is a 1, and there are two exclamation marks at the beginning, and, and...” or “The first letter is capitalized in the password, also the second H”).
To do both of those things, I decided on a unique phrase using a color, a fruit, a two-digit number, and a punctuation character. The color and fruits will have a capitalized first letter. This combination creates a human readable and memorable string, but rated on password checkers, is exceptionally strong. Some sites estimate that it would take an average of tens of thousands, if not millions, of years to crack.
With that decided, I also wanted to make sure these had following criteria:
- Colors and fruits should not have the same first letter. It could be confusing to say “Capital B” if Blue and Banana are both used.
- Colors and fruits need to be non-offensive in any interpretation or culture.
- Symbols need to be accessible on a non-American keyboard layout (no currency symbols or “dead” accent keys.)
With all of that done, I wrote the following script:
#SingleInstance force
; Press the P key 3 times in a row to type a new password.
ListOfColors:=["Red", "Orange", "Yellow", "Green", "Blue" ]
ListOfFruits:=["Apple", "Kiwi", "Lemon", "Mango", "Peach"]
ListOfSymbols:=["{!}", "{@}", "{#}", "{%}", "{&}", "{*}"]
:R*?:ppp::
Send % ListOfColors[Random(1, ListOfColors.MaxIndex())]
Send % ListOfFruits[Random(1, ListOfFruits.MaxIndex())]
Random, Random, 1, 9
Send % Random
Random, Random, 1, 9
Send % Random
Send % ListOfSymbols[Random(1, ListOfSymbols.MaxIndex())]
return
Random(a, b)
{
Random, ReturnVal, a, b
return ReturnVal
}