in reply to Re: String differs from printing to STDOUT and printing to file
in thread String differs from printing to STDOUT and printing to file
Pipe the script to file and you should see it.#!/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";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: String differs from printing to STDOUT and printing to file
by haukex (Archbishop) on Oct 23, 2019 at 10:59 UTC | |
|
Re^3: String differs from printing to STDOUT and printing to file
by rjt (Curate) on Oct 23, 2019 at 11:05 UTC | |
by cboesch (Initiate) on Oct 23, 2019 at 11:30 UTC |