Suppose Alice wishes to share a string “Quantum” wiht Bob, using a secret key $k$ (a number), such that each alphabet in the string will be shifted by $k$ letters. Consider the case where $k=3$, the encrypted string will be “TXDQWXP”.
The above described method can be represented as follows :
$t[i] = (m[i] + k) \% 26$
where,
$t[i]$ is the $i^{th}$ character of the transmitted message.
$m[i]$ is the $i^{th}$ character of the message to be sent.
and, $k$ is the secret key.
One-Time Pad Method : Use of a different secret key for each transmission.
It’s quite evident that it is very easy to decrypt such a message with hit and trial. Thus, due to the encrypted and actual strings being Highly Correlated this message is easily decipherable by an attacker.
Given, the following (each of length $n$):
the orignal message, denoted by $T$
The encrypted message, denoted by $E$
and, an encryption key, denoted by $K$
$K$ is generated by tossing a coin $n$ times in order to generate $n$ random bits (say, we map Heads to 1 and Tails to 0, then the outcome HHTTH will give 11001).
Exchanging messages b/w SENDER & RECEIVER:
Calculate $E = T \oplus K$.
Sender send $E$ via an insecure channel.
Receiver obtains actual message by performing:
$T = E \oplus K$
Drawbacks:
<aside> 📌
Based on the idea of generating extremely large numbers which are hard to Factorize. However, later Shor’s Algorithm for Quantum Computing was discovered, which made this problem quite easy.
</aside>