Get a md5 of a string on a command line
One of the web applications I maintain stores md5 hashes in the database, instead of the actual passwords. This is a good practice - passwords are not stored in plain text, and knowing the has still does not give you a direct access to the system.
I whipped up this tiny shell script in order to easily get md5 hashes of strings on the command line (for example in case I need to go in and change some password directly in the database).
#!/usr/bin/perl
use Digest::MD5 qw(md5 md5_hex md5_base64);
print(md5_hex($ARGV[0]) . "\n")
This script takes a parameter string and prints out the md5 hash of that string to the standard output stream.
Related Posts:

January 11th, 2007 at 10:55 am (2405) [Quote]
Here is my version of the same thing . . .
I always seem to have openssl, but not always Digest::MD5.
Posted usingJanuary 11th, 2007 at 11:30 am (2406) [Quote]
Heh - I didn’t even think of that. I like yours better than mine now!
I think what we have here is programmer vs. admin way of thinking.
Programmer automatically goes “hey, I bet there is a [some-language] module/library for that somewhere…” when admin goes “I bet there is a tool for that somewhere…”
Posted using