1
$\begingroup$

With no background in higher math or computer science, I could not quite grasp the value of modular math for simple OTP systems as described in other posts here.

I have an alphabet size of 40 characters, valued from 0 to 39. The pad uses alphabetics "A" through "Z", valued from 0 to 25. I am using modulo 40 math.

If my ciphertext for any given plaintext character is a single digit, I prepend a zero as a placeholder, this yields a consistent ciphertext of a pair of digits for any one character of plaintext.

This system is working just fine. But then I realized that I could skip the mod math entirely and the system works just as well and is easier and quicker for both parties in the exchange....as far as I can tell.

So: Why bother using the mod math at all if the encryption/decryption is working just fine without it?

And, from an attacker's point of view, if he realized the ciphertext digit pairing and therefore could see the highest pair value of 40 (in the case of using the mod math) or instead 64 (without the mod math), would one of those cases give him more advantage than the other?

$\endgroup$
4
$\begingroup$

If you are not using modular arithmetic and an eavesdropper observes the ciphertext 64, they immediately know that the plaintext is 39 (encrypted with the key 25). With modular arithmetic, if the ciphertext 39 is observed, the plaintext can range from 14 (with key 25) to 39 (with key 0).

Note also that, since in your system the key space is smaller than the plaintext space, it is not perfectly secret even if you use modular arithmetic. As above, a ciphertext of 39 ensures the plaintext is between 14 and 39, not below (there is no key that encrypts 13 to 39).

$\endgroup$
  • $\begingroup$ Similarly, the ciphertext value 00 would be 'A' encrypted with key 00. You would get a bell curve, similar to throwing two dice and adding the values. Value 2 is always 1 + 1 and 12 is 6 + 6, 7 is the most common value for 1 + 6, 2 + 5 etc.. $\endgroup$ – Maarten Bodewes Aug 28 '18 at 2:22
1
$\begingroup$

It actually doesn't.

It just appears to if you take a few characters. If you have no modulus, what you're doing in terms of frequency distributions /probabilities is:-

cipher text = random + natural language plain text

We know the frequency of natural languages, and obviously we know what's random. And we can measure the distribution of the cipher text, so we have all the probability distributions. We also have other relationships such as (cipher 64) = (39 plain), (cipher 63) = 50%(38 plain) and so on allowing you to buildup other histograms of possible plain text distributions. Then there are the lexical correlations extending into many letters and then words.

Given enough cipher text, the attacker will be able to remove the random additive component and extract the plain text. Whilst not so common in proper cryptography, it's done all the time in engineering and science. Frame stacking in astronomy, spread spectrum techniques in communications, GPS reception, oscilloscope practice and sound engineering are all examples where we can extract signals from beneath the noise floor.

You can improve your security slightly be increasing the range of the pad in relation to the plain text. Imagine if the pad was only 1 bit. You'd probably be able to read the cipher text right away by squinting. If you maximise the pad's range, the attacker will need more cipher text to analyse as the signal to noise ratio will drop. Very quickly though, you'll realise that pad maximisation hits 255 for typical bytes. Then you'll need that mod thing.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.