Demo of one-time pad encryption

A one-time pad is a method for encrypting an arbitrarily long message into unbreakable form. Security of the encryption depends entirely on the confidentiality and strict non-reuse of the pad.

The basic algorithm is outlined below: convert uppercased characters of both message and pad text to ASCII values; shift down to the 0-25 range; add message and pad values together using modular arithmetic; shift back up to uppercase range; convert from ASCII values to characters.

The decoding process is exactly the same, except the pad is subtracted from the input string instead of added to it.

Note that spaces and all punctuation will be stripped out, because of course no confidential message should include either of these character types. The pad could conceivably contain them, but it's easier just to strip them out there too.

ALGORITHM STEP:
RESULT:
Step 0: Convert both input strings to uppercase
Step 1: Convert message text to ASCII values
Step 2: Shift down to 0-25 range (subtract 65, which is the ASCII code for 'A')
Step 3: Convert one-time pad text to ASCII values
Step 4: Shift down to 0-25 range
Step 5: Add message text and pad values (or subtract, if decoding)
Step 6: Mod 26 all values
Step 7: Shift back up to ASCII alphabetic range (add 65)
Step 8: Convert ASCII values back to characters
Final Result: