What's the world's most popular computer algorithm? Maybe the SHA-256 hash function. I want to show you what it does and tell you about a problem that no one on Earth knows how to solve. And explain why billions of dollars are at stake. The SHA-256 algorithm is a deterministic one-way hash function. Now what in the world do those words even mean? An algorithm is just a process or a list of steps for doing something. A hash function is a mathematical function that takes any size of input but has an output of a fixed size. You can think of it as a digital fingerprint for the file. It's deterministic, which means whenever you start with the same input, you always get the same output. And SHA-256 stands for Secure Hash Algorithm and outputs 256 bits. What does one-way mean? Well, that's just a function that's hard to do backwards. Some functions are easy to do backwards, like for example, the function of adding 30. You just subtract 30 to do the reverse. But the function of multiplying two large prime numbers together is really hard to do backwards. Take a look at my follow-up video for more details. OK, back to SHA-256. It's an algorithm for a one-way hash function that takes any kind of digital input and any length of input and always outputs exactly 256 bits. Or 256 ones and zeros, which is basically a big long number. Usually written as 64 hex digits like this. Let me tell you about two things that make this function really interesting and useful. First of all, the only time you ever end up with the same hash or the same fingerprint is if you started with exactly identical input. There are so many different possible fingerprints that no two inputs have ever ended up with the same fingerprint. And I mean never in the history of the world. How many different hashes are there? Two to the 256, which means two multiplied by itself 256 times. Or to be specific, 115 quad-tour via gentilian, 792 Tresp via gentilian, 89 dual via gentilian, 230, you get the idea. Another interesting property of this function is that it's designed to have the butterfly effect built in such that changing the input just a little bit completely changes the output. Let me show you an example. Here's a picture I took. It's 1000 by 1000 pixels and the file is 24 million bits long. When I run this through the Shock 256 algorithm, it outputs this hash. Now watch what happens when I change one single bit in the input. I'm going to zoom in to this pixel on the telephone pole and change the green value by changing this 0 to a 1. Now I rerun the algorithm and I get a completely different output. And that's from changing just one single bit out of more than 24 million bits. So these properties make Shock 256 useful for all kinds of applications. Cryptography, digital signatures, authentication. Oh, and there's bitcoin. More in a minute. Beyond the usefulness of this algorithm, I think some of the philosophical consequences are amazing to think about. First of all, it's possible for you to see a number that literally no one else in human history has ever seen before. All you have to do is take a picture with some randomness in it and then calculate the Shock 256 hash. So ladies and gentlemen, here's the world premiere of this number that I just made from that picture. It's never been seen before. Also, I think it's cool that here's a mathematical function that anyone can do on their computer, but no one has any idea how to do the reverse of this function. How do we know? Because there are billions of dollars at stake. You see, Shock 256 is a key part of the bitcoin protocol. If you could reverse the algorithm, you could mine bitcoin faster than anyone else and make a lot of money. In order to mine bitcoin, all you have to do is find an input that produces a Shock 256 output with 70-something zeros at the beginning. But since there's no known formula, the best anyone can do is do it by brute force, which means just trying a bunch of different inputs until they find something that works. Now I said before, it's impossible to find an input that matches a specific hash fingerprint. And that's true, but bitcoin mining only requires that you find a hash that's close, not an exact match. In fact, the difficulty can be adjusted up or down to make it such that about every 10 minutes, someone somewhere finds a match, earning themselves 12.5 bitcoins, which is somewhere between $12 and $12 million. Also, that's why I think it's the most popular algorithm on earth, or maybe I should say the most commonly computed algorithm on earth. In the race to mine bitcoin, special computers have been built just for running Shock 256 as fast as possible. How fast? Well, if you add up all of the bitcoin miners and all of the world, they're currently doing 60 trillion hashes. No wait, 60 quadrillion. No, 60 quintillion hashes per day mining bitcoin. Oh wait, I'm wrong again. Not 60 quintillion per day, not per hour, not per minute, but per second. That's right, Shock 256 is run 60 quintillion times per second all day every day. So yes, I think it's fair to say that Shock 256 is the most popular algorithm. I mean, unless you count adding and multiplying, which are parts of Shock 256, maybe it's the most popular big algorithm. Actually, I suppose there might be some digital signal processing algorithms, like Fourier transforms that beat it. But more than 60 quintillion times per second, I don't know. Anyway, all of this is good evidence that no one has figured out a shortcut, because there's a huge financial incentive to do so. Or maybe they have, but they just know not to kill the goose laying the golden eggs and they're slowly collecting bitcoins. Or maybe there's some kind of secretive government organization hiding the truth from the populace. Let's see, who invented bitcoin? Nobody knows what? And who designed Shock 256? See the NSA? Who are they? United States National Security Agency? Uh-oh, I think I better go now. Thanks for watching.