The World’s Most Popular Algorithm: SHA 256 and Bitcoin

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. [Intro Music] The SHA 256 algorithm is a deterministic one-way hash function. Now, what it the world do those words even mean? An algorithm is just a process, or 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 it 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 primes together is really hard to do backwards. Take a look at my follow-up video for more details. Okay, 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 the 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 256th, which means two multiplied by itself 256 times, or to be specific, 115 quattourvigintillion, 792 tresvigintillion, 89 duovigintillion, 230, you get the idea. Another interesting property of this funciton 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 SHA 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 zero to a one. Now I re-run 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 SHA 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 calculate the SHA 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, SHA 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 SHA 256 output with 70-something zeros at the beginning. But, since there’s no known formula, the best anyone can do, is to 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 ten minutes, someone, somewhere finds a match, earning themselves 12.5 bitcoins, which is worth somewhere between
12 dollars and 12 million dollars. 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 this race to mine bitcoin, special computers have been built just for running SHA 256 as fast as possible. How fast? Well, if you add up all of the bitcoin miners in 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, SHA 256 is run 60 quintillion times per second,
all day, every day. So yes, I think it’s fair to say that SHA 256 is the most popular algorithm. I mean, unless you count adding and multiplying, which are parts of SHA 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 know not to kill the goose laying the golden eggs, and they’re just slowly collecting bitcoins. Or maybe there’s some kind a secretive government organization, hiding the truth from the populace. Let’s see, who invented bitcoin? Nobody knows, what? And who designed SHA 256? Let’s see, the NSA? Who are they? United States National Security Agency! Uh-Oh. I think I better go now. Thanks for watching.

53 thoughts on “The World’s Most Popular Algorithm: SHA 256 and Bitcoin”

  1. You actually post non-prank videos??

    Just kidding. Love your work though, whether or not it's an April Fool's Day video or not.

  2. It may sound weird, but all this is also good news. Bitcoin has a lot of whales and miners have been saving up bitcoin and sometimes have to cash in. For bitcoin to become viable, it has to spread from a few people having a lot of bitcoin to a lot of people having a few bitcoin. This means that large players will be making large moves. Volatility slowly decreases over time. The more the speculators relax and hold, the more healthy and bullish the market becomes with less volatility, that is when large investors will dare to move in.I lost 3BTC when I started trading CRYPTO it was devastating, I was lost until I found a comment about the great Mr. CASTRO EDWIN contacted him and he promised to help me not only to recover my lost money but to earn for the rest of my life, I have earned 7BTC in less than a month from his tradings.He is so competent , honest, consistent and very experienced, contact him at castroedwin195 @ gmail com or via telegram *@castroedwin1,here is also his WhatsApp +1(845)400-7574

  3. 01:02 You're saying that it's REALLY hard to divide 2,818,051 by 223? That's EASY for me. I'm studying algebra, but I can do the long division on paper!

  4. Pi is a new cryptocurrency for and by everyday people that you can “mine” (or earn) from your phone. Pi does not affect your phone’s performance, drain your battery, or use your network data . Once you hit the lightning button, you can even close the app and you will continue to mine Pi. Pi is not a scam. It is a genuine effort by a team of Stanford graduates to give everyday people greater access to cryptocurrency. Read the FAQ section when you download the app. To begin click this link: or go to Play Store and download Pi Network Lite. Invitation code to share: princeulrich75

  5. This is one of the most simplified and well explained SHA256 algorithm explanation i have ever come across.
    I instantly liked the video just few minutes in.
    You are a great teacher. If i was to advise anyone to attend Biola Uni, it will be because of you.

    Keep up the great work, will love to see more videos like this (or the airplane haox debunking video) cause April fool is just once a year and i love really your content 🙂

  6. Avalanche effect would be the correct term, but I guess butterfly effect is not wrong. Just not used that common in the context of cryptography

  7. Very nice video! I'm glad I checked your work out. Have to agree with previous commentator that this is one of the best overviews on this very interesting topic. Keep it up 🙂

  8. Non reversible binary circuits like sha256 are can be transformed into quantum reversible circuits. 52 out of the 64 rounds of sha256 were broken a few years ago already. If someone is mining with a QC he won't go on social media tell everyone

  9. Professor, You're a blessing in this world of wild pseudo-intellectual youtubers. I just found you, thanks for existing.

  10. So NSA maybe knows how to reverse engineer it or collide it? And they will use it when BTC really becomes a treat for the USD?

  11. Now can you go into detail about the OCP3 Optical Lines and the MD5#? Tyrone and Buk Lau would be very interested I'm sure.

  12. Very interesting video, subscribed. I've always wondered what makes a hash value a bitcoin. I havent ever seen anyone ever explain this complex stuff in this easy to understand way. I'm sure you are a fantastic teacher, your students are lucky to have you!

Leave a Reply

Your email address will not be published. Required fields are marked *