in reply to 32 Character limit
That's a very unsafe way of doing things! You should be calling encrypt once, not once per line.
encrypt(join("\n", @$input), $key)
I do get garbage at character 32 (or thereabouts, I didn't look closely) when I use your version. I didn't spend any time finding out why because it goes away if you encode once as I urged you to do above.
... my ($action, $file, $key) = @ARGV; my $input; { open(my $fh, '<', $file) or die("Can't open $file: $!\n"); binmode($fh); local $/; $input = <$fh>; } if ($action eq '-e') { print encrypt($input, $key); } else { print decrypt($input, $key); }
$ diff -au a.pl <( perl a.pl -d <( perl a.pl -e a.pl key ) key ) $
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: 32 Character limit
by z662 (Initiate) on Feb 09, 2011 at 20:45 UTC | |
by ikegami (Patriarch) on Feb 09, 2011 at 21:33 UTC | |
by z662 (Initiate) on Feb 11, 2011 at 01:11 UTC | |
by z662 (Initiate) on Feb 15, 2011 at 23:50 UTC | |
by ikegami (Patriarch) on Feb 16, 2011 at 00:51 UTC |