I would like to know if this the right way to use the one time pad based on this table

enter image description here

Now, my idea is to use the same Ascii #2 to again if the message is longer, I know this is bad practice, what I found this is the only solution if the key is short. Also, I read that better if I XOR the (#1 + #2), but I see it is useless, do you have a better way to enhance it?

  • 2
    $\begingroup$ If you use the keystream of One-Time-Pad you cannot call it One-Time-Pad!. If key is short request a new key! $\endgroup$ – kelalaka Apr 21 at 21:14
  • $\begingroup$ I can not ask for a new key, but I can increase the key size by making a matrix of the key and apply some math ops on it, such and reverse it, select odd numbers, select even numbers, and create a new matrix. Should I use XOR, how to add noise or enhance it? $\endgroup$ – Marvix Apr 21 at 21:35
  • $\begingroup$ @Marvix: You can do what you want with the key. But it will not be one time pad. If somebody puts Ferrary logo on Toyota car, the car will still be Toyota. May be for this person it will be Ferrary. But for everyone else it will be Toyota. $\endgroup$ – mentallurg Apr 21 at 23:56
  • $\begingroup$ Read crypto.stackexchange.com/a/76299/70072 $\endgroup$ – Legorooj Apr 23 at 1:50

No, this is not a proper way to perform the One Time Pad, even with just 5 letters (assuming the pad and message are bound to be letters that is in range [65..90]).

Problem is, when we see that the first encrypted character is 139, and since we know that the pad is in range [65..90], we know that the first plaintext character is in range [65..74], not in range [75..90]. That's a huge information leak. When the ciphertext character is 130 (resp. 180), we exactly know the plaintext letter: it is 65/A (resp. 90/Z).

The solution to this problem is to compute ciphertext as $c=((p+m)\bmod 26)+65$, and decipher as $m=((c-p)\bmod 26)+65$ (implementable as (c-p+26)%26 + 65 in C). As a bonus, the ciphertext consists of letters.

My idea is to use the same Ascii #2 to again if the message is longer

That's a tried, tested, and bad idea. This is no longer a One Time Pad and it is no longer unconditionally secure. See for example How to attack the Two Time Pad?.

| improve this answer | |
  • $\begingroup$ Here is what I do: OTP words: Johivesebe Ripunohocu Basufafilu Bedoviluro Mihodubabo The generated PAD: HabaqipupoJigecanecoJuhamidasaQeqenimobeFuhemidajijdmhFbmnqQsdmhJ cncgJppqbHiaieueoieeaaiauoeaeiouiaajdmhFbmnqQsdmhJcncgJppqbHijadi mehuFebomineqeQasadimahuJocenacegiJopupiqabaHiaieueoieeaaiauoeaei ouiaaHbqppJgcncJhmdsQqnmbFhmdjaaiuoieaeouaiaaeeioeueiai The ASCII range 33 to 125 Would kindly add an exmaple of mod usage here $\endgroup$ – Marvix Apr 21 at 21:56

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.