Podcast
Root Causes 235: What Is Lattice-based Cryptography?
Hosted by
Jason Soroko
Fellow
Original broadcast date
July 27, 2022
The recent winners of the NIST post-quantum cryptography contest are strongly focused on lattice-based encryption. In this episode we explain at a high level what this cryptographic approach entails and why lattice-based algorithms fared so well in the NIST search.
Podcast transcript
Lightly edited for flow and brevity.
TCTim CallanRecent episodes of this podcast have been occupied with NIST’s quite recent announcement of the winners of its post-quantum crypto contest. Go listen to those episodes for more details. As a reminder, the two main winners were Kyber for the KEM and Dilithium for digital signature. And what they have in common – we are told – is that they are both using a lattice-based cryptography approach. We thought today we would break that down and explain what that means.
But I do think though, that all of us as technical people, perhaps people with math backgrounds, people with just math interests, I think at the absolute very least one of the things that was good about RSA, one of the things that was also good about ECC, is that people were able to at least have an intuitive expression of what’s going on. What makes these things good tough math problems.
And I think that, of course, we’ve said this a few times in this podcast, RSA and ECC are both basically math problems that come under a similar category of the problem of factorization. And you are factoring different things, but they are factorization problems. In other words, classical non-quantum computers cannot solve these kinds of factorization problems in polynomial time, and that’s what makes RSA and ECC really great when you choose a big enough bit length, right, Tim?
TCTim CallanYeah.
TCTim CallanAnd in that sense, they are easy. Like especially RSA. Like if you had high school algebra then at the easiest level you can understand what RSA does. You get a ridiculously large number and you have to factorize it, which means you break it down to the basic numbers that multiply together to the get to that ridiculously large number and that includes some prime numbers that themselves are hugely large, right? And just figuring out what those are. Like that’s the math problem and we can all understand that. Now we can’t look at the formula written on a whiteboard and make sense of it but, you know, at that level, we can get it. ECC gets a little more math-y than that, but at the end of day it’s an elliptical curve. It’s build right into the name, and what you are doing is you are trying to find a point on that curve. Right?
TCTim CallanNow when we get to lattice, that ain’t a thing that I got in Calc, right? So, now all of the sudden, we are into a realm where I think a lot of educated people who are good at math just don’t know what these words mean anymore, and getting us there will help, I think.
Where previously people have been used to the algebraic expressions, the formula. People know what those look like. They are intimidating for non-math people, and they can sometimes be very intimidating to math people. There are levels of difficulty. Everybody has heard E = mc2. Right? A formula. So people are used to that and people certainly in the cryptographic realm are used to seeing algebraic expressions, formulas, that are just pure math that express why a problem is difficult and also, how to break down and solve the problem eventually because, you know, once you have a secret that’s great but once you want to exchange that secret, how do you decrypt something? There are formulas for that as well.
TCTim CallanSure.
That’s a big takeaway, Tim. That we are moving away from classical formulas and moving towards something that computers really like, which is expressions in matrices. And when you think about a matrix, Tim - - think about a two-dimensional matrix. You know, if anybody has ever looked at an Excel spreadsheet, right, there’s columns and rows and if you were to choose one column and row and another column and row and draw a line between them, that’s called a vector, right?
TCTim CallanRight.
So, Tim, the reason why I say it’s geometric, more of a geometric based set of problems is because that vector is important to keep in mind. The vector is the expression from one point to another point along that matrix and it points in a direction. There’s an angle to it. There’s a directionality to it and it covers a mathematical space, if you will, and if you are doing it in two and three dimensions, it’s very easy to actually visualize that space in your mind.
So, lattice, if you just think about just that word, we are talking about a matrix. However, the reason why we are choosing the word lattice rather than just matrix is because we are already making hard parameterized decisions about what kind of a matrix we want. And so, therefore, we are talking about integers only. In other words, a matrix can have an infinite number of points in it. You guys who have done linear algebra, you know that. But with lattice-based cryptography, we are choosing to throw away all the infinite number of points between the integer points. So, you know, that sounds very math-y but, again, I think it’s more of a simplification in your mind of – think of a standard two-dimensional matrix and then just think of the integer points, you know, 0, 1, 2, 3, 4, 5. Kind of easy to note. And what’s interesting about that is if you only take the integers and you scale that matrix only by integers, all of the sudden you enter the realm of very tough math problems, and isn’t that interesting?
So, yeah, this is the basis of it, Tim. This is the real basis of, ok, why? Why lattice for cryptography problems? And it’s not matrices, it’s lattice and the only real difference between lattice and all matrices is we are choosing the integers only.
TCTim CallanAnd that’s simply to make solving them harder.
So, how do we make these lattices really tough math problems. Well, here’s another thought for all of you: There are a lot of tough math problems out there, but they’re only tough math problems if you parameterize them correctly and you make the problem large enough. In other words, if we stick with - - I don’t think that there’s any such thing as a two-dimensional or three-dimensional lattice used in cryptography. We are gonna be dealing with N-dimensional lattices. In other words, the one that I can think of in my head very simply is two-dimensional. If you really stretch your head, you can think three-dimensional, but the real stuff is gonna be in very high dimensions. Like 10,000-dimension lattices.
TCTim CallanGotcha. Can’t imagine that.
Ok. So, there’s also - - make sure that you also don’t choose a matrix basis, which is really the scale sum of, you know, a couple of factors that you are choosing. Make sure that the basis isn’t too simplistic or is expressed in one of the vectors that you are choosing. In other words, you do have to choose the vectors in your lattice carefully to make sure that they don’t overlap. Just simple mistakes that you shouldn’t make.
And another thing that you really have to do in order to make for tough problems in lattices is you can never allow multiplication by zero to any of the vectors. Otherwise, you just end up at the origin. That’s just too easy to solve.
So, the reason I mention these things, Tim, isn’t - -
TCTim CallanWait. So, all of those rules that are built into the algorithm, you are saying?
So, Tim, I think what’s interesting and the thing I want to get to now is let’s really talk about things that you’ve probably heard about lattice-based cryptography, and I don’t want to make the connection just yet. I think we should do this in a future podcast but, for example, Kyber, right. CRYSTALS-Kyber and Dilithium, both respectively the KEM and Signature algorithms that were chosen to be standardized by NIST, there are many, many forms of tough math problems within lattice cryptography and so, therefore, there are more than one. The ones that were chosen by NIST so far, the two that I just listed, those are in and around the learning with error system of tough math problems. And I’ll describe that in a moment but there are others. There is the shortest vector problem, which is find the shortest non-zero vector in a lattice given the basis of that lattice. And we don’t have to understand fully what that means. I just want you to understand there is more than one math problem within lattice. Shortest vector problems, the closest vector problem, the bounded distance decoding, the covering radius problem and a very popular one, which is, learning with error.
So, let’s go through learning with error without frying our brains.
TCTim CallanLearning without frying our brains.
TCTim CallanOk.
TCTim CallanOk.
TCTim CallanOk.
TCTim CallanThis has the qualities we are expecting from a public/private key exchange which is that result u, that public key can only be derived if you know x but you can’t use u to understand what x is?
So, basically, Bob now, right, he now takes two vectors – B1 and B2. These are both public and then he takes a secret vector. I love it; it’s quite often known as S. The secret random vector. Learning with errors is so interesting because there’s also this concept of an error vector and the beauty of these error vectors, and I think in order to be intuitively more interesting to people but thinking about this error vector is that it should be known to everybody playing this game that the error vectors have a magnitude that is very small. In other words, it’s close to the secret vector. And so, I think from here it gets almost a little too math-y except to say - - and again, this is where I’m gonna it a point. Here’s one of your takeaways.
Really what you are trying to do is anybody who is able to figure out (a) you know this public choice of a matrix – I should say a lattice because it is integer based. This randomly chosen matrix I think what you are really trying to solve for is a point on this matrix being asked to find the point on the grid that is close. So, in other words, Alice and Bob have just enough information between each other and the publicly-based information that would be to say, or available to say Eve, she has just enough to know the size of the matrix, where the matrix is, what the bounds and basis of the matrix are. She even knows for a fact that this error point is close to the actual point that’s been chosen as a secret, but the problem is that to actually solve for it even given all that information is actually very, very, very difficult. And this is the learning with errors problem explained extremely poorly without math. Basically, this combination of publicly chosen matrices and publicly given out information about chosen vectors but also secretly chosen vectors that are tough to solve for given what’s publicly available.
So, Tim, isn’t it interesting that a lot of this rhymes with things that we’ve known from the classical world.
TCTim CallanYeah.
TCTim CallanYeah. So, without trying to get into gnarly math that none of us is gonna understand, let me ask a couple of questions.
You said that there are multiple different lattice-based problems.
You said that there are multiple different lattice-based problems.
TCTim CallanI guess it’s not a coincidence that both Dilithium and Kyber are built on the same one of those lattice-based problems. Is that a fair statement?
TCTim CallanOk. Because for some reason, the nature of this particular problem is very well suited to what we are trying to accomplish here. Is that right?
TCTim CallanYeah. Giant keys.
TCTim CallanOperative word being attempt but yes.
TCTim CallanThere’s a group of people who are saying I have no idea what you are talking about and there is a group of people who are saying you have no idea what you are talking about and nobody else. Right. Exactly.
TCTim CallanAnd as we mentioned, at least one of the motivations of Phase 4 is having all of our eggs in this lattice basket and even though nobody thinks it’s gonna happen, what if it turns out that that basket has a hole in it. Right? So, under those circumstances, to have a different basket that we can throw our eggs in if I just want to really stick with that metaphor. And so, because they are the same and they are built on the same basic premise.
So, for those of you looking it up, that’s the level of oversimplification that I’ve just given you. There’s a lot to this.
TCTim CallanAlright. Cool. Well, there’s a lot to this. Props to you for taking what is an extremely difficult topic and getting to the point where at least I think I can go to a cocktail party and tell somebody who also doesn’t understand this some interesting facts, and I think that’s great. I think that’s a great level of ambition to set for this podcast. I think you did a great job, Jay. So, thank you.
TCTim CallanI know.