Homework on Hash Functions - Questions

  1. Describe hash functions with your own words
    A hash function takes any input and converts it to a randomized sequence of letters and numbers. The output by SHA256 is unique based on the input, thereby creating a ‘fingerprint’ for that input.

  2. How are hash functions used in cryptocurrencies like bitcoin?
    Transaction data of each block in the bitcoin blockchain is hashed. When a new block is added, the hash of the prior block is included in the new block - therefore creating the chain.

  3. What does it mean when we say that hash functions need to be collision resistant?
    Collision-resistant means that you can’t have 2+ different inputs generate the same output by the hash function.

1 Like
  1. A hash function allows for a unique input to give a unique output. You can go from input to output but you can’t go from output to input. It’s a one way mechanism that gives a unique output. if the initial input is changed the hash function produces a totally different output.
  2. Cryptocurrencies like bitcoin use hash functions to write transactions, solve blocks, and to be untraceable and unbreakable.
  3. The reason way hash functions need to be collision resistant is to avoid double spending and the revisal of any transaction. One input gives one output.
1 Like
  1. A hash function is simply a function that will always generate the same unique output for every unique input. Each input gets a unique fingerprint.
  2. Every transaction has a hash function for miners to solve to validate the transaction and add it to the blockchain.
  3. It is important to be collision resistant to avoid the appearance of some transaction taking place that actually did not happen. When a hash function “collides” it means that 2 inputs generated the exact same output. This can happen, but is very rare and should be difficult for hackers to exploit. If it is easy to find collisions, the security of the system is compromised.
1 Like
  1. Describe hash functions with your own words

A hash function takes any size data and gives it a unique “fingerprint” output of fixed size.

  1. How are hash functions used in cryptocurrencies like bitcoin?

Hash functions are used to secure the previous blocks of the blockchain.

  1. What does it mean when we say that hash functions need to be collision resistant?

Collision resistant mean that no two inputs will result in the same output of the hash function.

1 Like
  1. Hash function is a cryptographic mechanism that change the input (text, image, sound) to an irreversible a set of strings and numbers.
  2. Hash function turns the bitcoin transaction data into cryptographic hash value and record it in the blockchain
  3. Collision resistant means when you put the different inputs on the hash function you never get the same result (hash value)
1 Like
  1. Hash generates unique fingerprint from given string
  2. Hash is calculated for each block. Block consists group of attributes that are computed within hash, hash validates attribute values so those cannot be changed.
  3. Collision resistant is that different strings cant generate same hash output.
1 Like
  1. A hash function determines a hash of arbitrary strips of data to a random, fixed length output.

  2. Hash functions produce hashes that represent the state of the blockchain. Every transaction holds bits of info that is combined into a transaction ID that can be used to confirm that a transaction has occurred.

  3. To stop collisions from happening the hash function must produce a random hash value with every transaction. If two different hash functions produce the same hash, a collision has occurred.

1 Like
  1. Describe hash functions with your own words
    Hash functions are irreversible functions where each unique input has a unique output.

  2. How are hash functions used in cryptocurrencies like bitcoin? (Try to research this on your own, we will cover this later in the course but challenge yourself and see if you can find information on this already now).
    They are used to make the blockchain immutable. Since hash functions are irreversible, blocks on the blockchain cannot be destroyed/deleted.

  3. What does it mean when we say that hash functions need to be collision resistant? (We didn’t use the term “collision resistant” in the lecture, but you will easily find this on Google, we add this question intentionally to make you research information on your own, that’s how you learn best).
    Collision resistant means that no two inputs can result in the same output.

1 Like

Hash function is making a regular text or number into a cryptographic text

Hash functions are used to create public key from private key.

Collision resistant is one way function. So if you say hello and ouput is
0123456789abcdef then you can not find hello in some way
Also if you collect all inouts and outputs you can figure the function in some way. This part i did not undertsand.

1 Like

1.Hash Functions
A. Each unique input gives a unique output (fingerprint)
B. Input to out but never from output to input (data integrity)

  1. Hash functions in Bitcoin use mining to create new blocks on the blockchain.

  2. Collision resistant happens when two inputs make the same output.

3 Likes
  1. Describe hash functions with your own words
    A - Takes the input data, scrambles & outputs a unique data (fingerprint).
  2. How are hash functions used in cryptocurrencies like bitcoin?
    A - To secure the network with unique hash for each transaction on the blockchain.
  3. What does it mean when we say that hash functions need to be collision resistant?
    A - Means that inputs are not to produce the same output hash.
1 Like
  1. Describe hash functions with our own words.
    A hash function takes in some data (text, media files, etc.) and it gives you a unique 32-bit summary (digital fingerprint) of that data. Basically, it will scramble the input and give you a short digest (output) of that data. So, if you make a tiny change to the input you will have a completely different result.

  2. How are hash functions used in cryptocurrencies like Bitcoin?
    Hash functions are used in cryptocurrencies like Bitcoin to turn any data input into a unique output. They are used to encrypt data. SHA-256 is the cryptographic hash function used in Bitcoin. The input gets converted into a hash, where that hash gets put into a block, then into the blockchain, where it can be viewed in the public ledger.

  3. What does it mean when we sat that hash functions need to be collision resistant?
    It means that no 2 inputs will result in the same output. For a hash function to be useful one input needs to result to one unique output. A collision implies that there are more than one inputs resulting in the same output and that defeats the purpose of the cryptographic hash function.

1 Like
  1. Describe hash functions with your own words

A hash function takes data of arbitrary size as input and applies a hashing algorithm to generate an output of fixed length, the hash value. The hash function maps a unique input to a unique output, meaning that for each unique input, the hash function generates a unique hash value. The hash value cannot be reversed to recover the original data because the hash function is a one-way function.

  1. How are hash functions used in cryptocurrencies like bitcoin?

In Bitcoin, hash functions are used for multiple purposes. A given block in the blockchain refers to the hash value of the previous block, which ensures data integrity throughout the whole chain of blocks. Hash functions are also used to verify whether or not a transaction belongs in a specific block (this is where the Merkle Tree becomes relevant). Furthermore, hash functions also play a vital role in the mining process. In order to mine a new block, a miner must obtain a hash value that satisfies specific conditions. To achieve this, the miner must put in effort and run many calculations. In this case, hashing is used to verify the miner’s proof of work.

  1. What do we mean when we say that hash functions need to be collision resistant?

In the context of hash functions, a collision refers to the situation when two or more different inputs are mapped to the same hash value, i.e. the hash values collide. This is a problem because hash values are commonly used for data integrity checks, thus if the hash function has a low collision resistance, someone could theoretically try to generate a malicious data file that has the same hash value as the original file and replace the genuine with the malicious file.

1 Like

1.- a Hash Functions maps arbitrary strings of data to a fixed length output in a determined public random string call hash or digest.

2.- The Hash Funtion is used to create an always unique hash that identify a block and all its content, and to register the position of the block on the chain a second hash is added to every block, this hash is the one from the previous block.

3.- Collision Resistance an important characteristic of a Hash Functions it means the difficulty to find a colliding pair of two imputs should never have the same output.

1 Like

Hashing is a one way function, it cannot be decrypted back. However it can be cracked by simply brute force or comparing hashes of known strings to the hash.

1.hash functions are an algorisms and universal translators
hash function is a unique imput that give a unique output to the function in a hash function we can go to imput to out put but its not impossible to go output into input

2.In the bitcoin protocol, hash functions are part of the bloack hashing algorism which is used to write new transactions into the blockchain through the mining process.
In bitcoin mining, the inputs for the function are all of the most recent, not-yet-confirmed transactions (along with some additional inputs relating to the timestamp and a reference to the previous block).

  1. Collision resistance is the property of a hash function that it is computationally infeasible to find two colliding inputs.In cryptography collision resistance is a property of cryptographic hash functions: a hash function H is collision-resistant if it is hard to find two inputs that hash to the same output; that is, two inputs a and b where ab but H ( a ) = H ( b ) The pigionhes principle means that any hash function with more inputs than outputs will necessarily have such collisions.
2 Likes

Sorry to be a pain, but does anyone have “code-snippets” for the Hash Algorithms used in either Bitcoin or Ether Blockchains?

Again you can have a look at the Bitcoin code. SHA256 is in the crypto folder.

https://github.com/bitcoin/bitcoin/tree/master/src/crypto

Thank you very much Alko89, that git repository is going to be helpful.

DESCRIBE HASH FUNCTIONS WITH YOUR OWN WORDS
Hash functions enable input data to be scrambled and to become indecipherable, when the input is scrambled via the hash function it is assigned a numeric value of uniform length. No matter how large the input data, the hash function always assigns the data an alphanumeric value that is always the same length.
HOW ARE HASH FUNCTIONS USED IN CRYPTOCURRENCIES LIKE BITCOIN?
Bitcoin uses hash functions to write new transactions into the blockchain through the mining process along with some inputs such as a timestamp and references to the previous block. Hash functions are also crucial to the ‘proof of work’ algorithm involved in mining bitcoin where miners play around with arbitrary characters in order to ensure a hash starts with a certain number of zeros.
WHAT DOES IT MEAN WHEN A HASH FUNCTION NEEDS TO BE COLLISION RESISTANT?
It means that every input string of data must generate a unique output string. No two hash values are identical so as to prevent ‘collisions’.

2 Likes