Vernam Cipher
Explore another version of the onetime pad known as the Vernam cipher.
We'll cover the following
Introducing the Vernam cipher
The most common onetime pad is the version that applies to binary plaintexts and keys (as opposed to the versions applied to letters of the alphabet and numbers from 1 to $n$ that we have just described). This version is often called the Vernam cipher.
The Vernam cipher can be created as follows:

Let the plaintext be a string of bits, $P_1$, $P_2$, …, $P_n$ (where $P_i$ means the $i$th bit of the plaintext).

Randomly generate a key that consists of $n$ bits $K_1$, $K_2$, . . ., $K_n$.

Encrypt plaintext bit $P_i$ by XORing it to key bit $K_i$ to obtain ciphertext bit $C_i$. Mathematically put:
$C_1 = P_1 \oplus K_1$
$C_2 = P_2 \oplus K_2$
$\vdots$
$C_n = P_n \oplus K_n$
This process is depicted in the figure given below:
Get handson with 1200+ tech skills courses.