pppassword.ahk

#AutoHotkey #Windows

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:

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:

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
}