I recently made two simple shell one-liners to practice memorizing and checking my passphrases - without ever storing them. Commented versions (note that this is using GnuPG 1 - you have to adjust the commands for GnuPG 2):
pwhash()
{
# Password Hash
#
# Uses GnuPG to encrypt an empty file
# with the password, thus storing a
# secure salted hash of the password.
: | gpg --symmetric --cipher-algo AES256 >"$1"
# `:` is the no-op shell command,
# and thus the pipe reads empty.
}
pwcheck()
{
# Password Check
#
# Tries to use GnuPG to decrypt a given
# file with the password, which fails
# unless the password is correct.
gpg --decrypt --quiet <"$1"
}
So as an example of usage, I might do
pwhash ~/memory/tumblr.com
then type my Tumblr password twice, as you'd expect from any proper password input where the correctness upon initial storage matters, and then when I want to practice or check it, I would do
pwcheck ~/memory/tumblr.com
You can of course use this for memorization of any sensitive information, not just passphrases. Pairs well with any automatic file synchronization or cloud storage solution. I'd like to connect this to a spaced repetition system somehow, but my forgetting sense is good enough now that I can do without.
















