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

In the last lecture, we defined formally the notion of perfect secrecy.

Â In this lecture, we'll see a construction that achieves that definition.

Â Just to remind you of our definition,

Â we'll say that in an encryption scheme [COUGH] defined by the three algorithms,

Â Gen, Enc and Dec, and with message space given by M.

Â Is perfectly secret if for every possible probability distribution over the message

Â base, any message in that message base, and any cipher text,

Â it holds that the A [INAUDIBLE] probability, that the message,

Â is equal to M, conditioned on the observed cipher text being equal to C.

Â Is exa, exactly equal to the apriori probability, that the message,

Â is equal to M.

Â Mm where this apriori probability is exactly the given probability

Â distribution, that we start with.

Â The scheme that we'll see that achieves this definition is

Â known as the one-time pad.

Â This came out of, actually, an interesting history, it was patented in 1917,

Â by Vernam, although recent historical research indicates that actually it

Â was invented at least 35 years earlier.

Â The scheme was patented in 1917, but there was no notion of perfect secrecy,

Â until the later work of Shannon in the 1940s.

Â In addition to defining the notion of perfect secret as we've defined it here,

Â Shannon also proved that the one time pad scheme,

Â does indeed achieve that definition.

Â IE that the one time pad, is indeed perfectly secret.

Â So here's the one time pad encryption scheme.

Â First of all we're going to let our message base be equal to 0,1 to the n.

Â This is some notation that I'm going to use frequently in this course since I

Â want to highlight it.

Â The notation 0,1 to the n means that the set of all strings,

Â of all binary strings, of length exactly n, so the set of all n bit strings.

Â The key generation algorithm will choose a uniform key k,

Â also from the set of all n bit strings.

Â That is to say that the key is a uniform n bit string.

Â Each possible n bit string is chosen with probability one over two to the n.

Â Right, there are two to the N different strings of length N.

Â To encrypt a message M, using the key K,

Â what we do is we simply XOR the key with the message bitwise.

Â This means the icebid of the ciphertext is equal to

Â the XOR of the icebid of the key with the icebid of the message.

Â Decryption, just reverses the process.

Â To decrypt a cipher text seed,

Â which is going to be a string of length n, using a key k

Â also a string of length n we simply exhort the two again using bit-wise XOR, so

Â the message that we output is simply the key exhorted with the cipher text.

Â You can go through the exercise of checking that this scheme is

Â indeed correct, right?

Â That when we decrypt the encryption of a message M using the same key,

Â both for encryption and

Â decryption, we recovered the original message, and I've gone through that here.

Â So the decryption using key K of the encryption.

Â Of m using key k, means that,

Â right we look at the inner portion of the encryption of m using k is just k xor m.

Â The decryption of that using the same key is obtained by simply xoring k with that,

Â because xor is associative, we can rewrite that as k xor k.

Â Quantity XOR'd with M.

Â And then we have the nice property that any string XOR'd with

Â itself is equal to the 0 string.

Â And that comes from the fact that a 0 XOR with a 0 is equal to 0.

Â And also a 1 XOR'd with a 1 is equal to 0,

Â and then the 0 string XOR'd with M simply gives back M itself.

Â So again,

Â this just shows that encryption doesn't need to recover the original message.

Â In pictures, we have this diagram here where the message and

Â the key are both end-bit string,

Â end-bit blocks if you'd like, and what we do is we simply [INAUDIBLE] them together.

Â Resulting in an end bit cypher text that's output by this process.

Â What we want to do is to prove that the one time pad is perfectly secret.

Â So remember that in order to do this,

Â we need to show that no matter what distribution of the messages we

Â start with, for any message in any cypher cipher.

Â The probability that the message was equal to m,

Â conditioned on observing that cypher text, is exactly equal to

Â the a priori probability that the message was equal to M.

Â So let's just fix some arbitrary distribution over the message base, and

Â fix some arbitrary message m and cypher text c.

Â All right, the message space and

Â the ciphertexts space here are both the set of all end byte strings.

Â What we need to do again, is to prove that regardless of our choices of

Â the distribution, and regardless of our choices of M and C, the probability that

Â the message was equal to a M, conditioned on the ciphertext being equal to C.

Â It's exactly the A priority probability that the message was equal to M.

Â Now it's a little bit different difficult to think about this,

Â because we don't know what that A priority distribution is, but let's keep going, and

Â work with this expression, and see what we come up with.

Â The first thing we're going to do is to just rewrite this

Â expression using Bayes' Law.

Â So using Bayes' Law, we get that the probability that the message was equal to

Â m, conditioned on the ciphertext being equal to c,

Â is equal to the probability that the ciphertext is c,

Â conditioned on the message being equal to m times the probability that the message

Â was equal to m divided by the probability that the ciphertext was equal to c.

Â Let's compute the probability that the cipher text takes on the sixth value,

Â lower-case c.

Â Well, we can use the law of total probability to express it

Â in the following way.

Â It's simply the summation over all possible messages m prime.

Â Of the probability that the ciphertext is equal to c

Â conditioned on the message being equal to M prime times the probability that

Â the message is equal to M prime.

Â Right the events, M equal M prime do indeed partition the space because

Â the message has to take on some value, and the only possibility that those va,

Â that, of, of those values are the message every message in the message space.

Â If we keep going,

Â we can rewrite that conditional probability in the following way.

Â The probability that the ciphertext is equal to c,

Â conditioned on the message being equal to some value m prime.

Â Is exactly equal to the probability that the key, right,

Â capital K was the random variable denoting the key, is exactly equal to

Â the probability that the key takes on the value m prime x over c.

Â This is the crucial point and this is actually the first point in the proof.

Â Where we're relying on the specifics of the one time pad scheme.

Â Okay everything up 'til now was generic and applied for any, any possible scheme.

Â Here's the first time we're using something specific about the one time pad,

Â and so I want to go over this carefully and

Â make sure you understand why it's true.

Â So again, we,

Â we claim that the probability that the cipher text is equal to C.

Â Conditioned on the fact that the message is equal to m prime.

Â Is equal to the probability that the key is equal to the value m prime x over c.

Â Why is that the case?

Â Well if we condition on the fact that the message is equal to m prime then the only

Â possible way the cipher text can be equal to the fixed string c.

Â Is if the key is equal to M prime X over C, and you can check this because if you

Â XOR the message over prime with the key X over C,

Â you get the [INAUDIBLE] C, and if you write it as an algebraic equation you'll

Â see it's the only possible value of the key for which that happens.

Â Is the key m prime XOR c.

Â What's the probability that the key is equal to the fixed string, m prime XOR c?

Â Well, m prime XOR c is just some fixed n bit string.

Â We said that the one-time pad encryption scheme

Â chooses the key uniformly from the set of all possible n bit keys.

Â So the probability that the key takes on any particular value is exactly 2

Â to the minus n.

Â So we've reduced the probability that the cipher text takes on the value c to

Â the summation over all messages m prime in the message space of 2 to

Â the minus n times the probability that the message is equal to m prime.

Â Now it might look stuck, right?

Â We dont know anything about this probability distribution.

Â It's an arbitrary distribution so we dont know what the probability is that

Â the message takes on any particular value in the message space.

Â However we do know that regardless of what the distribution is

Â it's a valid probability distribution, and, so

Â summing over all possible messages and prime in the message space [SOUND]

Â The probability that the message takes on that value must be one.

Â Right remember that probabilities must sum to one.

Â So this expression reduces simply to two to the minus n and

Â what we have is that the probability that the cipher text takes on

Â any particular value v is exactly equal to two to the minus n.

Â Coming back to our expression, that we want to evaluate, we have that

Â the probability that the five vortex is equal to phi, given that M is equal to M,

Â is again that the probability that the key takes on the value M X or C.

Â This is exactly like before.

Â I've just replaced M prime with the particular message M

Â that we're interested in.

Â We carry around we carry the probability that M is equal to M,

Â and on the previous slide, we calculated that the probability that

Â the ciphertext is equal to C is exactly 2 to the minus N.

Â Now again, the probability that key is equal to the particular string MX over C.

Â Is exactly two to the minus n, and now we see that the two to the minus n and

Â the numerator and denominator cancel.

Â And we're left simply with the probability that m is equal to m.

Â That is the probability that the message is equal to

Â some particular message, little m.

Â And now we're done.

Â Right, what we've shown for any distribution over the message base.

Â Conditioned on observing,

Â the cypher text being equal to C, is exactly

Â equal to the A priori probability, that the message was equal to M.

Â This completes the proof, that the one time pad, achieves perfect secrecy.

Â Just to summarize, we did it, right?

Â We came up with a definition of perfect secrecy, we formalized it mathematically,

Â we showed a particular encryption scheme, the one time pad,

Â and then proved that, that encryption scheme satisfied our definition.

Â All right this achieves the goals that we set out for

Â ourself, for ourselves a few lectures back.

Â In the next lecture, we'll talk about implementing the one-time pad.

Â There's nothing particularly difficult here, but

Â it's interesting actually to explore some of the,

Â implementation level details that arise when trying to code it up.

Â And it also can give an ultimate way of looking at and understanding the scheme.

Â So again, we ca, came up with a definition of perfect sequencing that was in

Â the last few lectures.

Â In this lecture we showed a scheme, achieving that definition.

Â What we'll see later on is that we're not done.

Â Right? The one-time pad has a number of

Â drawbacks that we'd like to address.

Â And after we talk about implementing the one time pad we'll come back and

Â revisit those drawbacks and explore to what extent we can avoid those.

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