Here are some ways to calculate an MD5 and SHA1 sum of a string.
In Bash
echo -e "joh316\c" | md5sum echo -e "joh316\c" | sha1sum
The switch -e enables the interpretation of escape sequences and \c (‘End of Text’) suppresses any further output.
In MySQL
SELECT md5('joh316'); SELECT sha1('joh316');
In PHP5
php5 -r "echo md5('joh316');" php5 -r "echo sha1('joh316');"