cbingel has asked for the wisdom of the Perl Monks concerning the following question:
#!c:\perl\bin\perl.exe -w use strict; use Crypt::Twofish_PP; my $crypt = Crypt::Twofish_PP->new("innatelyinsecure"); if (!($ARGV[0])) { die "Syntax: crypt.pl (-e|-d) Text"; } elsif ($ARGV[2]) { die "incorrect syntax"; } elsif (!($ARGV[0] =~ /^-/)) { die "first argument must be mode. (-e or -d)"; } else { if ($ARGV[0] =~ /^-e$/) { my $result = $crypt->encrypt($ARGV[1]); print $result; }elsif ($ARGV[0] =~ /^-d$/) { my $result = $crypt->decrypt($ARGV[1]); print $result; }else{ print "Invalid mode argument (must be -e or -d)"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Good code reference
by cog (Parson) on May 11, 2005 at 13:42 UTC | |
|
Re: Good code reference
by reasonablekeith (Deacon) on May 11, 2005 at 14:20 UTC | |
|
Re: Good code reference
by Kevad (Scribe) on May 11, 2005 at 13:50 UTC | |
|
Re: Good code reference
by Transient (Hermit) on May 11, 2005 at 13:46 UTC | |
|
Re: Good code reference
by sh1tn (Priest) on May 11, 2005 at 13:47 UTC | |
|
Re: Good code reference
by DrWhy (Chaplain) on May 12, 2005 at 21:08 UTC |