Your task is to implement an Enigma encryption machine. Your program will accept the machine initialization information followed by a string of text to be encrypted.
Initialization vector will be
- Rotors used (Left to right). Will be three characters. Rotors 1-5 are valid.
- Initial rotor settings (A-Z) Left to right.
- Ring Setting, Left to Right.
- Number of plugs (0-13)
- N pairs for the plugboard.
After the initialization vector, encrypt all text until a newline (0xA) character is encountered. Any text not in the A-Z range (including lower case for simplicity) should be output as is.
You can compare output against
this simulator. The initialization vecotr for the default state is
If you click 'set from passkey' and enter 'codegolf', your equivalent initialization vector is
245FZPPAM10FTJQAOHGMYCKWRIXVPES With this setting,
baaaaaaaaaaa... should translate to
OXVXI NSRPS RGUXY XZVGB QUNJH TWTVD JNPSI TBWKJ XCVNR IUUVK LJWXV OMCGL VQOKD TVJVW HCFZF DBDQS FYECN SDTPC GESYN OWGNZ WWSYQ WJJBT GVMQM GUUVC XZNCV EPGLM MCNHY KLRJC LISZZ PTYIZ GIEUP OPZUI DPZZZ ULXFZ ONGRI WETGU CICMT KKQBW ZJMNL BZSLJ TLMGR RMZDZ BCNGM RYRGJ MKXRF JKQGG PYZFD UUZRE EIKPD OFUPE XODND DFXKY OHXHX ODWDC SXFPV. This should fully test a double stepping scenario.
You may assume the Initialization vector will be valid. Rotors will be in required range, no letter will be used in multiple plugs, etc. Only Reflector B will be used.
All needed info (rotor wirings etc...) must be included in your program, not fetched from an outside source. Most details you need are on wikipedia.
Shortest code wins.