Homework on Hash Functions - Questions

Homework on Hash Functions - Questions

  1. Describe hash functions with your own words
    It’s an algorithm that maps data of arbitrary size to a fixed-size values.
    Each hash value has to be unique and should be impossible to produce the same hash value from different inputs.

  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).
    Hash functions in crypto is used through mining. We’re miners are hashing all the validly signed transaction data that they accumulated by listening to the peer-to-peer network. They are also hashing a reference to the previous block in the chain as well. And lastly miners hash the random third input value, the lottery ticket if you will call it that.

  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).
    It should be really hard to find any random inputs that hash to the same output.

2 Likes
  1. A computation that converts text of various lengths into a string of fixed length that represents the inputted data in a way that cannot be reverse engineered (or is extremely unlikely to be)

  2. 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. 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). And the resulting hash has to match a specific pattern to be accepted as the next block in the chain - this is controlled by the difficulty level.

  3. It means the resulting hash for one unique input of data should not match any other hash for a different set of input data

2 Likes
  1. Hash Functions are used to generate a secure message intended for a specific user. It will generate e a value from a mathematical function. They are a one way encryption without a key. It takes an input value and randomly generates many possible outputs.

  2. Hash functions are used in Bitcoin in the mining of the coins. The main purpose is for the computer to guess a value that is less than the target value. Once this is done, the bitcoin is given to that miner.

  3. Hash functions need to be collision free, meaning that no two inputs should generate the same output.

1 Like
  1. hash functions take the input. then transform it into unique string and give that string as an output

  2. the data going through the blockchain is converted into hash and the new hash is linked to the previous block in a way that altering it will result in changing the whole chain, so the previous block are prptecting future hashes from changing.

  3. Collision resistance means that the hash function must avoid providing same output for 2 different inputs. probability for this must be extremely low for the hash function in order for it to viable and working

1 Like
  1. The hash function is a computer function that changes an input into a set of individual letters and numbers. that cannot be decrypted back to the original input.
  2. a.Hash functions are used in the mining process and b. in wallet trance actions.

a.( 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)

b.(Transaction hash (txid) is an identifier used to uniquely identify a particular transaction. All on-chain transactions (the transactions from or to external addresses) have a unique txid that can be seen in transaction details.)

  1. Hash function needs to be collision resistant because two different inputs cannot make the same hash output. This is where the collision happens.

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 [pigeonhole principle] means that any hash function with more inputs than outputs will necessarily have such collisions the harder they are to find, the more cryptographically secure the hash function is.

1 Like

Hash functions are not random. Each time you hash the same input, it will always produce the same output by using a complex mathematical algorithm.
it’s impossible to calculate the input from the output (besides brute forcing it, keep guessing the input and check if it match the output)

1 Like

Yes I understand this obviously didn’t deliver that as it was in my head but thank you & noted :grin: . I just read my response again .

I actually took out the section I had written regarding the elliptical curve cryptography that’s why it doesn’t make sense in the paragraph now, but I do understand the hashes can be applied to the create signature / memo / checksum or a transaction ID. My bad I should have rechecked.

My expression was wrong, I ment 2 different inputs will never produce the same hash value!

1 Like

1.- Hash function only travels in one way so it cannot change the digital finger print that produces the input or result in the output.

2.- Hash functions in BTC;
A) Creates BTC (mining process)
B) Generates BTC addresses, high security level

3.- Collision resistant.- Insignificant probability to find the input that result in the output.

1 Like
  1. hash functions are generating unique outputs for every input, if you change a single bit of input it completely changes output.

  2. collision resistance means that you cant get the same output for 2 different inputs, outputs should be unique.

1 Like

Its true that public keys are hashed to get the address it is not for the reason of security but mainly to save on storage (65 bytes for private keys and 20 bytes for hashed address). Historically public keys were used as addresses but was later changed. :slight_smile:

The probability of finding two different inputs that would result in the same output. :wink:

1 Like

Why did you left the second answer empty?

1 Like

1. Describe hash functions with your own words

  • A hash function is a function in where there is no way to deduct the input from the given output.
  • The input can be as long or short as you want, the output will always be of a fixed length of bits.
  • A small change in the input will completely change the result of the output
  • It has to be a quick computation to make it as efficient as possible

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

With cryptocurrencies like Bitcoin hash functions are used in the blockchain hashing algorithm in order to add new transactions to a block.

Hash function is also used in key generation.
This is why there’s no way someone can guess your’e private key from your’e public key.

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

No hash function is perfect, a collision would mean for 2 different inputs to generate the same output. But the chances of it happening are very small, due to the enormous amount of possible results.

The human API sucks and is limited by our spoken language :grin:

2 Likes

Hash Functions - Each unique input will produce a unique output (digital fingerprint)
you can go from input to output but it can not go the other way around output to input.

A good example of one hash function such as bitcoin uses hash function SHA256
reasoning being it provides good security when writing cryptography.
The unique key or fingerprint given by the hash function is only changed to a different hash when data is changed, Great way to do data integrity checks.

collision resistant property of cryptographic hash functions its hard to find two inputs that hash to the same output

1 Like
  1. Hash functions are a complex equation where a input results in an certain string character output but it is impossible to get to the input of the information knowing the output result. This results in a highly secure transaction.

  2. They are used in bitcoin to post a comprehensible and unique idea of each transactions on the ledger as a result creating an secure transaction that cannot be altered on the ledger.

  3. Each resulting output of the hash function must never collide with another, they must be unique to ensure no mixups can ever occur on the chain and all the data remains clean and unchangeable.

1 Like

Morning, thanks for the review I have a more clear vision now :raised_hands:t2::slight_smile:

Homework on Hash Functions - Questions

  1. Describe hash functions with your own words:
  • Hash function gives a fixed encrypted output for each input put in and it infeasible to reverse.
  1. 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 functions are used by miners for solving the hash for a bitcoin block and processing transactions.
  1. 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 making it as unlikely as possible for 2 different input to give the same output.
1 Like
  1. Describe hash functions with your own words.
    Hash functions are functions which takes a string of arbitrary length and returns a string of a certain length. They give the same result for any given input. And they give only one result for any given input.
  2. How are hash functions used in cryptocurrencies like bitcoin?
    They’re used in a lot of ways like mining new blocks and verifying transactions.
  3. What does it mean when we say that hash functions need to be collision resistant?
    It means that it’s almost impossible for two different inputs to give the same output.
1 Like