Substitution ciphers - vernam and one-time pad Flashcards
What is the vernam cipher?
- a system where keyword/key is as long as plaintext and has no statistical relationship to it.
- Works on binary data (bits) rather than letters, using XOR ⊕.
- It is a stream cipher - Ciphertext is generated by bitwise XOR of plaintext pi and key ki (each bit of the plaintext is XORed with each bit of the key)
How does XOR work?
0 ⊕ 0 = 0
0 ⊕ 1 = 1
1 ⊕ 0 = 1
1 ⊕ 1 = 0
More rules: a ⊕ a = 0 a ⊕ 0 = a a ⊕ b = b ⊕ a a ⊕ b ⊕ b = a (a ⊕ b) ⊕ c = a ⊕ (b ⊕ c)
XOR can be used as polyalphabetic cipher:
P ⊕ K = C -> ci = pi ⊕ ki
C ⊕ K = P -> pi = ci ⊕ ki
pi/ci/ki = ith binary digit of plaintext/ciphertext/key.
What is the security of the vernam cipher?
Difficult to break if key is long, BUT still breakable with sufficient ciphertext, use of known or probable plaintext sequences, or both.
Example of how perfect secrecy can be achieved?
- CANNOT USE A SUBSTITUTION CIPHER as its easy to break as the message is really small.
- Use a system with two keys K1 and K2 and these two keys are EQUALLY LIKELY.
a. K1 encrypts “buy” to 0 and “sell” to 1:
EK1(”buy”) = 0 and EK1(”sell”) = 1.
b. K2 encrypts “buy” to 1 and “sell” to 0:
EK2(”buy”) = 1 and EK2(”sell”) = 0 - If the attacker intercepts a 0, then all that he can deduce is that the message might be “sell” if K2
was used, or “buy” if K1 was used. - Since each key is equally likely, the attacker is forced to guess which key was used: the chances of guessing correctly are 50%.
- THIS IS PERFECT SECRECY - NEVER 100% OF GETTING IT RIGHT BUT THIS COMES AT A PRICE (ONE TIME PAD)
What is one-time pad?
- Use a truly random key:
a. that is as long as the message, so that the key need not be repeated,
b. the same key is used to encrypt and decrypt a single message, and then discarded.
KEY IS NOT REPEATED TO MATCH LENGTH OF PLAINTEXT MSG LIKE IT IS IN VIGENERE OR VERNAM CIPHERS.
Other properties of one-time pad
- Each new message P requires a new key of same length as P.
- Produces random output with no statistical relation to plaintext.
- Unbreakable: C contains no information whatsoever about P.
- Only cryptosystem that exhibits so-called perfect secrecy.
Why is one-time pad unbreakable?
- For the same ciphertext -> to decrypt you need a key k that is the same length as the ciphertext -> obtain the plaintext.
- To decrypt the same ciphertext again -> a new key should be used -> new plaintext obtained.
- You will have many plaintexts for a single ciphertext and there is no way to know what the intended one is. What is the correct decryption using K1 and K2 to decrypt the same ciphertext?
- no patterns or irregularities: If the stream of keys produced is RANDOM then, the CIPHERTEXT produced using this key is also RANDOM.
What are some of the difficulties of one-time pad?
- You will have to make large quantities of keys - one for every message you want to send.
- Key distribution and protection, where for every message to be sent, a key of equal length is needed by both sender and receiver.
- therefore, it has limited utility (useful primarily for low-bandwidth channels that need very high security)