One Time Pad (OTP) Encryption
One Time Pad encryption is virtually impossible to crack.
The encryption key is used only once, ensuring the highest level of integrity and confidentiality.
The key is generated randomly and is exactly the same size as the plaintext message.
The Core: Secure Key Exchange
The most critical part of this method is the secure exchange of keys.
Think back to the early 2000s when home banking was just starting. You had to physically visit the bank to receive your OTP device (token).
This illustrates that verifying identity in person and physically handing over the device is the safest method.
Real world Example: Secure Communication
These characteristics fit military purposes perfectly.
Let's assume Alice is a Division Commander, and Bob and Carol are Battalion Commanders (Alice outranks them). Alice wants to establish a top-secret communication line with them.
1. Pre distribution of Keys
- Alice holds a monthly strategy meeting in her office on the 1st of every month.
- She connects three 2TB hard drives to her computer.
- She generates a 1TB key file and saves identical copies to each drive.
- After the meeting, she hands one drive to Bob and one to Carol, keeping one for herself.
2. Communication Phase
- Back at their offices, Bob and Carol connect the hard drives to their computers.
- When Alice wants to send a message, she encrypts it on her machine using her copy of the key.
- The Network: She can send the encrypted file over the public internet (even regular messenger apps like KakaoTalk are fine).
- Bob receives the encrypted file and decrypts it using the key on his hard drive.
- Once decrypted, he can read Alice's message.
- Since they share the same key, Bob can also communicate securely with Carol.
Vulnerabilities
If the key is stolen, the encryption is broken. Therefore, it is best practice to keep the key in an environment disconnected from the network.
Just like keeping a banking OTP token in a safe drawer, in this scenario, you should isolate the computers: use an offline computer for the actual work (encryption/decryption) and use a network-connected computer only for transmitting the files.
A Binary Perspective
Alice Sends a Message
Alice is happy with Bob's performance and wants to send the letter A securely.
- A in ASCII is decimal
65, which is0100 0001in binary. - Alice looks up her random key. The first unused portion looks like
1010 0011. - They agreed on a rule: 0 means keep the number, 1 means flip the number.
- Using this rule, Alice gets the ciphertext
1110 0010.
Interestingly, flipping the plaintext based on the key yields the same result as flipping the key based on the plaintext.
| Plaintext | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |
| Key | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 1 |
| Ciphertext | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 0 |
Bob's Decryption Process
- Bob receives the number
1110 0010over the public network. - Bob reads the key from the same position on his hard drive and finds
1010 0011. - He applies the same rule agreed upon with Alice.
- Bob gets the result
0100 0001. - Looking this up in the ASCII table, he finds the plaintext A.
- Bob now knows for sure that Alice sent him an "A".
| Ciphertext | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 0 |
| Key | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 1 |
| Plaintext | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |
The XOR Operation
This logic is technically known as the XOR (Exclusive OR) operation.
It is similar to addition, so you can interpret it as adding bits, but with a twist: 1+1=0.
* This is because binary cannot represent 2 in a single bit.
* There is no carry to the next digit (unlike regular addition).
* Each bit position is calculated independently.
| Input 1 | Input 2 | Result |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |