# Is this the right way to implement one time pad?

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

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?

• If you use the keystream of One-Time-Pad you cannot call it One-Time-Pad!. If key is short request a new key! Commented Apr 21, 2020 at 21:14
• 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? Commented Apr 21, 2020 at 21:35
• @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. Commented Apr 21, 2020 at 23:56
• Commented Apr 23, 2020 at 1:50

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.
• 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 Commented Apr 21, 2020 at 21:56