AENIG4(1)

NAME
aenig4 - Enigma M4 Cipher Machine Emulator

SYNOPSIS
aenig4 [OPTION]... [ SOURCE DEST ]

DESCRIPTION

aenig4 emulates the Enigma M4 cipher machine used by the U-Boot division of the German Navy during World War II. It can be used as well to emulate the Enigma I machine (M1, M2, M3).

If SOURCE and DEST are specified, encode the SOURCE file into the DEST file. If not, the program will run in interactive mode, unless the option --filter is given, in which case stdin will be encoded to stdout.

Only the characters ABCDEFGHIJKLMNOPQRSTUVWXYZ and the lower case equivalents are encoded. Anything else is left unchanged.

OPTIONS

-h, --help
    Display this help and exit.

-v, --version
    Output version information and exit.

-l, --license
    Display the license text and exit.

-f, --filter
    Encode stdin to stdout.

-k, --key=KEY
    Set the initial machine configuration. For example: -k "c Gamma V IV I 1 26 2 3 RTJZ BT RJ".

KEY

With -k an initial machine configuration can be specified which causes the encoding to be different. Using the program with an encoded text will return the original text if used with the same initial key.

The default machine configuration is: b Beta I II III 1 1 1 1 AAAA. This means that the rotors UKW-b, Beta, I, II and III are installed on the machine, in that order. The rings on the last 4 rotors are set to position 1, and these same rotors are moved to the position A. There are no connections made on the plugboard.

The first rotor can be b or c, to set the UKW-b or UKW-c reflectors. The second can be Beta or Gamma. The next 3 rotors can be selected from the roman numbers I to VIII, but they can not be repeated. The position of each ring is a number from 1 to 26. And the position of each rotor, a letter from A to Z. Finally, the connections made on the plugboard can be specified by a list of letters in pairs.

For example, -k "c Gamma V IV VIII 2 6 1 9 JRWZ AT PV", will set the rotors c, Gamma, V, IV and VIII on the machine. It will set the ring on the rotor Gamma to the position 2 and move this same rotor to position J. The rings on the rotors V, IV and VIII will be set to positions 6, 1 and 9, respectively; and these rotors moved to positions R, W, Z. Finally, it will connect the letter A with T, and P with V, on the plugboard.

INTERACTIVE MODE

When the program starts in interactive mode, it prints the current machine configuration. Initially, it is:

b Beta I II III 01 01 01 01 AAAA

Type 'help' on the program prompt to see the commands that you have available in order to change the machine configuration.

To encode any message, type 'in' followed by a sentence (max. 70 chars):

> in HELLO
>>>> ILBDA

With the default settings, HELLO will be translated to ILBDA.

To decipher a message, you have to set the same settings as when you typed the original message, and enter the ciphered string. In this case:

> bases AAAA
> in ILBDA
>>>> HELLO

ENIGMA I

The Enigma M4 machine was compatible with the Enigma I if configured properly. To emulate an Enigma I with reflector UKW-B, you must set the Enigma M4 with the reflector UKW-b and the rotor Beta in position A with its ring at position 1. To emulate the Enigma I with reflector UKW-C, set the reflector UKW-c and rotor Gamma in position A and ring at position 1.

EXAMPLES

aenig4 -k "b gamma i v iv 1 2 3 4 rtvz km os" source.txt dest.txt
    Encode source.txt into dest.txt using the initial machine configuration given.

echo "HELLO" | aenig4 --filter | aenig4 --filter
    This will print HELLO back.

REPORTING BUGS
Report bugs to: <jorge.giner@hotmail.com>.
Home page: <https://jorgicor.niobe.org/aenig4>.

SEE ALSO

For more info about the machine, see:
<http://cryptomuseum.com/crypto/enigma/m4/index.htm>