I am currently writing a paper in my old age for the fun of it. I feel that the enigma machine had gotten a bad wrap for some of its flaws. I decided to write a machine simulation to see if I can correct some of these flaws. The part of the "not being able to encode a character unto itself" isn't as large a flaw as first presented. In my version, I eliminated that flaw. At least, that is what it looks like.
I set up a test to ensure that it can encode to itself. And still be decrypted properly. I created an input file of fifty "A". Ran the encryption/decryption and, indeed, was able to encode 21 "A"'s to itself out of 50 characters, 42% of the data. Other test with others character types showed about the same results, between 9-21 characters. In an unrelated test, I saw this occur again.
So, the fix I believe was to treat the reflector like a plug board. I just randomly build character pairs for the plugboard. And then, just randomly build an alphabet string ensuring there no dups.
I think, the engineer that built the reflector may have put too much effort ensuring that a single entered from one end, had to exit on the opposite side of the reflector. I was planning on adding more notches to spin the rotors more. I thought that if I could make the last (left) rotor actually change more often, that it would have a better scramble. But, I hadn't coded that far, when I notice that it could encipher to itself.
Does this make sense? Am I off track on this?
Support files:
Input
Encrypted
Decrypted
Device Log
MSG: >>> Begin Encrypt <<<
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encrypt()|Line: 88
MSG: Message Size: 50 MSG: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:-
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:)
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:L
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:'
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:Z
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:I
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:(
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:J
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:N
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:U
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:W
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:8
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:Q
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:8
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:)
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:8
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:-
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:R
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:'
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:6
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:5
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:,
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:2
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:Z
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:K
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:D
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:3
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:'
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:S
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:I
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 169
MSG: Input char:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encode()|Line: 195
MSG: Output cipher:A
2023.05.15 19:20:57|INFO|PGM: Device|FNC: Encrypt()|Line: 102
MSG: Encrypted Size: 50 Cipher: -)L'AZIAAA(AAJNAUWAA8Q8)A8-ARAA'6AAA5,AA2ZKDA3'SIA