package Enigmatic::RotorBox; use DAKKAR::p 'class'; use Enigmatic::Rotor; use Enigmatic::Types 'RotorT'; use MooseX::Types::Structured qw(Map); use MooseX::Types::Moose qw(Str); use Moose::Util::TypeConstraints; has rotorset => ( is => 'ro', isa => Map[Str,RotorT], lazy_build => 1, traits => ['Hash'], handles => { get => 'get', }, ); sub _build_rotorset { my %rotors = ( I => { wiring => 'EKMFLGDQVZNTOWYHXUSPAIBRCJ', notches => ['Q'] }, II => { wiring => 'AJDKSIRUXBLHWTMCQGZNPYFVOE', notches => ['E'] }, III => { wiring => 'BDFHJLCPRTXVZNYEIWGAKMUSQO', notches => ['V'] }, IV => { wiring => 'ESOVPZJAYQUIRHXLNFTGKDCMWB', notches => ['J'] }, V => { wiring => 'VZBRGITYUPSDNHLXAWMJQOFECK', notches => ['Z'] }, VI => { wiring => 'JPGVOUMFYQBENHZRDKASXLICTW', notches => ['M','Z'] }, VII => { wiring => 'NZJHGRCXMYSWBOUFAIVLPEKQDT', notches => ['M','Z'] }, VIII => { wiring => 'FKQHTLXOCBJSPDZRAMEWNIUYGV', notches => ['M','Z'] }, Beta => { wiring => 'LEYJVCNIXWPBQMDRTAKZGFUHOS', notches => [] }, Gamma => { wiring => 'FSOKANUERHMBTIYCWLQPZXVGJD', notches => [] }, ); $_ = Enigmatic::Rotor->new($_) for values %rotors; return \%rotors; }