By using you agree to our cookie policy, We and our partners operate globally and use cookies, for multiple purposes

34 Bitcoin Terms A to Z

Term 12 - Hash

Hashing is the key to understanding bitcoin.

Terms to know
  • input
  • output
  • algorithm, function, program, recipe, subroutine, system, process
  • Hexadecimal
  • Digital

    Let's talk about humans for a second. What are their inputs. It's their senses. Sight, hearing, feeling, taste, smell. These are the inputs to your brain.

    The outputs are voice, muscle movement, walk, run, jump, force, avoidance, writing a book, making music.

    Inputs go into a system and the system produces output by a set of rules. This set of rules also go by the names algorithm, function, program, recipe, subroutine.

    The function performs actions, calculations on the input and produces an output. Some functions have a known method of producing the output and some are unknown.

    Questions to answer
  • What is a Hash?

    A hash is a function that takes an input of text and produces a unique output. It's one-directional. If you have the input and the hash function, it's easy to produce the output

    But it's hard to take an output from a hash function and produce the input.

    Warning! ! !  Don't enter your real keys here.

    The best way to learn about hashes or anything is to use one webpage. This has a name and it's called SHA256 Secure Hash Algorithm 256 bits.

    Note that a bit is the smallest unit in a binary number (base 2) and it can be a zero or a one.
    An example input: adsjjgjjssshssssssssssssssssssss

    run through the SHA256 returns fd4b594532a4470476263530db4557c005d22a4140817242fb4d055f83cd36f0

    The hash bitcoin uses takes any length of text and converts it to a 64 character string containing the numbers from 0-9 and the letters a-f.

    Note that the asterisk "*" denotes multiplication.

    This output is a hexadecimal number also known as base 16. The numbers we use are decimal or base 10, because we have 10 fingers. So the number 1,234 is one thousand two hundred and thirty four. It is also 1 * 1000 + 2 * 100 + 3 * 10 + 4 * 1. Each digit is written as 10n or 1 * 103 + 2 * 102 + 3 * 101 + 4 * 100. This can also be represented as 1000 + 200 + 30 + 4.

    We can use exponents as a shorthand if you want to write 10 * 10 * 10 * 10 * 10 you could write 105 or 10 to the 5th power.


    A hexadecimal number aka hex used base 16. The digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f. The letters a thru f represent the numbers 10 - 15.

    So the hex number 1234 = 1 * 164 + 2 * 163 + 3 * 162 + 4 * 161.

    But for the purposes of this chapter, it's just a bunch of characters that are unique.

    Video link (This is just a placeholder for now)

    It's an algorithm that takes any input and returns a fixed-size output that's uniquely based on the input.

    It's irreversible. If you know the hash you don't know the input. The same input will always produce the same output as long as you use the same hash algorithm.
    If you know the input sometimes called a key or password, you can put it through the hash algorithm and get the output.

    But if you know the output there's no way of determining the input than by just guessing. Since there are 2256 possibilities it's very hard to guess it.

    It's used in bitcoin for:
  • Mining - Proof of work
  • Bitcoin - Math Puzzle or contest
  • Digital Signatures
  • Securing the network

    Types of Hash Algorithm's
  • SHA256
  • There are many others but not as important for bitcoin understanding

    Other usage of a Hash algorithm.
  • Database
  • Verification that the file you got is the same one I sent
  • https protocol

  • Hash output in this example is hexadecimal.
  • It's 64 characters always
  • It's the same output for the same input
  • There are 1664 possible hashes or 1.1579209e+77 = 11,579,209,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000
  • 2256 possibilities
  • Flipping a fair coin and getting heads 256 times in a row.

    Mining and the Math problem

    You may have heard the term mining and that it uses a math problem.

    Go back to the Hash webpage and try to enter an input in the top to produce a has that starts with one zero, then two, three and four. This is what is basic of mining for a bitcoin.

    The act of mining creates bitcoins out of thin air and at the time of this you get 6.25 BTC for each block that's mined.

    The process of mining gold is to find a place that has gold, dig and remove the gold from the rock. This is an expensive process and hard to do.

    To mine bit coins, you do the following step
    1. Gather a bunch of bitcoin transactions together
    2. Add a block reward of 6.25 coins that goes to you
    3. Add the hash of the previous block
    4. Calculate the hash
    5. Add a random value to the set
    6. if the leading values start with 5 zeroes (or some other number of zeroes the system selects) and you're the first to do it you win
    7. if the hash doesn't have the right number of leading zeroes then go to step 5 and try again

  •    ←Gas Fees | →How to buy/sell bitcoin? | Table of Contents | Send us your feedback | Random | © 2022 All Rights Reserved | Edit