A Simple Guide to Encryption
Hashes for Small Data
As discussed in Hash Functions, hashes are unique in that they do not actually contain the original plaintext. Hashes can't be decrypted to reveal the original message, and hashes created using the same cipher are all the same length, unlike other encryption ciphers, where the length of the plaintext is the same as the length of the ciphertext. While it seems that this may prevent hash functions from being very useful, these unique characteristics actually allow hash functions to be used in applications where other types of encryption aren't optimal.
The hash function most often used to encrypt passwords is called MD5. Because of the nature of passwords and authentication, hashing is often built into other programs. For this reason, most of the methods to create an MD5 hash are available only as modules or libraries to programming languages. We will address the Perl and PHP programming languages here.
Hashing Passwords with Perl
Hashing Passwords with PHP
Hashing Files in Linux
Linux has a commandline utility called "md5sum" which takes a filename as an argument. When used in the following context, md5sum will print the digest of the file named "filname.txt."
[user@localhost ~]$ md5sum filename.txt