This course will introduce you to the foundations of modern cryptography, with an eye toward practical applications.

Loading...

From the course by University of Maryland, College Park

Cryptography

415 ratings

This course will introduce you to the foundations of modern cryptography, with an eye toward practical applications.

From the lesson

Week 1

Introduction to Classical Cryptography

- Jonathan KatzProfessor, University of Maryland, and Director, Maryland Cybersecurity Center

Maryland Cybersecurity Center

[SOUND].

Â >> As we have seen, any encryption scheme with a keyspace that is

Â too small will be vulnerable to an exhaustive search attack in

Â which an attacker tries to decrypt the cipher text using every possible key.

Â But it's important to understand that just because a scheme has a large keyspace,

Â that doesn't mean it's secure.

Â To see a good example of this,

Â let's look at an extension of the shift cypher that has a much larger key space.

Â In the Vigenere cypher,

Â the key is now a string rather than just a single character.

Â To encrypt a message,

Â we now shift each character in the plain text just as in the shift cypher.

Â But by an amount given by the next character of the key,

Â wrapping around in the key is necessary.

Â So for example, if we encrypt the plain text tell him about me,

Â using the key cafe, then we shift the first letter of

Â the plain text by the amount corresponding to the first letter of the key, or C.

Â That is by two positions.

Â We shift the second letter of a plain text by the amount corresponding to

Â the second character of the key, or A.

Â That is, by zero positions, and so on.

Â Since our key is only four characters long,

Â when we reach the fifth character of the plain text, we wrap around and

Â use the first character of the key to encrypt that character, and, so on.

Â Decryption just reverses this process in the obvious way.

Â What's the size of the key space in this scheme?

Â Well, if we assume that keys are 14 characters long,

Â then the number of possible keys is 26 to the 14th power.

Â Since there are 26 possibilities for each of the 14 characters.

Â In base 2, this is about 2 to the 66, which is a large number.

Â In a later lecture,

Â we'll do some calculations to show exactly how big this is.

Â But for now, just take my word that the key space here is large enough to

Â pretty much rule out Brute-force attacks.

Â Does this mean the Vigenere cipher is secure?

Â Well, it was thought to be secure for

Â many years, precisely because the key space was so large.

Â In the end, however, the VigenÃ¨re cypher is not secure.

Â The reason is that a Brute-force exhaustive search attack is not the only

Â attack possible.

Â And by being clever, we can attack the scheme in other ways.

Â Here, I'm going to walk through a very basic attack assuming for

Â simplicity that the key is always exactly 14 characters long.

Â The main observation is that if you look at a cipher text,

Â then every 14th character in that cipher text has been shifted by the same amount.

Â Or in other words, if you just focus on every 14th character of the cipher text,

Â it is just as if you have a cipher text that was output by the shift cipher.

Â For example, take this cipher text here output by Vigenere cipher.

Â I bolded every 14th character, starting from the first, and

Â each of those characters was obtained by shifting the underlying plain text in

Â those positions by the same amount.

Â Similarly, if we look at every 14th character starting from

Â the third position, each of those characters was obtained by

Â applying the same shift to the underlying plain text in those positions.

Â To be clear, the shift for the bolded characters and

Â the underlined characters may be different from each other.

Â But the shift for all the bolded characters is identical.

Â And the shift for all the underlined character is identical.

Â So what we've said is that by looking at every fourteenth character in the cypher

Â text, we get something that was generated just like a ciphertext encrypted by

Â the shift cipher.

Â We know we can do a Brute-force attack on the shift cipher, so are we done?

Â Well, not quite.

Â Remember that the brute-force attack on the shift cipher work by trying to

Â decrypt the ciphertext using every possible key, and

Â looking at the list of 26 possible plain texts for one plain text that makes sense.

Â Here, however, that's not going to work.

Â The reason is that even when we guess the correct shift,

Â what we get is every 14th character of the original plain text,

Â which will look like gibberish even when you get the guess of the shift correctly.

Â So we're going to have to work a little bit harder here.

Â One thing we can do instead is to rely on plaintext letter frequencies.

Â Here's a table showing letter frequencies for normal English text.

Â You can see that E, for example,

Â is the most common letter occurring about 13% of the time in English text.

Â At the other end of the scale, and not too surprising for speakers of English,

Â we see that the letters Z and Q occur only about 0.1% of the time.

Â Letter frequencies depend on the language, of course, but can be found or

Â obtained for just about any language in existence.

Â So, how can we use letter frequencies to attack the Vigenere cipher.

Â Well, a simple way to use them is as follows.

Â Look at every 14th character of the ciphertext starting with the first.

Â Let alpha denote the most commonly occurring letter in that

Â portion of the ciphertext.

Â We're going to guess that the ciphertext character corresponds to

Â the most common plain text letter E.

Â Assuming that's the case,

Â the first character of the key must be equal to the shift needed to

Â go from the plain text character E to the cipher text character alpha.

Â That is the shift must be alpha minus E.

Â We can repeat this process for every 14th character starting from

Â the second position, starting from the third position, etc.,

Â until we learn all the characters of a key.

Â Now I should point out that this attack is not perfect.

Â It requires a long ciphertext, long enough so

Â that taking every 14th character in the ciphertext.

Â Thereâ€™s enough characters to get representative statistics for

Â the underlying plain text frequencies.

Â And even man they can make a mistake and get some characters of the key wrong.

Â However, this attack will work given a long enough cipher text.

Â Moreover, better attacks on the Vigenere cipher are known.

Â I didn't describe those here because the purpose of this exercise is not really to

Â study the Vigenere cipher itself, but

Â just to show that a little bit of cleverness can sometimes give an attack on

Â an encryption scheme that does much better than exhaustive search.

Â So, what have we seen so far?

Â Well, we've seen two examples of encryption schemes.

Â The shift cipher and the Vigenere cipher.

Â Both of which could ultimately be broken.

Â The second example, the Vigenere cipher, actually took a little bit

Â of cleverness to break and may have looked secure at first glance.

Â Well, how do we know in general whether any encryption scheme we come up with,

Â no matter how good it looks, is actually secure?

Â Wouldn't it be nice if we could prove security of some encryption scheme?

Â So we could be sure that no attacks were possible?

Â Before we can hope to do that,

Â however, we first have to define precisely what we mean by security here.

Â There are actually two distinct reasons for this.

Â The first is simply that if we want to have rigorous mathematical proof of

Â security, then we're going to need a rigorous,

Â precise definition of security in place first.

Â But it goes beyond that.

Â Even at an informal level,

Â it's important to have a clear idea in mind of what security means.

Â Until now, I've pretty much waved my hand and said something about

Â an attacker not learning any information about the plain text.

Â But what I have in mind when I say that may not be what you have in

Â mind when you hear it.

Â Even when I showed attacks on the schemes,

Â I made a bunch of assumptions that you might find questionable.

Â For example, in the attacks on the shift in VigenÃ¨re ciphers,

Â I implicitly assumed that what was being encrypted was English text.

Â But what if the parties were encrypting Spanish or, or, or transliterated Hebrew?

Â What if I don't even know what language they're using?

Â What if I know they're using English but

Â they were encrypting C code rather than regular English language text?

Â The attacks I gave won't work in this case.

Â But does that mean that schemes are secure for those applications?

Â All of this discussion just highlights the importance of

Â having a formal definition in place.

Â And this is something we'll turn to in the next few lectures.

Â Coursera provides universal access to the worldâ€™s best education,
partnering with top universities and organizations to offer courses online.