I'm using the command line tool
pwgen to generate passwords because I love the repeatability you get with the
sha1 command line flag. To quote the man page:
-H, --sha1=/path/to/file[#seed] Will use the sha1's hash of given file and the optional seed to create password. It will allow you to compute the same password later, if you remember the file, seed, and pwgen's options used. ie: pwgen -H ~/email@example.com gives a list of possibles passwords for your pop3 account, and you can ask this list again and again. WARNING: The passwords generated using this option are not very random. If you use this option, make sure the attacker can not obtain a copy of the file. Also, note that the name of the file may be easily available from the ~/.history or ~/.bash_history file.
I'm using it to generate (and retrieve) passwords like this:
pwgen -1cnsy --firstname.lastname@example.org
The only problem is that I can't figure out a way to specify how many characters I want the password to be. By default it generates an 8-character password, which is more susceptible to brute-forcing.
Alternatively, I could use
apg, which allows me to specify the number of characters, but I don't see a way to make
apg take a file and string as a seed to give me repeatable characters.
Is there a way I can make
pwgen generate passwords of a specified length?