


Returns a string which is the encoding/decoding of text. EnigmaMachine.encodeString() Syntax enigmaMachine.encodeString(text) Defaults to an empty string (no substitutions). This represents the letters that should be switched on the plugboard (or Steckerbrett). A string containing a list of pairs of letters separated by spaces. A string which represents the reflector type used. An array of integers which represent the ring settings (or Ringstellung) of the rotors. An array of integers which represent the positions of the rotors. Therefore the left-most rotor will not rotate. If the Enigma Machine is initialized with four rotors, it is assumed the left-most rotor is a Beta/Gamma rotor in an M4. The array expects 3 items (to simulate the Wehrmacht Enigma I or Kriegsmarine M3) or 4 items (for the Kriegsmarine M4). Kriegsmarine M4, fourth rotor, didn't rotate, used with thin reflectors An array of strings which represent the rotor types to use in which position (left to right).

M4.encodeString( 'ABC') // 'BPF' Documentation enigma() Syntax enigma(rotors, positions, ringSettings, reflector, plugboardPairs) Or create an Enigma machine with your own settings (rotors, positions, ringSettings, reflector, plugboardPairs): var m3 = enigma(,, , 'C', 'AS TH LR') Ĭreate a Kriegsmarine M4 Enigma Machine: var m4 = enigma(,, , 'BThin') Require the enigma-simulator module: var enigma = require( 'enigma-simulator') Ĭreate a Wehrmacht Enigma I Machine with a B reflector and rotors III, II, I with default positions and ring settings: var e1 = enigma() It can simulate a Wehrmacht Enigma I and Kriegsmarine M3 and M4 variants.
