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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.