1. Home
  2. Explore
  3. Computer Science
  4. Computer Security

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Computer Security

Transcript

- Greetings and welcome to this lecture on computer security. My name's Richard Harvey, and I am one of the professors here at Gresham College and this is the last lecture of my season. So I hope we're going to have lots of sort of a lively comment and thought afterwards. And we certainly should do, because this is a issue of the moment. That said, computer security is a highly technical area and Gresham College has done a fantastic job at sort of talking about it over the years. And I've just picked out a few sort of distinguished colleagues who've given this something of a running over probably the most recent is Martin Thomas who is my predecessor. Martin was a specialist in computer security and talked about this and privacy in a lot. I also recommend the recent lecture by Tara Wheeler

who is a visiting professor here this year. And she talked about ransomware and what was it? About WannaCry. She was talking about WannaCry, which was the famous a bit of ransomware that caused problems to the national health service. But there are also some lectures in the law series talking about the sort of meaning of this area in terms of society, all of which are sort of fascinating topics. So now I've got this difficult job of having to recap you know, hours and hours and hours of that material. So I'm going to do a sort of grotesquely oversimplified job

which I'm going to do here and the sort of long and the short of it is that software is very complicated. Developers make mistakes and they're not functional mistakes in the sense that they stopped software working. They are exploitable errors and baddies exploit those mistakes and goodies trying to stop those baddies also exploit those mistakes. And we'll talk a little bit about that as we go through this lecture and the consequences of this is all getting a bit out of hand and people are actually dying. Deaths are being caused because some of the systems that are being attacked are in life in, you know, mission critical bits of the internet and the root cause of all of this really is that the internet was designed to work without encryption. And this was something that I covered in the previous lecture on networking.

And you have to go back to that lecture and look at why that was. But now it's not that the internet doesn't have security in it. You know, there's quite a larger level of many levels of internet security. It's just, it's a bit of an afterthought. And you can see that in some of the exploits that people are using in the current hacks and troublemaking on the internet. In terms of a bit of terminology I should quickly reveal that the baddies on the internet are usually known as black hat hackers, black hats, because in old cowboy films the baddies always wore black hats apparently and then people trying to be goodies. They're often the white hats and well, the fact that they use internet users, un-encrypted packets, well I've used a top hat because that's old hat if you like. So these are the hats of computer security.

Now there's more than one lecture that can be written about your private life. And this is Gabriel Garcia Marquez who's famous for this quote, which I like very much. What he doesn't say is that everyone has a right to a private life, but perhaps he could have done and should have done. Now, the right to a private life is a sort of fiercely contested issue actually. And I think it's fair to say that it's not quite resolved how much of aright you have to a private life.

There are various laws in various territories, which imply that you probably should have a right to a private life. I think most government's position would be you have a right to a private life except when we say so. And we're not going to be very precise about what we mean by that. Because if we are precise, it will be exploited by someone in a way that we don't like. Now that's a big problem that sort of shifting sounds of definitions.

And I'm just going to park it there. I'll sort of come back to it at the end of this talk probably. It's a big, big unanswered question mark. And it probably deserves a whole series of legal lectures talking about what your private life is. There've been several inquiries into this or investigations into privacy. Both the Royal Academy of Engineering did one and Royal society did an investigation into it. And if you're fascinated in this topic, you know, there are hundreds and hundreds of pages you can read. I think I can summarize what they said quite quickly which was, "Privacy is quite a good idea. And we think software ought to help you protect it." But that's probably, I'm sort of paraphrasing a bit but that's probably about as far as they got you know, is a complex topic.

In terms of your mental model, ladies and gentlemen it might be helpful to think about what if every single bit of communication took place on a postcard, all right? And let's imagine the whole of society, a whole of sort of Victorian and all of the industrial revolution. The only communication was a postcard because that's the best analogy we've got to a packet. So you can see the problems. I don't know if you remember the scene in who's the character there's a character in Under Milk Wood postman who reads everyone's mail and then tells everyone about it. It would be like that. The, oh, was it Mr. Pew, the postman? I wish I'd remembered anyway whatever you see the problem that when the system is fundamentally open, you have to go to quite extraordinary lengths to keep things private that you would wish to keep private. In short, the sort of four parameters of internet communication which come up time and time again,

they're sort of old tropes almost of the female are one, What is private? What do we mean by privacy? Two, what is the reward for hacking this system? This cryptographic or other protection system versus what is the effort for hacking into that system? And then the last one is which never gets mentioned but I think should is what is the connectivity of that system? And that connectivity one is rather interesting. I mean, there's a sort of modern assumption which is that everybody is connected all of the time and they must be.

That needn't be the case, you know, and, you know, a number of organizations that take security seriously will back up onto what is called air gapped systems or they unplug the cable, having done the backup so that they are just not connected to the internet. Hacking is really an internet phenomenon. You don't get that much hacking without lots of connectivity. So just leave that out there. You don't actually have to connect to the internet all the time. And when you do, you are clearly more

at risk than when you're not there. I'll give you one little sort of anecdote that illustrates that I was at a very, very, very large internet company. A company, which I bet not mentioned but they are very significant in internet communication if not the most significant internet communication. And when the iPhone first came out, their chief executive wanted to connect their iPhone to the internal network of his company. And the first iPhones weren't very secure.

So the network administrator said no. And there was a bit of a tussle, and you can imagine how it worked out which was the chief executive said Jolly, well, I'm connecting and some secret credentials were produced and a secret sort of algorithm, secret set of steps was allowed just so the chief executive could connect his iPhone to the company. One week later, the assist admin rechecked to see that everything was okay. And he discovered that 10 people by that time had connected their iPhone. That's how conductivity spreads, you know, clearly the CEO had told his friends and they told their friends and so on and so on and so on.

In terms of the sort of danger factors if you like, or the factors that cause internet security to be such an issue, I've mentioned the first one which is the fundamental openness of internet packets which means if you want something to be secret you're going to have to assume that everything you do is seen and that's led to a whole new form of a whole new ideas on encryption and security. The second factor is the internet laws do not have exact parallels and physical laws and it's not necessarily a problem that, but it means that you're operating in different legal environment. And you're often operating in a trans jurisdictional, legal environment. So even deciding whether what you want to do is legal and compliant is a major issue and can be very troublesome. And you can see that reflected all over the place. So for example,

a number of secure encryption technologies are prohibited from export to certain countries by the USA and possibly by the UK. So that makes commercial operation using those almost impossible. The third one is a sort of sociological aspect which is people are well, the third and fourth are really psychological aspects, which is people are acknowledged to be disinhibited on the internet. So they don't worry so much about doing things that are antisocial. And the fourth one is that people of similar interests find it easy to flock together. So whereas you're in a village, your interest might've been so minority that essentially would have died out when you in a big community,

it's possible to generate a lot of sort of shared knowledge and shared enterprise which isn't possible when you don't have good connectivity. If you're interested in those two effects, there's a very interesting book by Mary Akan called The Cyber Effect which I hesitate to recommend because I don't agree with everything she says, but it's still a good read. You know, you don't have to agree with everything in a book to, say it's a good book too. So then, well, the solution to some of these problems and it's quite an old elderly solution now is secret writing or cryptography. And the sort of key paper on cryptography was written by Claude Shannon and Claude Shannon's a sort of old friend of this series of lectures and not intentionally, but it, I think in almost every lecture, I have mentioned Claude Shannon 'cause he seems to have invented almost everything. But if you look at past lectures there is a little potted history of the man.

And he wrote a classified report in 1945 when he was at bell systems on secrecy. And he developed this little diagram which sort of explains a message being sent and a key in ciphering it, his key result was that, uncrackable codes are all sorts of isomorphic to a type of code called a one-time pad. A one-time pad is an idea where you essentially give your spy a book of a random jumble of letters and they write their message against that jumble of letters. And then they read off that and you have an identical book your end, and it's essentially an uncrackable.

And the only uncrackable things at one time pad but the enormous impracticality of equipping two people with books, can you imagine trying to encrypt gigabytes of information by reading off one time pad? It's very difficult indeed. The impracticality of that means that you have to share some information and the information you share is called a key. And that's shown in this diagram. So the key is just a number and it's a number that I know and the person who is receiving the information knows and I use my key to jumble up the message usually using some mathematical algorithm that's very difficult to work backwards. The receiver unjumbles it because they have the key and suddenly with the key it becomes easy to unjumble and then they get the message. So a really simple, simple idea. Now, beautiful thing about cryptography is it's very simple to describe and fiendishly difficult in the details. There's a wonderful, a wonderful bits of mathematics.

So I'm going to step quite lightly over cryptography today. Not that it's not interesting. It's too interesting is the problem. Now just to introduce a bit of terminology that is commonly used in the field. One of the senders and receivers of a message you always conventionally known as Alice and the other receiver is known as Bob. There's a very complex backstory being developed about Alice and Bob. I can never, sometimes they're having a divorce and sometimes they're having a secret affair you know, whatever, they originally, they arise from a paper in 1978 by Ron Rivest, Addie Schumer

and Leonard Edelman, the inventors of the RSA named after their initials, RSA encryption algorithms. And they called it Bob and Alice. There's usually somebody sort of lurking in the middle who's Shannon calls an enemy crypto analyst but because they're an eavesdropper they're often called Eve either in the French, Eve or English, female name Eve, it doesn't matter which. If you were interested Wikipedia has a whole cast of these bizarre characters.

But Bob and Alice will, I think Bob and Alice came up in a previous lecture where I was talking about men in the middle attacks on insecurity. So then a bit of detail. I thought I just pick one of these protocols that's used to keep things secret. And rather than picking one of the sort of complex encryption algorithms or pick something which I particularly like which is a method for sharing the keys. Now you can see the problem with this key. You know, if I'm communicating with you

then we have to have this shared secret between us. But if you're selling me stuff, I mean, I've probably never met you. So how do I, when I'm on the John Lewis website, let's say or trying to buy something, how do I tell John Lewis that what my secret key is, well in principle, you know, I could drive up there and sort of give them a great, big long piece of paper and they could say, "Oh, thank you, Mr. Harvey. I'll just write that down and we'll keep it secret. And here's my key."

I don't know, that does happen in very secure systems, that can happen. But obviously it has to be some way in which we exchange this top secret information between us. And if that exchange goes wrong, all my transactions with that person are going to be compromised. So the risks are quite great. I mean, if it's my bank, you know, I don't want my bank account raided and drained just because the preamble to our communication was insecure.

So the solution to this is named after three authors the Diffie Hellman Merkle key exchange. Now a couple of things just quickly to say poor old, Mr. Merkel often gets missed off this. There's no reason for this. He was an original author in fact, Diffie has said he should be named. So I'm going to try and name him correctly each time. However, my brain seems to somehow confuse Merkel with Markel. And I think that's just because of current affairs, and I keep making Mr. Merkle or so if I do that, please, excuse me. He is a Merkle, not a Markel. Sorry, basic idea here.

Now, ladies and gentlemen there's a tiny little bit of mathematics coming up. It might look a bit daunting at this stage. Do not freak out. It is EDP, the easy, easy lemon squeezy stuff that we're going to go through. And even if you don't get it, it doesn't matter. The whole lecture will not be ruined for you. I just want to go through this because I think it's particularly beautiful. So here's the idea. What we're going to do is we're going to publicize two numbers and I'm going to call those G and p and everybody can know those. And what we're going to use is a very simple little bit of maths to convert my secret number into a public number, okay? And I've written down the secret the simple bit of maths here. That's the only bit of maths we need. Now, it says G raised to the power key mod p equals K. So if you've just ignored the mod p for a moment what you've got to do is raise a number to a power.

Now it's not at all obvious when I say that why that should lead to any secrecy at all. So I'm just going to explain briefly why that makes it a challenge and just, you know, keep the faith because it's not that hard. And the reason it becomes a code, you know, becomes a challenge for someone to decrypt is modulo arithmetic. So in order to explain what's going on here I'm firstly going to ignore the modulo bit and then we'll get back to it. So let's choose a G and this is usually called a base.

So I'm picking a simple example here. I'm actually picking one that's on Wikipedia. So if you want to follow this up later you can just work the numbers and get the same answer. So if I said where my G is five then G raised to the power one is just five, right? That's just one not of five. G squared is five times five, 25. G cubed, five times five times five, 125. G to the four, 625 and so on and so on. Everyone can do that, right? Yep good. That's it. That's the easy bit. No problem.

So, now let's do that using modulo arithmetic and you have to declare a number over which you're going to do your modulo arithmetic and I've picked a number 23. I should say, 23 is not the number that is used in reality. It is a far, far, far, far larger number than that. So what I'm going to do now is I'm going to compute G raised to this power, and then I'm going to work out the answer modulo 23. And what modulo means is look, divide the result by 23 and see what the remainder is.

Okay, so let's do that. So G raised to the power one is five, right? Well, 23 goes into five, zero times. So the remainder is just five and I've plotted five over there on my circle. G squared is 25. 25 we can divide that by 23 once giving a remainder of two. So G squared mod 23 is two. And I've put two over here on my circle.

G cubed is 10, G to the fourth is four. These are just the remainders modulo 23. Now I don't know if you've noticed but what seemed to be a very sort of obvious progression. You know, if we wrote down in a sort of a guardian quiz at the back or in the newspaper quiz can you work out what's going on here? Five 25 125 625. It's sort of, you know, quite junior school, we go, oh yes, it's powers of five. As soon as we've added this modulo functioning it's become this sort of splendid jumble

in a five, two, 10 numbers are all over the place. Right, that's why this is difficult to decrypt. Okay, that modulo function makes it very hard to work this backwards. And that's what the key exchange system uses. So this is how it works. It's a really beautiful system. So let's say Alice is going to initiate communication. And the good Alice is going to speak to the good Bob. And lurking in the model in the middle here is the general public.

And amongst the general public, we have Eve who is listening in with her bat-like ears and trying to solve this problem. So everybody knows in this case p which was 23 and G which was the base, which was five that's well-known. Alice chooses a secret key, let's say six. And what she does is she then compute her public key. So she raises G to the power A and then she computes that modulo 23 giving the result eight and eight is now a public number. Eve cannot work back easily from eight to the private key, well to be fair Eve could if P was 23, but Eve just certainly cannot. If P was the number I'm going to show you in a moment too it's very hard.

Bob also does the same. He says, well, I'm going to choose a secret key. Here's my secret key which is 15, same idea. Compute my public key, which is 19. And then the beautiful bit happens which is Alice then raises Bob's public key 19 to the power of her private key and computes the modulo again. And she gets the number two. And then Bob computes, Alice's public key, raises it to the power of his private key modulo again. And he also gets the number two. Now this number two is a shared secret between Alice and Bob that Eve cannot discover.

Now, if this was an undergraduate lecture, I would say I leave it as an exercise to the reader to prove that they are identical, but there's a little observation down in the bottom here that they are the same thing. Now, this is a, you know, very sort of attractive idea because Alice and Bob are sharing information publicly. And that's usually called the public key, but retaining the secrets Eve does not have enough information to easily crack that. Okay, well, how might we crack it? Well, if we knew G and P and we do then we've really got to do, what's called an well, the simplest thing is to do an exhaustive search. So what we would do in this case, we would say, well what if we guess, so we say, well, maybe Alice's key was one.

If it was one, what would happen? Oh, five to the power one is one. No, it's not that, what if it was two? Oh, if I made it, no. So we have to search through every single possibility. Yeah right. That is not good. I've written ad nauseum for good reason. And that sort of search is going to take around P squared, multiplications. Now you might say, well, I've already said p equals 23. You know, anyone could solve that. This is a real p, okay? That is a long, long, long number. I can't even read it out. It's so long. It's roughly 10 to the power 464. So the number of multiplications to solve that is 10 to the 900 something like that, which is, you know, that's more atoms in the universe, sort of territory is absolutely horrific. So that's a very attractive sort of algorithm. It's got this computational assymetry.

So that's all very encouraging because you are using the Diffie Hellman Merkle key exchange right now. I mean, you used it to initiate your discussion with Crowdcast. If you're watching this on Crowdcast, you're using it with YouTube. If you're watching it on YouTube you're probably simultaneously buying something on eBay and you everybody uses this. So it's good news that this is not easily crackable. Well, perhaps not use that p though because that one has been cracked actually. It's a bit too simple, that one. And it's rather interesting how it came about just to give you a sort of feel for this. What are the things that you do routinely in cryptography? Is you don't just sort of waffle about how much computation might be required. What people do is they look at the way you might crack this code. So you look at the most efficient algorithm for solving this which is a discreet log problem.

And there's a number civ algorithm which you could probably use. You look at what you think the complexity of that is. You then work out how long that would take to compute on a current computer. You then feed forward using something called Moore's law which is an estimate of how computation will change in the future. Basically computational power will double every 18 months. You then add a sort of safety band and you say, well, "This key then will be crackable at this point in the future." So you say, well, let's say I was, I wanted this to be safe up to say, 2030, you turn to your Arjun Lindstrom and Eric Verheul paper, which has all of these things listed. And you say, 2030, what do we require? Oh yeah, we need a key. We will need a key length of one and a half thousand digits which is in fact what they recommend and is what people currently recommend. So it's not an idle, it's not a sort

of casual hand-waving argument. It's a very specific argument. Now, of course, it doesn't take account of developments in numerical methods which might make that easier because you can't predict what people might know in the future. So if a new method for finding primes suddenly pops out the system, then it is quite possible that, you know, you've got this wrong. 1,500 bit is a little bit long, actually. So if you're interested and you can check this when you look at the what your browser is doing,

you'll usually find that people are now not using a circle as the confuser if you like, that's the modulo arithmetic. They're usually using a nice looking fancy curve which looks a bit like this, it's called an elliptic curve. So if you've heard of this term elliptic cryptography, it uses these curves like this. And what I was showing you previously was multiplication over the modulo. So we were raising five to the power. That's a multiplication. And actually what you do is a sort of addition over the elliptic curve. It's not the addition that we know, addition looks a bit weird in elliptic geometry, it looks a bit like this. So you, if this is a point X, you draw a tangent through the curve and then you reflect it onto the next part of the curve. And that's how two X is defined in elliptic geometry. To get three X you draw a line between X and two X like that. Then you bounce it across to the other side of the curve and that gives you three X and so on and so on.

Now exactly why this happens is another interesting lecture on elliptic geometry and the elliptic curves very thoroughly recommend doing that. What I was keen to show was that you're getting that same sort of jumble effect that you get with the circle is very hard looking at these pink dots on the curve to work out what the heck the parameters were. Elliptic curves has two parameters. And because it's more complex you can get away with shorter keys. And as I say, here, it's become the sort of Swiss army knife of a cryptography, but it's just a sort of fancier version of that.

Now, Diffie Hellman Merkle is so I did it. I called him Merkel instead of Merkle. Diffie-Hellman Merkle is a great system and probably has not been hacked too much at the moment. So we're safe using it. There are some people who can make some claims it's being hacked, but mostly people think it's secure as long as you're using a safe key parameters and there are various recommendations on how you should set those key groups nowadays.

And it protects you provided you are talking to someone who's genuine. What it doesn't do it doesn't protect you from what are called man in the middle attacks. So in the man in the middle attack is really quite easy to describe. And I did talk about them in a previous lecture on networks where we were discussing the onion router which is a method that's meant to be more robust to a man in the middle attacks. The idea of a bit of man middle attack is you think you're communicating with Barclays Bank but I'm in the middle of you.

And when you're sending a message to Barclays I'm going, "Oh, thank you very much. I am Barclays." And to Barclays, "I'm saying I am Keith, and I want my money." And I'm sort of keeping two conversations going at once each one of you thinking that you're communicating with someone you're communicating with Eve the evil person in the middle. So how does that get fixed? Well, there's a bit of cryptography that I haven't talked about. Probably haven't got time to talk about which is called certification authority. So if you click on the padlock on your browser if you're watching this online then you will see details of how that certification works. So if, for example, if you were clicking on the padlock on the Gresham College website you would see a certificate signed by Amazon. Amazon would say, well, essentially Gresham College have paid us some money and bought a certificate from us. And for that fee, we are prepared to assert that this is genuine.

Now, precisely how that happens and is itself robust to the man in the middle attack is a little bit complicated to explain but it uses a cunning, an interesting bit of technology called a hash and the hash is a numerical way of checking whether something is correct. And because they're interesting I'll come back to them in a moment. Right, so that's enough crypto for a bit. Otherwise all our brains will explode. So you can see the idea. The idea is to make this sort of confuser of which the elliptic curve is a good example.

Now then, hacking. Well, we could have a huge great discussion about the history of hacking. I just wanted to pick out some sort of errors in hacking which I think are interesting in terms of what I'm trying to say in terms of this lecture. When we look very early on in hacking of course there wasn't an internet. So the early attempts at I was going to say deception but I don't even think that is correct. There is sort of real intellectual curiosity about how things worked was driving the early attempts at hacking and probably the earliest about was something called phone freaking. I don't know if you remember phone freaking but the idea was, soon became quite apparent that a number of telcos were using tones, secret tones.

You could send down the wire to control the exchange. So this was great because you could send the right combinations of tones down an AT&T wire in the US and get free phone calls. So this was great. You could buy a box called a frame freaking boxing and beep, beep, beep. And suddenly you've got free phone calls. Well marvelous. And of course it was ripping off AT&T, but one it was sort of ripping off the man, you know, so that was good. And it was generally sort of Robin hood sort of crime and are barely seen as crime. And it probably arose out of sort of intellectual curiosity about how things worked. And I think a genuine worry that companies weren't taking security seriously. And that was probably also true of the first big financial hack really which was the Chaos Computer Club hack in 1984.

They Chaos Computer Club discovered a floor in a Hamburg bank, and they removed 134,000 deutsche marks from it. What reason they did this was because prior to the incident, they had notified the bank that there was a floor and the bank had either ignored them or just said, no, there isn't. So to prove that there was, they removed 134,000 deutsche marks and the press conference the following day they gave it back. You know, and it was a very sort of public, almost a sort of public spirited attempt to show that there was some computer security problems. And the same sort of idea was probably behind the first computer worm known as the the Morris worm after

Robert Morris, wasn't it? Yes, Robert Morris was a grad student, I think at Harvard. And he released this hack, which relied in part upon something which he's still with us which is the dreaded buffer overflow hack. Again, a bit of software engineering era. Somebody had designed a buffer which wasn't able to deal with overflows properly. So when you overflowed it the computer was left in a state that made it vulnerable and this worm spread fairly vigorously around the internet. Morris was arrested. I think he was the first felony conviction in the USA actually under the compete 1986,

Computer Fraud and Abuse Act. And he was given a suspended sentence but it was really a bit of intellectual curiosity that he did this. You know, he was curious to know if he could make this thing spread and by God it did. It took a lot of time to unspread it. And he paid the price. Or the, well, perhaps not so much of a price because he's now a professor at MIT actually which was the organization he attempted to smear from. Well, he released the Morris worm from MIT even though he wasn't at MIT in an attempt to sort of throw off the feds to persuade them to go somewhere else.

In the 1990s, everything changed. We moved from this intellectual curiosity being the dominant force. It's still there in a lot of hacking attempts to commerce. And as soon as we had commerce, we've got cash on the table. And, you know, that really led to this whole new form of hacking which is very prevalent at the moment, you know which is theft and or extortion. They're not really doing it for any public spirited reasons. They're not really doing it to be a menace. They're doing it to make money. Very simple bit of crime really. And then this last theme, which has popped up recently with the Snowden leaks and that's really cyber warfare. You know, it's using the internet for state purposes that amount to warfare.

And there was a very interesting lecture by Tara Wheeler talking about how on the flip side of warfare we also have war crimes, you know, and clearly some of the, well, I found her argument persuasive that clearly some of these hacks are tantamount, if not, perhaps more than tantamount to war crimes because they are causing a mass hurt to, in according mass hurt and it's been done so indiscriminately which is one of the features of a war crime I believe. Right okay. Well that was just a brief relief and I'll quickly get back to hash functions. Now, hash functions, what are they? So, one of the things that comes up a lot

in computing is a worry that you need to check that the data you've transmitted is correct. And you can see the problem. You know, I think the other day I was doing a backup and it was, what was it? A couple of terabytes. Well, how do I know that a couple of terabytes was transferred from my little computer in the middle of Suffolk to some server. Lord knows where in somewhere in Europe? And it was transmitted without errors because certainly there's a lot of errors about and there's no reason to think that things shouldn't have error. Well, actually that's a relatively easy problem and we'll use a check number and that check number travels with the data.

So the obvious one is to say, well why don't we just, well take a block of data? And if it's got an even number of ones in it I'll add a one to make it an odd number of ones. And that's called odd parity. Let's say if it's got an odd number of ones, I'll add one. And so you can see that it gives you some protection because if one of those ones gets changed then probably the ones don't match anymore because I've converted an even number to an odd number the parody doesn't match, oh, something's happened. Not only gives me protection of one error and parity is, you know, that's one of the problems with parity. Parity is cheap, but it doesn't give you much protection. And parity is used at a very low level in the internet already. Well, could we do something fancier? Yeah, let's add up the number of ones and let's write that to a field. And pretty much every packet in the internet will have a checksum added to it

which essentially counts the number of ones in the packets. So if the packets corrupted, the checksum doesn't add more. If a check sounds corrupted, it doesn't add up. So we re-add it, adding is quick. So we just go to be, there's meant to be 17 ones in this packet. This is 16 error, resend the packet. It's a very simple idea. Or perhaps we could generate a sort of string of digits. There's a sort of digital fingerprint for the data. Now there's lots of ways you could do that. But the basic idea is to put the data through some incredibly sort of complex mixer and sort of munshi digital, great big digital munshing that produces a number that is unique to the data. And that's what we call a hash function. It's called a hash from a cooking analogy. So if you have a breakfast hash or something

it's a mixture of, you know, eggs and bacon and all sorts of lovely things that aren't very good for you and like a hash you know the ingredients, but you jolly well can't separate them once they've been cooked together. So that's the idea behind a hash function. Now, cryptographic hashes have been around for ages. Cryptographic hashes have some special properties. So they have the basic property which is they are going to convert a file or a block of data into a set of numbers.

This is actually one of the simple cryptographic hashes out there. And don't worry about the numbers they're written in hexadecimal but I could have written them in binary or decimal or something it's just number. The first requirement of a cryptographic hash is it's impossible or very difficult to get back the original data from the hash. So you can't easily look at the hash and work out what was sent. So this can be very useful for checking something is correct

without actually knowing what the something is. You can imagine, how might this be useful. Let's say we had a photograph of me and you wanted to check that it really was me but you didn't actually want to send the photograph. So what you would do, you just check the hash you would say, well, the hash matches. So probably it is that image of Richard that I'm of, you don't have to send the original. Very useful in cryptography. The other requirement of a cryptographic hash is that there are no collisions. A collision is when two bits of data have the same hash. So we don't want that to happen. And collision attacks come up a lot in crypto actually. I can't remember maybe we talk about them a little bit later. So crypto hash shouldn't have this property. We shouldn't be able to generate a hash from two separate bits of data. That said, one of the well-known hashes, the secure hash algorithm. One of the first secure hashtags it was

in fact broken with a collision in 2017. And here is the paper that discussed this was called SHA 'cause it was called SHA, the cryptic secure hash algorithm. This paper is called SHAttered. And these are the two files that generate this hash. That is actually the hash of those two files. And you can see that they are fundamentally different. They're both PDF files, but they generate the same data. So these hashes are tending to get longer and longer and longer. And I think this was a current state of the r is where it sort of smallest hash that one day it gets away with this SHA two, five, six. So that's 256.

Length hasn't been broken yet. This is an example of SHA256 and as my block of data, which I've transferred into this great, big, long thing, it's longer it's commonly used. And most hashies you would wish to be speedy because you want to be able to quickly check, quickly verify that this thing is what was sent or some sort of baseline. Now, the reason I mentioned SHA256 is because it's commonly used in cryptocurrency and this is a well-known cryptocurrency. This is Bitcoin. And the idea here behind cryptocurrency is that we have a secret key. That's an example of a secret key here. We put it through some elliptic curve cryptosystem and that generates a public key. So just thinking back to Alison Bob and Diffie Hellman Merkle, they're not using that algorithm they're using something much more complicated

and the trouble is that public key is absolutely jolly enormous. That's this thing here. So what the hash function does is it fixes it into a fixed size and smaller number that isn't the public key but it's something that we can work with. So it uses this crypto hash to get an address. And once you've gotten the address you can generate you can transact with in this case, crypto coin this case is called Bitcoin which is a one of these public ledger systems. Okay, so far so good. You know, and that seems fairly secure. However, the problem, and this is a problem with a lot of secure systems, is that you can't possibly remember these keys. I mean, they're completely impossible. So what a lot of people do is they use a wallet system and this is the algorithm for a particularly insecure wallet system called brain wallet.

And what you do is you have some plain text, a system like this, you walk it through, SHA256 which is a nice secure hash algorithm you generate a secret key and off you go. I could tell you the problem with this, but I there's a brilliant lecture on this on YouTube. And I'll just get, I'm going to play you quite a long clip of it because I think it sort of brilliantly expounds all of the things I've been talking about in a really compressed way. Now, these guys talk pretty quickly. So do listen carefully - If there is something that is very useful to know about is brain wallets. Now, the idea of brain wallets is to be able it

to control some money some Bitcoin, just something that you can keep in your head. And this may seem like a good idea because nobody can read your mind, right? But as we learned a fast computer can probably get take a very good guess at anything that you are able to remember yourself. So how brain wallets work is that they just add another step in the revision process we've seen before. So to generate the private key, they just take some memorable string like correct horse, battery staple or whatever you're using and hash it to get a private key that then is used to the public key to join the address which they use to receive money. And then by just remembering that string you can move that money and use it to pay for something else.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent