NAME
Crypt::OOEnigma::Rotor - The Rotor object for use in Crypt::OOEnigma
SYNOPSIS
my $rotor = Crypt::OOEnigma::Rotor->new();
# OR
my $subHash ={ # the substitution code for the cipher for all A..Z
A => "Z",
B => "G",
# etc
};
my $freq = 2 ; # The number of letters enciphered per rotation
my $start_position = 20 ; # modulo 26
my $rotor = Crypt::OOEnigma::Rotor->new(cipher => $subHash,
freq => $freq
start_position => $pos);
# for internal use by Enigma machines:
$rotor->init(); # returns the Rotor to its initial state
my $op = $rotor->encode($some_letter); # encode a letter in the forward direction
$op = $rotor->revencode($some_letter); # encode a letter in the reverse direction
$rotor->next(); # prepare for the next encoding, rotating as required
$rotor->rotate(); # rotate to the next position
DESCRIPTION
This is the Rotor for use in Crypt::OOEnigmas. Use it when you want to create your own Enigmas with specific properties.
NOTES
None
BUGS and CAVEATS
Enigma is weak!
Cryptographers talk of the strength of a cryptographic algorithm in term of whether it is computationally feasible to break it. It is, of course, computationally feasible to break an Enigma cipher so don't use it for anything serious!
HISTORY
This package was created in spring 2002 as an exercise in OO Perl and preparing modules properly for CPAN. More importantly, the Enigma is interesting.
CPAN already has a Crypt::Enigma which is not object oriented and implements only one Enigma (whereas you can create any Enigma-like machine with these objects). Hence the package name Crypt::OOEnigma
SEE ALSO
The Pleasures of Counting, T W Korner, CUP 1996. A great book for anyone with the slightest interest in mathematics: ISBN 0 521 56087 X hardback ISBN 0 521 56823 4 paperback
The Enigmas: Crypt::OOEnigma::Military Crypt::OOEnigma::Commercial
The components: Crypt::OOEnigma::Rotor Crypt::OOEnigma::Reflector Crypt::OOEnigma::Plugboard
AUTHOR
S J Baker, Ambriel Consulting, http://ambrielconsulting.com
COPYRIGHT
This package is licenced under the same terms as Perl itself.