Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Yes, piping the output to a file results in the same as printing to the file.
So it looks like the terminal does that.
Here is the code for the whole script:
#!/usr/bin/env perl use strict; use Crypt::Rijndael; use MIME::Base64; my $string = 'QeTEv2804'; sub encrypt { my ($plaintext) = @_; my $password = "uNsY3WSs0hTd"; my $trail = 16 - (length($plaintext) % 16 ); $plaintext .= "\0" x $trail; my $cipher = Crypt::Rijndael->new(pack("A32",$password),Crypt::Rijnd +ael::MODE_CBC()); $cipher->set_iv(pack("A16",$password)); my $crypted = $cipher->encrypt($plaintext); my $encoded = encode_base64($crypted); return $encoded; } sub decrypt { my ($ciphertext) = @_; my $password = "uNsY3WSs0hTd"; my $cipher_nonbase64 = decode_base64($ciphertext); my $cipher = Crypt::Rijndael->new(pack("A32",$password),Crypt::Rijnd +ael::MODE_CBC()); $cipher->set_iv(pack("A16",$password)); my $plaintext = $cipher->decrypt($cipher_nonbase64); return $plaintext; } my $enc = &encrypt($string); my $dec = &decrypt("$enc"); print "Decrypted --> $dec <--\n";
Pipe the script to file and you should see it.

In reply to Re^2: String differs from printing to STDOUT and printing to file by cboesch
in thread String differs from printing to STDOUT and printing to file by cboesch

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2023-09-26 22:50 GMT
Find Nodes?
    Voting Booth?

    No recent polls found