![]() |
|
"be consistent" | |
PerlMonks |
Re^3: String differs from printing to STDOUT and printing to fileby rjt (Curate) |
on Oct 23, 2019 at 11:05 UTC ( #11107887=note: print w/replies, xml ) | Need Help?? |
encrypt() seems to NUL pad the string to the required block size: $plaintext .= "\0" x $trail;That's where your NULs are coming from. If you know that trailing \0s are not ever valid, you can strip them right before your return in decrypt(): $plaintext =~ s/\0+$//;On the other hand, if trailing NUL are a legitimate possibility, you will have to come up with a different plan, such as encoding the real length within your plaintext in encrypt() so you can trim it in the decrypt() sub.
In Section
Seekers of Perl Wisdom
|
|