Looking at the documentation for Crypt::Simple, it is apparently only the encryption phase which takes a passphrase.  Therefore, it appears you will always get your encrypted data successfully decrypted when using decrypt.

That's not to say the passphrase doesn't matter, though.  You can verify that using a different passphrase produces different results:

#!/usr/bin/perl -w + use strict; use warnings; + use Crypt::Simple qw(encrypt decrypt); + my $data1 = encrypt("Here we go", passphrase => 'myTestPhrase'); my $data2 = encrypt("Here we go", passphrase => 'AnotherTestPhrase'); print "Encrypted(1): $data1\n"; print "Encrypted(2): $data2\n"; + my $result1 = decrypt($data1); my $result2 = decrypt($data2); print "Decrypted(1): $result1\n"; print "Decrypted(2): $result2\n";
which produces ...
Encrypted(1): Qf9g4cqQ/6xXgqvcPLJA6u9PZ4jPgegPrsBCsFaPch3LDsaN6TjN6xjL +jebw4yPFNO2rEBTUgISSkiX1v2Aelt4qmHFcd6nF Encrypted(2): qymmKtF/LXb+HIZe6ZCFS8xtLadYkS+09dZ8zxAvL+r9Rw+GjkeBMc8y +e++Yl/s/DxJppvKQm2ToJ78mENTuxcc8fUMrKdZbHuWGiMBxgK0= Decrypted(1): Here we go Decrypted(2): Here we go

s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

In reply to Re: Crypt::Simple Passphrase Issue by liverpole
in thread Crypt::Simple Passphrase Issue 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.