Homework on Hash Functions - Questions

  1. Describe hash functions with your own words

A mathematical computation that converts an arbitrary length data input into a numerical output hash value of a fixed length.

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

Hash functions are part of the blockchain protocol and incorporate the transaction data and previous block header into the new block through the mining process to help ensure the security of the blockchain.

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

It is difficult to find two different data inputs that produce the exact same output hash value.

1 Like
  1. Describe hash functions with your own words
    A hash function is a mathematical function that converts a numerical input value into another compressed numerical value. The input to the hash function is of arbitrary length but output is always of fixed length.

  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).
    Bitcoin mining uses cryptography, with a hash function called double SHA-256. … Then you hash the block to form a 256-bit block hash value. If the hash starts with enough zeros[3], the block has been successfully mined and is sent into the Bitcoin network and the hash becomes the identifier for the block.

  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).
    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 a ≠ b but H(a) = H(b). … Those functions are called provably secure.

1 Like

Thanks. I apreciate your comments

Homework on Hash Functions - Answers

  1. Hash functions are one-way functions that are mathematical calculations that produce a unique output for every unique input and this calculated output is irreversible, hence can not be used to determine the input. They are used primarily to map data of an arbitrary length to data of a fixed length.

  2. https://en.m.wikipedia.org/wiki/Hash_function
    https://en.m.wikipedia.org/wiki/Cryptographic_hash_function
    https://en.m.wikipedia.org/wiki/Secure_Hash_Algorithms

    https://en.bitcoinwiki.org/wiki/Hash

    Hash function Review

    Hash functions are primarily used to generate fixed-length output data that acts as a shortened reference to the original data. This is useful when the original data is too cumbersome to use in its entirety.

    One practical use is a data structure called a hash table where the data is stored associatively. Searching linearly for a person’s name in a list becomes cumbersome as the length of the list increases, but the hashed value can be used to store a reference to the original data and retrieve constant time (barring collisions). Another use is in cryptography, the science of encoding and safeguarding data. It is easy to generate hash values from input data and easy to verify that the data matches the hash, but hard to ā€˜fake’ a hash value to hide malicious data. This is the principle behind the PGP algorithm for data validation.

To be considered effective a hash function has to have the following properties:

• Computational efficiency - it shouldn’t take a long time to compute a hash from a given input.
• Collision resistance - it should be hard to find distinct inputs that would result in the same hash after the application of the hash function.
• Ability to hide information - it should be hard to derive anything useful about the input from the hash whether it be the whole input data or as simple info about it as to whether it is an odd or an even number.
• Random-looking hash - the hash should look like it was a result of several random events, like flipping a coin. There shouldn’t be an apparent particular transformation protocol.

Bitcoin Hash function

Bitcoin uses the SHA-256 hash algorithm to generate verifiably ā€œrandomā€ numbers in a way that requires a predictable amount of CPU effort. Generating an SHA-256 hash with a value less than the current target solves a block and wins you some coins.

https://en.bitcoin.it/wiki/Block_hashing_algorithm

Many people fear that quantum computers will eventually break these hash functions. Bitcoin uses SHA256 for the data encryption on the chain and EDCSA for the digital signature. Quantum computing will likely break the digital signature before ever being able to challenge the strength of SHA256 as the latter is magnitudes of orders more difficult to break because of Double Hashing. This weakness in future security vulnerabilities means that the best practice is to only use a digital address once.

Transactions always contain the SHA256 of the transaction and the digital signature of the user. If this digital signature is connected to an address that was only used once to move assets out, then it would be safe when quantum computing reaches this capacity as no assets would be prone to exposure.

  1. A hash function is considered collision-resistant if 2 different random inputs (e.g. x and y) can produce the same hash result (i.e. H(x) = H(y)) even though they are completely different (i.e. x is not equal to y ). This is easily accomplished when the length of the hash function output is the same length or shorter than the un-hashed inputs. However, logically inputs longer than the hashed outputs necessarily will have these collisions. This is what is known as the pigeonhole principle. In situations where the hash function have proof that they are at least as difficult to brute force (through calculating) as extremely hard mathematical problems e.g. integer factorization, these cryptographic hash functions are considered provably secure, hence collision-resistant.
2 Likes
  1. Describe hash functions with your own words
    a. A way to convert binary information into a code that can is individual to the input. For our purposes it allows us to easily view if the original input has been altered.

  2. How are hash functions used in cryptocurrencies like bitcoin?
    b. Hash functions are used to verify transactions and create new blocks of information. Basically, hashing is vital to bitcoin mining, as it allows the proof of work algorithm to function.

  3. What does it mean when we say that hash functions need to be collision resistant?
    c. So that two different inputs do not have the same output.

1 Like
  1. Describe hash functions with your own words
    A - Hash functions are one way functions, they produce one unique input which in turn, it produces one unique output.

  2. How are hash functions used in cryptocurrencies like bitcoin?
    A - Hash functions keep BTC secure, these are used to encrypt transaction data through SHA 256, and data input hash can not be altered, erased as on chain confirmations takes place, so the work required to secure the block can not be copied, erased, reversed.
    ā€˜ā€™ This data is kept secure by adding more data that has been hashed on top of it in a connected block. In order to compromise the data in the first block, you would need to first compromise the second, appended block. The difficulty to do this makes it highly infeasible after six or more blocks have been confirmed.’’

  3. What does it mean when we say that hash functions need to be collision resistant?
    A - İt means given 2 different inputs should not equal the same hash output, we need hash functions to be collision resistant, they are not always, it is so infinitesimally small that they are negligible in real-world use cases. This is why there is a much higher likelihood that two inputs with the same hash output are equal than it being a case of collision resistance.

2 Likes
  1. Hash functions are mathematically algorithms that gets solved when we insert a input to the function, when the algorithm is solved this creates a output that is a digital fingerprint for the input that was used.

  2. The bitcoin miners are the ones using rig systems with alot of hardware (gpus) that has alot of computational power to solve these hash functions.
    Hash functions in bitcoin is solved by using SHA-256 algorithm, which uses a one-way function. Which means that you cant find out what the input is by knowing the output.

The pros with using SHA-256 is:
Unique hash value: for every input, it creates a unique output
Fast hashing speed: When a input is given the mathematical calculation happens fast
One-way function: It is almost impossible to reverse the function and make it two-way

  1. Collision resistent means that two hash functions (or inputs) dont give the same output.
2 Likes
  1. Describe hash functions with your own words
    Hash function creates a unique output from an input, but it is very difficult to work back on an input from an output.
  2. How are hash functions used in cryptocurrencies like bitcoin?
    The transactions in a block and the hash output from the previous block are together being hashed, which will then be used as input for the next block.
  3. What does it mean when we say that hash functions need to be collision resistant?
    A hash output needs to correspond to a single input. It cannot have more than one input leading to a same hash output.
1 Like

1. Describe hash functions with your own words
|-|Each unique input gives a unique output |
|-|You can go from Input to output but never from output to input|
|-|All digital information is binary numbers (letters or numbers) which converted into bits 1’s and 0’s and then encrypted with the sha-256|
|-|The slightest modification in the original input will generate a new output (even an extra space, dot, etc.) a single bit in the binary representation of the input will produce a new output|

2. How are hash functions used in cryptocurrencies like bitcoin?
|-|In the bitcoin protocol, hash functions are part of the block hashing algorithm which is used to write new transactions into the blockchain through the mining process.|
|-|In the context of cryptocurrencies like bitcoin, the transactions are taken as input and run through a hashing algorithm which gives an output of a fixed length in this case 256bits.|
|-|Once a Hash has been added to the chain, all other hashes that follow will use the previous hash along with the new digital information as input in order to create a new output (hash), and this string continues on and on, making the chain depended on the previous information.|

3. What does it mean when we say that hash functions need to be collision resistant?
|-|Message1 and Message2 will never have the same output.
|-|Collisions exist but it takes an astronomical period of time to find one, the procedure takes 2(at the power of 130) steps in order to get to a relatively high-probability. Even if all computers ever build by humanity would compute toughener to find this collision it would take an infinite amount of time… more likely we would get hit by and asteroid in the next few mins…|

2 Likes
  1. Hash function take a unique input and provide a unique output or a digital fingerprint.
  2. Can be used to create passwords. If system is hacked, the hacker will not be able to determine which hash is associated with a specific password. It writes new transactions. It takes a tremendous amount of hash power to solve a block. Must begin with 18 zeroes
  3. Collision resistant means it is difficult to find two inputs that result in the same output. The more difficult it is to find two, the more secure the hash function is.
1 Like

Rob here on Hash Functions:

1.) In my own words, Hash Functions are functions that can only be solved in a linear/unidirectional way. The output/hexadecimal digital fingerprint that is created cannot be reversed to calculate the initial raw data or input. It’s a one-way mechanism that only allows input to output translation, never output to input.

2.) Hash functions are used in cryptocurrencies like bitcoin largely for data integrity and crucial to the ā€˜proof of work’ algorithm involved in mining.

3.) A Hash Function is collision-resistant if it is hard to find two inputs that hash to the same output

1 Like
  1. Hash functions convert input into random encrypted alphanumerical outputs.

  2. In cryptocurrency hash functions are used for proof of work transactions.

  3. Hash functions need to be collision resistant means that each output should be different and unique.

1 Like

I really like this quote:

Quantum Mathematical Algorithms is the only tool you can use to hack Hash Algorithms.

I agree with you 100%.

ā€œHash Algorithms Mathematicsā€.

1.A string of data(letter,number,media) of any length,the input, that goes through a mathematical equation(hashing algorithm) to encrypt the data to deliver a unique output of fixed length.

2.In crypto currency protocols hash functions are part of the block hashing algorithm that writes new transactions in the blockchain through the mining/staking process.

3.A hash function is collision resistant if it is very hard,close to impossible,to have the same output with different inputs.

2 Likes
  • Describe hash functions with your own words

The hash function encrypts any digital information using the SHA-256 function and outputs an encrypted string that is irreversible.

  • 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).

Hashing is used to write new transactions into the blockchain through the mining process (Bitcoin)

  • 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 would mean that getting two same outputs from the hashing algorithm are extremely hard to find.

2 Likes
  1. Hash functions are unidirectional functions which produce a unique output for any input.

  2. In the bitcoin protocol, hash functions are 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). to successfully solve a new block and add it to the blockchain, miners try to combine all of the inputs with their own arbitrary piece of input data in such a way that the resulting hash starts with a certain number of zeroes. This is the basis for the proof of work model.

  1. Collision resistant means that the probability of two different inputs transforming to same output is not possible.
2 Likes

1.Hash functions are something which are different from normal function as each unique input gives unique output and it is not possible to go from output to input.
2.hash functions are part of block hash algorithm which is used to write new transactions into the blockchain through the mining process.
3.a hash function is colllision resistant if it is hard to find 2 inputs that hash to the same output

2 Likes
  1. A hash function is a function that produces a unique output from a given input. This function is invertible, which means it does not have an inverse function, so it is impossible (until this date) to determine the input for a given output.

  2. The hash function in blockchain takes as input the data that was in the
    previous block. The hash is a fingerprint of this data and locks
    blocks in order and time.

  3. Collision resistance is a property of cryptographic hash functions. A hash function is collision-resistant if it is hard to find two inputs that hash to the same output.

2 Likes