Crypt::OOEnigma::Commercial - A commercial Enigma machine circa 1940.
use Crypt::OOEnigma::Commercial; my $enigma = new Crypt::OOEnigma::Commercial; # or use Crypt::OOEnigma::Commercial; use Crypt::OOEnigma::Rotor; my @rotors = (); # Populate the list of Crypt::OOEnigma::Rotor Crypt::OOEnigma::Commercial->new( rotors => [@rotors] ); # or even use Crypt::OOEnigma::Commercial; use Crypt::OOEnigma::Rotor; use Crypt::OOEnigma::Reflector; my @rotors = () # Populate the list of Crypt::OOEnigma::Rotor my $reflector = new Crypt:OOEnigma::Reflector(params); # see relevant pod Crypt::OOEnigma::Commercial->new( rotors => [@rotors], reflector => $reflector); my $cipher = $enigma->encipher($mesg); my $decode = $enigma->encipher($cipher); # self-inverse # Also, for use internally: $enigma->init(); # returns the rotors to their initial state
This module provides a commercial Enigma machine consisting of a number of rotors and a reflector. If no Rotors are provided in the constructor, 3 default Rotors are used, each of which uses an identity substitution (ie no cipher at all in each rotor in start position 0).
Normally, you should create your own rotors and use those. See the documentation for Crypt::OOEnigma::Rotor for details.
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!
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
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
S J Baker, Ambriel Consulting, http://ambrielconsulting.com
This package is licenced under the same terms as Perl itself.