CS120 Study Guide

Unit 4: Hashing

4a. Explain the utility of hashing data 

  • What is the most important attribute of a hash function, and what are hashes used for?

The most important attributes of hashing functions are their uniqueness and one-way functions, essentially making a "digital fingerprint" of the input that is infeasible to reverse engineer. Any changes to the data represented by the hash will completely transform the hash of the data and, therefore, can be used to verify that no data has been altered.
 
Hash functions are used in Bitcoin to summarize transaction data, conduct mining proof of work, and generate addresses.
 
To review, see Hash Functions, Mining, and Addresses and Hashing Algorithms.
 

4b. Describe how hashing is used in Bitcoin mining 

  • How are the number of zeros required in a hash important for Bitcoin mining?

The number of zeros required in a hash is proportional to the difficulty of mining on the network. The more leading zeros required in the hash of a bitcoin block, the harder it is to find a hash that fits.
 
Therefore, the amount of leading zeros required in a hash represents the current level of mining difficulty in the network, a critical feature in proof-of-work.
 
To review, see Mining Fees, Block Data, Block Headers, and Proof-of-Work and How Is the Number of Zeros in the Target Hash Determined?.
 

4c. Differentiate between the different uses of hashing in Bitcoin

  • What are some of Bitcoin's main processes and components that rely on hashing?

Hash functions are used extensively in Bitcoin. Some of the main components and processes that rely on hashing are generating Bitcoin addresses from public keys, identifying Bitcoin blocks, identifying Bitcoin transactions, and Bitcoin mining proof of work.
 
To review, see Hashing Algorithms and Mining and Consensus.
 

4d. Hash data and verify that a hash was produced from that data 

  • Is there only one standard hashing algorithm?

There are many standard cryptographic hashing algorithms. However, Bitcoin uses one in particular, called SHA256, as it has distinct advantages for the Bitcoin Network.
 
SHA256 hashing produces easily verifiable values, is hard to guess at random via a brute force attack, and is unlikely to create collisions (two distinct inputs producing the same output).
 
To review, see Hash Functions, Mining, and Addresses and Merkle Trees.
 

4e. Describe the utility of a Merkle tree 

  • What is the main attribute of a Merkle Tree used in Bitcoin?

The main attribute of Merkle Trees that makes them useful in the Bitcoin Network is their ability to efficiently summarize large amounts of data in an easily verifiable manner. Remember, a Merkle Tree is a tree data structure containing cryptographic hashes.
 
Bitcoin uses Merkle Trees for this reason: a Merkle tree structure is used to summarize all the transactions in each blockchain block, producing an easily verifiable digital "fingerprint" of all the transactions in the block.
 
To review, see Merkle Trees.
 

Unit 4 Vocabulary

This vocabulary list includes terms you will need to know to successfully complete the final exam.

  • cryptographic hash function
  • Merkle tree
  • SHA256 algorithm