Encryption/Decryption of Enigma Machine



I passed the all the tests for the Enigma Encryption/Decryption, but once submitted validators 4 and 6 fails.
My implementation seems to be correct as endoing+decoding brings the initial message back.
I encountered small issues when parsing parameters so I think my problem comes from inputs.

Edit: my decode function had a small bug in the reverse formula.
Fixed it and got the 100%


Same here !


Finally find it !


So did I.
Clue: Check the validity of the emitted letters (between ‘A’ and ‘Z’)


i don’t effing get it. and since i can’t see what are the issues with test cases 4 and 6, i have no clue what’s wrong. i’m pretty convinced i’ve got it right, but i don’t know what the program expects me to do if there are invalid characters. i’ve tried returning nothing when there are invalid characters. i’ve tried using ToUpper() to make them all uppercase. i’ve tried ditching the invalid characters but still process the rest. i dunno! it doesn’t work.


I’m guessing here but invalid characters probably mean that you went past the first or last letter of the rotor… in that case, just remember that you’re trying to match the behavior of something that’s a rotor in real life; a wheel; a circle. What happens when you make a full revolution?


thanks for the suggestion! i have done that already though, that’s why i’m stumped! i use mod 26 on the zero-normalized characters. for the decoding, i add 26 first so it doesn’t make a negative result and it cancels out with the mod 26. i mean, if it was faulty, it wouldn’t work with any case.


Your last sentence is a fallacy :wink:

My code worked the same way and failed the same tests until I did something. It’s a simple thing and it has to do with the size of the original message. I don’t want to completely give it away here but if you still have trouble, PM me and I’ll share it.


thank you, you are damn right. i needed this hint i guess, because it allowed me to finally focus on the + 26 mod thing, lol. i think i’m used to solving issues by seeing the erroneous result, and this hidden validators thing prevent me from doing so, but this being a challenge of sort, guess there’s no avoiding it! i really was pissed, lol