Jason's weblog post about using one password everywhere inspired this script, which generates a base-80 hash of your input string.
Feel free to replace MD5 with SHA1 or even `echo #{line} | sha -5`, to make it harder to guess which hashing mechanism was used.
Requires highline, which you can get with "gem install highline".
Warning! This does not echo your input string to the screen; when generating passwords for sites, you might want to generate it twice, to make sure you don't have any typos.
require 'digest/md5'
require 'rubygems'
require 'highline/import'
CHARS = ("a".."z").to_a + ("A".."Z").to_a + (0..9).to_a + ["!","@","#","$","%","&",
"*","-","_","=","+",":","<",">",".",",","?","~"]
line = ask("enter your string: ") {|q| q.echo = false}
n = Digest::MD5.hexdigest("#{line}").hex
pass = []
while n > 0
pass << CHARS[n.divmod(CHARS.size)[1]]
n = n.divmod(CHARS.size)[0]
end
puts pass.to_s
chmod 7xx it and run it, and there you go!
example:
albus:~ matt$ ./password.rb
enter your string:
6irO:B=5MFiOcb6Uv3ER