MD5 and SHA1 do not encrypt, they hash. You can't undo a hashing function, but you can decrypt something that was encrypted.
That may be what you want, but it wasn't clear from your question. (Even if you know this, let me clarify for others.)
The digesting modules like Digest::SHA1 take some source data and make a small fixed-length hash value that would otherwise be very difficult to reproduce with some different source data. They are useful in the same way a CRC (cyclic redundancy check) is useful, only moreso. Nobody can get the original source data out of a hash value. You know the source data hasn't been modified if you get the same hash value (aka digest) that they did. But you still have to send the full data in some way.
The crypt() function for /etc/passwd passwords works the same way: it's a hashing of the plaintext password. This is handy because nobody can get the original password back from the hash value. The password checker just checks to see if the user supplies any password that would hash to an identical value. Now several operating systems support MD5-generated hash values in addition to the weaker crypt(), but it's the same idea.
--
[ e d @ h a l l e y . c c ]
In reply to Re: Passing data from one script to another
by halley
in thread Passing data from one script to another
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |