encode.pl untested

filter: Statementstmt 0.0% 0 / 18 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 1 Podpod n/a totaltotal 0.0% 0 / 21 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
CRAP 2.0
1 #!/usr/local/bin/perl -w
2 use Crypt::Enigma;
3  
4 if (! $ARGV[0]) {
5 print "Usage: $0 <ROTORS> <RINGS> <INTIALSETTINGS> <INPUT>\n";
6 exit ();
7 }
8  
9 $rotors = $ARGV[0];
10 $rings = $ARGV[1];
11 $initial_settings = $ARGV[2];
12 @input = split (//, $ARGV[3]);
13  
14 $enigma = Crypt::Enigma->new ();
15  
16 $enigma->setup ($rotors, $rings, $initial_settings);
17 $enigma->stekker ("a", "b");
18  
19 foreach $input (@input) {
20 $output = $enigma->input ($input);
21 $results .= $output;
22 }
23  
24  
25 print "Input is $ARGV[3]\n";
26 print "Result is $results\n";