## One-Time Pad

Here is an explaination of the One-Time Pad encryption system.

The One-Time Pad (otp) is an encryption method that cannot be cracked.

It this encryption system there is a plaintext paired with a random secret key called "pad".

The pad must have the same length of the plaintext.

Then each character of the plaintext and the pad are converted to a number, the corresponding letter of the alphabet (see point 1).

A=0, B=1, C=2, D=3, E=4, ..., ..., Z=25

After that each character of the plaintext is encrypted with the corresponding character of the pad:

you have to add up the numbers of the plaintext with the numbers of the key (see point 2)

Now convert the numbers to the corresponding letter of the alphabet (see point 3) and you obtain the secret message

If you want decipher a message (you must have the pad) you have to convert the message and the pad to a number, after that subtract the message's number to the pad's number (see point 3).

Then if some numbers result negative, add 10 to the absolute value of it, and the result of these operations is the plaintext.

Point 1

For example if we want encrypt the text "secret" with the key "vernam" those are the passages:

secret must be "18-04-02-17-04-19"

vernam must be "21-04-17-13-00-12"

Point 2

18-04-02-17-04-19 +

21-04-17-13-00-12 =

-----------------

39-08-19-30-04-31

if a number result 25>x you have to subtract 26 to the number

39-26=13 => 13 = N

08 =======> 08 = I

19 =======> 19 = T

30-26=04 => 04 = E

04 =======> 04 = E

31-26=05 => 05 = F

Point 3

| 13 | 08 | 19 | 04 | 04 | 05 | -

| 21 | 04 | 17 | 13 | 00 | 12 | =

-------------------------------

|-08 | 04 | 02 |-09 | 04 |-07 |

|-08 | 04 | 02 |-09 | 04 |-07 | +

| 10 | 00 | 00 | 10 | 00 | 10 | =

-------------------------------

| 18 | 04 | 02 | 19 | 04 | 17 |

18-04-02-17-04-19 = secret

A One-Time Pad script is avaiable here.

A One-Time pad generator script is avaiable here.