< Return to Video

Block ciphers from PRGs(12 min)

  • 0:00 - 0:04
    In this segment we ask whether we can
    build block ciphers from simpler
  • 0:04 - 0:09
    primitives like pseudo random generators.
    The answer is yes. So to begin with, let's
  • 0:09 - 0:14
    ask whether we can build pseudo random
    functions as opposed to pseudo random
  • 0:14 - 0:19
    permutations from a pseudo random
    generator. Can we build a PRF from a PRG?
  • 0:19 - 0:24
    Our ultimate goal though is to build a
    block cipher which is a PRP. And we'll get
  • 0:24 - 0:29
    to that at the end. Okay, for now we build
    a PRF. So let's start with a PRG that
  • 0:29 - 0:35
    doubles its inputs so the seeds for the
    PRG is an element in K and the output is
  • 0:35 - 0:39
    actually two elements in K. So here we
    have a schematic of the generator, that
  • 0:39 - 0:44
    basically takes his input of C and K, and
    outputs two elements, in K as its output.
  • 0:44 - 0:49
    And now what does it mean for this purity
    to be secure, recall this means that
  • 0:49 - 0:53
    essentially the output is
    indistinguishable from a random element
  • 0:53 - 0:58
    inside of K squared Now it turns out that
    it's very easy to define basically what's
  • 0:58 - 1:03
    called a one bit PRF from this PRG. So
    what's a one bit PRF is basically a PRF
  • 1:03 - 1:08
    who's domain is only one bit. Okay, so
    it's a PRF that just takes one bit as
  • 1:08 - 1:13
    input. Okay, and the way we'll do it is
    we'll say is if the input bit X is zero
  • 1:13 - 1:19
    I'll put the left output and if the input
    bit X is one then I'll put the right
  • 1:19 - 1:24
    output of the PRF. Okay, in symbols we
    basically have what we wrote here. Now it
  • 1:24 - 1:29
    is straightforward to show, that in fact G
    is a secure PRG, then this one bit PRF is
  • 1:29 - 1:33
    in fact a secure PRF. If you think about
    it for a second, this really is not
  • 1:33 - 1:38
    [inaudible]. Its really just stating the
    same thing twice. So i will leave it for
  • 1:38 - 1:42
    you to think about this briefly and see
    and convince yourself that in fact this
  • 1:42 - 1:47
    theorem is true. The real questions is
    whether we can build a PRF, that actually
  • 1:47 - 1:52
    has a domain that is bigger than one bit.
    Ideally we would like the domain to be 128
  • 1:52 - 1:56
    bits, just say as a [inaudible] has. So
    the question is can we build 128 bit PRS
  • 1:56 - 2:01
    from a pseudo random generator. Well so
    let's see if we can make progress. So the
  • 2:01 - 2:06
    first thing we're gonna do is we're gonna
    say, well again, let's start with a PRG
  • 2:06 - 2:11
    that doubles its input let's see if we can
    build a PRG that quadruples its inputs.
  • 2:11 - 2:16
    Okay? So it goes from K to K to the fourth
    instead of K to K squared. Okay, so let's
  • 2:16 - 2:21
    see how to do this. So here we start with
    our original PRG that just doubles its
  • 2:21 - 2:26
    inputs, now remember that the fact that
    his is a PRG means that the output of the
  • 2:26 - 2:31
    PRG is indistinguishable from two random
    values in K. Well, if the output looks
  • 2:31 - 2:36
    like two random values in K, we can simply
    apply the generator again to those two
  • 2:36 - 2:40
    outputs. So let's say we apply the
    generator once to the left output, and
  • 2:40 - 2:45
    once to the rights outputs. And we are
    going to call the output of that, this
  • 2:45 - 2:50
    quadruple of elements, we are, are going
    to call that G1K. And i wrote down in
  • 2:50 - 2:56
    symbols what this generator does, but you
    can see basically from this figure,
  • 2:56 - 3:01
    exactly how the generator works. So now
    that we have a generator from K to K to
  • 3:01 - 3:06
    the fourth, We actually get a two bit PRF.
    Namely, what we will do is, we will say,
  • 3:06 - 3:11
    given two bits, 000110 or eleven, wills
    imply output the appropriate block that
  • 3:11 - 3:16
    the output of G1K. Okay, so now we can
    basically have a PRF that takes four
  • 3:16 - 3:21
    possible inputs as opposed to just two
    possible inputs as before. So the question
  • 3:21 - 3:26
    you should be asking me is why is this G1
    case secure? Why is it a secure PRG? That
  • 3:26 - 3:31
    is why is this quadruple of outputs
    indistinguishable from random. And so
  • 3:31 - 3:36
    let's do a quick proof of this, we'll just
    do a simple proof by pictures. So here's
  • 3:36 - 3:40
    our generator that we want to prove is
    secure. And what that means is that we
  • 3:40 - 3:45
    want to argue that this distribution is
    indistinguishable from a random fordable
  • 3:45 - 3:49
    in K to the fourth. Okay so our goal is to
    prove that these two are
  • 3:49 - 3:54
    indistinguishable. Well let's do it one
    step at a time. We know that the generator
  • 3:54 - 3:58
    is a secure generator, therefore in fact
    the output of the first level is
  • 3:58 - 4:02
    indistinguishable from random. In other
    words, if we replace the first level by
  • 4:02 - 4:07
    truly random strings these two are truly
    random picked in the key space, then no
  • 4:10 - 4:11
    efficient adversary should be able to
    distinguish these two distributions. In
  • 4:11 - 4:16
    fact, if you could distinguish these two
    distributions, it's easy to show that you
  • 4:16 - 4:21
    would break the original PRG. Okay, but
    essentially you see that the reason we can
  • 4:21 - 4:26
    do this replacement, we can replace the
    output of G, with truly random values, is
  • 4:26 - 4:31
    exactly because of the definition of the
    PRG, which says the out put of the PRG is
  • 4:31 - 4:35
    indistinguishable from random, so we might
    as well just put random there, and no
  • 4:35 - 4:40
    efficient adversary can distinguish the
    resulting two distributions. Okay, so far
  • 4:40 - 4:45
    so good, but now we can do the same thing
    again to the left hand side. In other
  • 4:45 - 4:50
    words, we can replace these two pseudo
    random outputs, by truly random outputs.
  • 4:50 - 4:54
    And again because the generator G is
    secure, no efficient adversary can tell
  • 4:54 - 4:58
    the difference between these two
    distributions. But differently, if an
  • 4:58 - 5:02
    adversary can distinguish these two
    distributions, then we would also give an
  • 5:02 - 5:07
    attack on the generator G. And now finally
    we're gonna do this one last time. We're
  • 5:07 - 5:11
    gonna replace this pseudo random pair By a
    truly random pair, and low and behold we
  • 5:11 - 5:16
    get the actual distribution that we were
    shooting for, we would get a distribution
  • 5:16 - 5:20
    that is really made of four independent
    blocks. And so now we have proved this
  • 5:20 - 5:23
    transition basically that these two
    indistinguishable, these two
  • 5:23 - 5:27
    indistinguishable, and these two
    indistinguishable, and therefore these two
  • 5:27 - 5:31
    are indistinguishable, which is what we
    wanted to prove. Okay so this is kind of
  • 5:31 - 5:36
    the high level idea for the proof, it is
    not too difficult to make this rigorous,
  • 5:36 - 5:40
    but i just wanted to show you kinda
    intuition for how the proof works. Well,
  • 5:40 - 5:44
    if we were able to extend the generators
    outputs once, there's nothing preventing
  • 5:44 - 5:49
    us from doing it again so here is a
    generator G1 that outputs four elements in
  • 5:49 - 5:53
    the key space. And remember the output
    here is indistinguishable from our random
  • 5:53 - 5:58
    four couple, that's what we just proved.
    And so there's nothing preventing us from
  • 5:58 - 6:02
    applying the generator again. So we'll
    take the generator apply it to this random
  • 6:02 - 6:07
    looking thing and we should be able to get
    this random looking thing. This pair over
  • 6:07 - 6:12
    here that's random looking. And we can do
    the same thing again, and again, and
  • 6:12 - 6:16
    again. And now basically we've built a new
    generator that outputs elements in K to
  • 6:16 - 6:21
    the eighth, as opposed to K to the fourth.
    And again the proof of security is very
  • 6:21 - 6:26
    much the same as the one I just showed you
    essentially you gradually change the
  • 6:26 - 6:31
    outputs into truly random outputs. So we
    would change this to a truly random
  • 6:31 - 6:35
    output, then this, then that, then this,
    then that and so on and so forth. Until
  • 6:35 - 6:40
    finally we get something that's truly
    random and therefore the original two
  • 6:40 - 6:44
    distributions we started with G2K and
    truly random are indistinguishable. Okay,
  • 6:44 - 6:49
    so far so good. So now we have a generator
    that outputs elements in K to the eighth.
  • 6:49 - 6:54
    Now if we do that basically we get a three
    bit PRF. In other words, at zero, zero,
  • 6:54 - 6:59
    zero this PRF would output this block, and
    so on and so forth until one, one, one it
  • 6:59 - 7:03
    would output this block. Now the
    interesting thing is that in fact this PRF
  • 7:03 - 7:08
    is easy to compute. For example, suppose
    we wanted to compute the PRF at the point
  • 7:08 - 7:12
    one zero one. Okay, it's a three bit PRF.
    Okay so one zero one. How would we do
  • 7:12 - 7:17
    that? Well basically we would start from
    the original key K. And now we would apply
  • 7:17 - 7:21
    the generator G but we would only pay
    attention to the right output of G,
  • 7:21 - 7:25
    because the first bit is one. And then we
    will apply the generator again, but we
  • 7:25 - 7:30
    would only pay attention to the left of
    the output of the generator because the
  • 7:30 - 7:34
    second bit is zero. And then we would
    apply the generator again and only pay
  • 7:34 - 7:39
    attention to the right outputs because the
    third bit is one and that would be the
  • 7:39 - 7:43
    final output. Right, so you can see that,
    that lead us to 101, and in fact because
  • 7:43 - 7:47
    the [inaudible] generator is pseudo
    random, we know that, in particular that,
  • 7:47 - 7:53
    this output here is pseudo random. Okay,
    so this gives us a three bit PRF. Well, if
  • 7:53 - 7:59
    it worked three times, there's no reason
    why it can't work N times. And so if we
  • 7:59 - 8:04
    apply this transformation again and again,
    we arrive at what's called a GGMPRF. Ggm
  • 8:04 - 8:08
    stands for Goldreich, Goldwasser and
    Micali these are the inventors of
  • 8:08 - 8:13
    this PRF and the way it works is as
    follows. So we start off with a generator
  • 8:13 - 8:17
    just doubles its outputs, and now we're
    able to build a PRF that acts on a large
  • 8:17 - 8:22
    domain mainly a domain of size zero one to
    the N. Or N could be as big as 128 or even
  • 8:22 - 8:27
    more. So let's see, suppose we're given an
    input in 01 to the N, let me show you how
  • 8:27 - 8:31
    to evaluate the PRF. Well by now you
    should actually have a good idea for how
  • 8:31 - 8:35
    to do it. Essentially we start from the
    original key and then we apply the
  • 8:35 - 8:40
    generator and we take either the left or
    the right side depending on the bit X0 and
  • 8:40 - 8:45
    then we arrive at the next key, K1. And
    then we apply the generator again and we
  • 8:45 - 8:49
    take the left or the right side depending
    on X1 and we arrive at the next key. And
  • 8:49 - 8:55
    then we do this again and again, until
    finally we are arrive at the output. So we
  • 8:55 - 9:00
    have processed all end bits, and we arrive
    at the output of this function. And
  • 9:00 - 9:05
    basically we can prove security again
    pretty much along the same lines as we did
  • 9:05 - 9:10
    before, and we can show that if G is a
    secure PRG, then in fact we get a secure
  • 9:10 - 9:15
    PRF, on 01 to the N, on a very large
    domain. So that's fantastic. Now we have
  • 9:15 - 9:19
    we have essential, we have a PRF that's
    provably secure, assuming that the
  • 9:19 - 9:23
    underlying generator is secure, and the
    generator is supposedly much easier to
  • 9:23 - 9:28
    build than an actual PRF. And in fact it
    works on blocks that can be very large, in
  • 9:28 - 9:33
    particular, 01 to the 128th, which is what
    we needed. So you might ask well why isn't
  • 9:33 - 9:39
    this thing being used in practice? And the
    reason is, that it's actually fairly slow.
  • 9:39 - 9:45
    So imagine we plug in as a generator we
    plug in the salsa generator. So now to
  • 9:45 - 9:50
    evaluate this PRF at a 128 bit inputs, we
    would basically have to run the salsa
  • 9:50 - 9:56
    generator 128 times. One time per bit of
    the input. But then we would get a PRF
  • 9:56 - 10:02
    that's 128 times slower than the original
    salsa. And that's much, much, much slower
  • 10:02 - 10:06
    than AES. Aes is a heuristic PRF. But
    nevertheless it's much faster then what we
  • 10:06 - 10:11
    just got here. And so even though this is
    a very elegant construction, it's not used
  • 10:11 - 10:15
    in practice to build pseudo random
    functions although in a week we will be
  • 10:15 - 10:19
    using this type of construction to build a
    message integrity mechanism. So the last
  • 10:19 - 10:23
    step, is basically now that we've built a
    PRF, the questions is whether we can
  • 10:23 - 10:28
    actually build the block cypher. In other
    words, can we actually build a secure PRP
  • 10:28 - 10:32
    from a secure PRG. Everything we've done
    so far is not reversible. Again if you
  • 10:32 - 10:37
    look at this construction here, we can't
    decrypt basically given the final outputs.
  • 10:37 - 10:41
    It is not possible to go back or at least
    we don't know how to go back the, the
  • 10:41 - 10:45
    original inputs. So now the question of
    interest is so can we actually solve the
  • 10:45 - 10:49
    problem we wanted solve initially? Mainly,
    can we actually build a block cipher from
  • 10:49 - 10:54
    a secure PRG? So ill let you think about
    this for a second, and mark the answer. So
  • 10:54 - 10:58
    of course I hope everyone said the answer
    is yes and you already have all the
  • 10:58 - 11:02
    ingredients to do it. In particular, you
    already know how to build a PRF from a
  • 11:02 - 11:06
    pseudo random generator. And we said that
    once we have a PRF we can plug it into the
  • 11:06 - 11:11
    Luby-Rackoff construction, which if you
    remember, is just a three-round feistel.
  • 11:11 - 11:15
    So we said that if you plug a secure PRF
    into a three-round feistel, you get a
  • 11:15 - 11:19
    secure PRP. So combining these two
    together, basically gives us a secure PRP
  • 11:19 - 11:23
    from a pseudo random generator. And this
    is provably secure as long as the
  • 11:23 - 11:28
    underlying generator is secure. So it's a
    beautiful result but unfortunately again
  • 11:28 - 11:32
    it's not used in practice because it's
    considerably slower than heuristics
  • 11:32 - 11:37
    constructions like AES. Okay so
    this completes our module on constructing
  • 11:37 - 11:40
    pseudo random permutations, and pseudo
    random functions. And then in the next
  • 11:40 - 11:44
    module we're gonna talk about how to use
    these things to do proper encryption.
Title:
Block ciphers from PRGs(12 min)
Video Language:
English

English subtitles

Revisions