Generates PwdHash passwords from the command line.

What is this?

This is a simple Ruby command line tool to generate hashed passwords, using PwdHash's algorithm.

PwdHash was written as a browser plugin, but sometimes we'd like to extend its use to desktop applications too. e.g. IM clients, Dropbox, etc. just to name a few.

This tool is essentially a straight copy of Chris Roos' implementation, with a couple of command line interface improvements:

  1. The password is masked properly when the user is typing it.
  2. The realm is specified as an argument instead of prompted.
  3. The prompt text is sent to STDOUT instead of STDERR so the output can be piped to e.g. xclip or putclip.

What is PwdHash?

Standford PwdHash helps you create theft-resistant passwords for each realm (domain name). In the case that your email password gets stolen, the attacker won't be able to log in your PayPal account to transfer all your money, even though you only have to remember one password for all logins. The USENIX Security Symposium 2005 paper (PDF) explains it in details.


gem install pwdhash


$ pwdhash
Password for

$ pwdhash | xcilp # Put generated password to X clipboard
$ pwdhash | pbcopy # Or in OS X
> pwdhash | clip # Or in Windows
$ pwdhash | putclip # Or in Cygwin


The library part of this tool is a straight copy of Chris Roos' implementation. The reason this git repository is set up is because: a) Chris Roos decided to put the code in an obscure corner in a pile of code which makes it hard for people to find and b) GitHub uses git :p

The PwdHash plugin and the PwdHash algorithm is contributed by Stanford PwdHash.