#!user/bin/perl use warnings; use strict; my $plainTextIn = <; chomp $plainText; close $plainIn; open my $keyIn, "<", \$keyTextIn; my $key = to26(<$keyIn>, $testing); close $keyIn; my $cipherText = encrypt($key, $plainText, $testing); print ">>>>>>>>>>>>>\n" if $testing; my $decryptText = decrypt($key, $cipherText, $testing); print <= $i) || ($keylist[$i] lt $keylist[$permut[$j]])) { splice (@permut, $j, 0, $i); # Insert $i at position $j last; } $j++; } } return @permut; } #### -- to26:'secretmachine' -- Length of key: 13 --- Key: 'secretmachine' -- Plain text: 'abcdefghijklmnopqrs1234567890' -- Permutation: 7 2 8 1 4 12 9 10 6 11 3 0 5 -- Size of tableau: 39 -- 'abcdefghijklm' -- 'nopqrs1234567' -- '8900000000000' >>>>>>>>>>>>> -- Length of key: 13 --- Key: 'secretmachine' -- Cipher text: 'hcibemjkgldaf2p3or74516qns0009000000080' -- Permutation: 7 2 8 1 4 12 9 10 6 11 3 0 5 -- Size of tableau: 39 -- 'hcibemjkgldaf' -- '2p3or74516qns' -- '0009000000080' abcdefghijklmnopqrs1234567890 ----------- hcibemjkgldaf2p3or74516qns0009000000080 ----------- abcdefghijklmnopqrs12345678900000000000