# Implement Enigma Cipher [closed]

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

1. Rotors used (Left to right). Will be three characters. Rotors 1-5 are valid.
2. Initial rotor settings (A-Z) Left to right.
3. Ring Setting, Left to Right.
4. Number of plugs (0-13)
5. 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 123MCKAAA0

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.

## closed as unclear what you're asking by Martin Ender, Geobits, feersum, Peter Taylor, captncraigFeb 2 '15 at 23:09

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• This question is missing a specification of the procedure for encrypting the text. – feersum Feb 2 '15 at 20:28
• The encryption details are specified in the Wikipedia links specified, as well as elsewhere on the web. What details would you like put here? – captncraig Feb 2 '15 at 20:30
• @CMP All details necessary to compete in the challenge. Challenge should be self-contained. – Martin Ender Feb 2 '15 at 20:31
• (To be clear, I don't think Enigma encryption is too much for an interesting code golf, but I also think the relevant information can be condensed sufficiently to fit nicely into the challenge spec, and you'd still have a much shorter specification than some other challenges. Just saying, if it doesn't fit in the challenge body, it's probably too elaborate to begin with.) – Martin Ender Feb 2 '15 at 20:48
• More than an exact spec, I'd like to see a well-written reference implementation. – xnor Feb 2 '15 at 22:40