Docsity

Classical Ciphers DES Techniques, Lecture Slide - Computer Science, Slides of Cryptography and System Security

Partial preview of the text

Download Classical Ciphers DES Techniques, Lecture Slide - Computer Science and more Slides Cryptography and System Security in PDF only on Docsity!

CPSC 467b: Cryptography and Computer Security

Michael J. Fischer

Lecture 4 January 20, 2010

1 Notes on PS

2 Classical ciphers

(^3) Techniques

4 DES

Choosing uniformly from a finite set

The system-provided function rand() produces a pseudo-random integer in the set { 0 ,... , RAND MAX}. To get a number in the set { 0 ,... , n − 1 }, one typically computes rand()%n. Unfortunately, the result is not quite uniformly distributed unless n divides RAND MAX + 1. Handout 3 describes how to fix this problem.

Generating a random double

To find an approximately uniformly-distributed double x in the semi-open interval [0, 1), one wants to compute

rand()/(RAND MAX + 1).

Unfortunately, this can cause integer overflow, since RAND MAX+1 is typically too large to represent as an int. Again, see Handout 3 for hints on how to solve this problem.

Hill cipher

Encrypts groups of letters at once to mask letter frequencies. Based on linear algebra. The key is, say, a non-singular 3 × 3 matrix K. The message m is divided into vectors mi of 3 letters each. Encryption is just the matrix-vector product ci = Kmi. Decryption uses the matrix inverse, mi = K −^1 ci. Unfortunately, the Hill cipher succumbs to a known plaintext attack. Given three linearly independent vectors m 1 , m 2 , and m 3 and the corresponding ciphertexts ci = Kmi , i = 1, 2 , 3, it is straightforward to solve for K.

Polyalphabetic ciphers

Another way to strengthen monoalphabetic ciphers is to use different substitutions for different letter positions. Choose, say, 10 different alphabet permutations k 1 ,... , k 10. Use k 1 for the first letter of m, k 2 for the second letter, etc. Repeat this sequence after every 10 letters. While this is much harder to break than monoalphabetic ciphers, letter frequency analysis can still be used. Every 10th letter is encrypted using the same permutation, so the submessage consisting of just those letters still exhibits normal English language letter frequencies.

Composition of Ciphers

Let (E ′, D′) and (E ′′, D′′) be ciphers. Their composition is the cipher (E , D) with keys of the form k = (k′′, k′), where

E(k′′,k′)(m) = E (^) k′′′′ (E (^) k′′ (m))

D(k′′,k′)(c) = D′ k′ (D′′ k′′ (m)). Can express this using functional composition. h = f ◦ g is the function such that h(x) = f (g (x)). Using this notation, we can write E(k′′,k′) = E (^) k′′′′ ◦ E (^) k′′ and D(k′′,k′) = D k′′ ◦ D k′′′′.

Security of composition

Composition might or might not give a stronger cipher. Can be difficult to analyze. Practical symmetric cryptosystems such as DES and AES are built as a composition of simpler systems. Each component offers little security by itself, but when composed, the layers obscure the message to the point that it is difficult for an adversary to recover. The trick is to find ciphers that successfully hide useful information from a would-be attacker when used in concert.

Example: Double Caesar

Consider Double Caesar, the Caesar cipher composed with itself. There are now 26^2 = 676 possible key pairs (k′′, k′). One might hope that double Caesar is more resistant to a brute force attack. Unfortunately, still only 26 possible distinct encryption functions and only 26 possible decryptions of each ciphertext. This is because E (^) (^2 k′′,k′) = Ek for k = (k′^ + k′′) mod 26. Any attack on the Caesar cipher will work equally well on the Double Caesar cipher. To the attacker, there is no difference between the two systems. Eve neither knows nor cares how Alice actually computed the ciphertext; all that matters to Eve is probabilistic relationships between plaintexts and ciphertexts.

Group property

Let (E , D) be a cryptosystem for which M = C. Each Ek is then a permutation on M.^1 The set of all permutations on M forms a group.^2

Definition (E , D) is said to have the group property if the set of possible encryption functions E = {Ek | k ∈ K} is closed under functional composition ◦.

That is, if k′, k′′^ ∈ K, then there exists k ∈ K such that

Ek = Ek′′^ ◦ Ek′^.

(^1) A permutation is one-to-one and onto function. (^2) A group has an associative binary operation with an identity element, and each element has an inverse.

Birthday Problem

The birthday problem is to find the probability that two people in a set of randomly chosen people have the same birthday. This probability is greater than 50% in any set of at least 23 randomly chosen people.^3. 23 is far less than the 253 people that are needed for the probability to exceed 50% that at least one of them was born on a specific day, say January 1.

(^3) See Wikipedia, “Birthday problem”.

Birthday attack on a cryptosystem

A birthday attack is a known plaintext attack on a cryptosystem that reduces the number of keys that must be tried to roughly the square root of what a brute force attack needs. For example, if the original key length was 56 (as is the case with DES), then only about

256 = 2^28 keys need to be tried. Any cryptosystem with the group property is subject to a birthday attack.

How a birthday attack works (cont.)

Alice’s key k 0 also has Ek 0 (m) = c. If it happens that Ek = Ek 0 , then we have broken the cryptosystem. We do not need to find k itself since we can compute Ek from Ek 1 and Ek 2 and Dk from Dk 1 and Dk 2. Assuming reasonable randomness properties, there are unlikely to be many distinct keys k such that Ek = Ek 0 , so with significant probability we have cracked the system. (For Caesar, there is only one such k.) Using additional plaintext-ciphertext pairs, we can increase our confidence that we have found the correct key pair. Repeat this process if we have not yet succeeded. I’ve glossed over many assumptions and details, but that’s the basic idea.

Weakenss of the birthday attack

The drawback to the birthday attack (from the attacker’s perspective) is that it requires a lot of storage in order to find a matching element. Nevertheless, if DES were a group, this attack could be carried out in about a gigabyte of storage, easily within the storage capacity of modern workstations. (We will see later that DES is not a group.)