in reply to Is there any module which can convert the Digest MD5 encoded string back to plain text?

As has already been stated, MD5 is a one-way algorithm. If you want something that can encode and decode as well, you may wish to look at Crypt::OpenSSL::AES.

Digests/Hashes vs [En|De]cryption Examples

MD5 and other one-way hashes/digests like the SHAs (Wikipedia link) can be used to store representations of passwords in a database. If some villain were to get into the database, they would not be able to see the passwords - only the digests. Validating the passwords would involve taking the password from the user, creating the hash/digest and comparing it with the hash/digest stored. But there is no way to get the original value back.

If, however, you wanted to store a string securely in a database but still be able to get back at the original value (such as if you were storing payment details, medical details, etcetera,) that is when you would use something like AES (Wikipedia link), which does encryption and decryption using a key. (Note that these digests don't use keys.)

Just for reference, if you are working with MySQL, functions md5(), sha1(), aes_encrypt() and aes_decrypt are built in (at least in versions 5.x,) so you have the option of doing these in the database if you don't want to do them in Perl. (Handy if you use stored procedures.) MySQL Encryption and Compression Functions refers.

  • Comment on Re: Is there any module which can convert the Digest MD5 encoded string back to plain text?