Homework on Hash Functions - Questions

The input is not a hash.
You can hash any type of digital data. When you perform a hash function on this data, you will get a fixed length hash as an output.
You can try this out on:
https://passwordsgenerator.net/sha256-hash-generator/

When you change 1 character, you will see that the hash will be completely different.

So when a miner adds transactions into a block + all required other data, they need to hash it to have a fingerprint of that block. hashing this data gives you like a random hash value wich everyone can do. To make it more difficult, the network has always a target that in order a blockhash is valid, it needs to be lower than that target (wich changes over time, depending on how many miners are trying) so only a block with a certain amount of leading zeros will be valid to be accepted by the network and get the blockreward + transaction fee’s. In order to find a blockhash with some leading zeros, they need to add some extra random number into the block, hash it again and check if the hash is low enough (starting with a bunch of zero’s) when this isn’t the case, the miner needs to change the random number (nonce) and check again. Until they find a number (nonce) that will produce a block hash lower than target.

Check out:
https://andersbrownworth.com/blockchain/blockchain

But you will learn more about it later in this course

1 Like
  1. Hash functions are one-way functions, so it’s very easy to compute them and generate an output, but the reverse is infeasible, given the output to find the original input.

  2. In the crypto space, hash functions are used to encrypt the transactions data of the blocks and then are linked to the next blocks through pointers, so if someone tries to change the hash from a block, all the previous blocks will have a different hash and the transactions will not be validated. They also save time to validate transactions since it’s easy to check the previous data inputs just by verifying is hash, and save space in the blocks since we don’t it’s not necessary to include all the data in those blocks, only the summary of the data, the hash.

  3. It means that given two inputs, A and B, it is infeasible that their outputs, H(A) and H(B), are the same since for the most part, each input has a unique output.

1 Like

] A hash function converts an input string into a unique alpha/numeric string (generally 256 bits) which is infeasible to reverse engineer mathematically to derive the input value.

2] Bitcoin uses a hashing function in the Proof of Work mining component of the blockchain system.
Miners use data from a block header and apply hash functions to input transactions as part of the verification process

3] Collision resistance is a property of Hash Functions whereby two different inputs will almost never produce the same output.

1 Like
  1. Describe hash functions with your own words
  • Taking data as an input to create a digital fingerprint output (of that data).
  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).
  • Hash functions are used by Bitcoin as the main backbone on the blockchain to function. Hashing allows private and public keys to work. The bitcoin on the blockchain is owned by the holder of a private key. A public key to receive bitcoin is a hash of the wallet private key for example.
    Hashed data is used to string the blockchain together.
  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).
  • A collision would be 2 (or more) different inputs leading to the same output. To be collision resistant is to deny this possibility.
  1. Hash fonctions are made to perform a simple calculation on a specific ā€˜string’ of data that result in a unique defined combination of digits.

  2. There are several benefits in using secure cryptographic hash fonctions correspondent to important constraints that the fonction should provide in the cryptocurrencies networks. Enabling one way encryption, use in the Merkel tree concatenation to provide the PoW mechanisms, wallet addresses, etc

  3. Collision resistant means for a hash fonction that several different strings Inputs would be very unlikely probable of actually having the same output.

1 Like

I think you tackle the subject but not only min-entropy field string factor concatenation are preferred but highest min-entropy fields especially.

  1. A hash function is a mathematical process that takes input data of any size, performs an operation on it, and returns output data of a fixed size.
  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.
  3. 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 such that H(a) = H(b), and a ≠ b. Every hash function with more inputs than outputs will necessarily have collisions.
1 Like
  1. A hash function is a formula/equation used to encrypt data. data is input into this formula/equation. It is then computed and given a series of variables/letters/numbers (it is hashed). The equation always comes up with the same results for any specific input. Any minor change in the input makes drastic changes to the output. It is consistent. Hashing cannot be reverse engineered. No matter how long the input, the output is always the same length (64 characters).
  2. Hash functions are used in cryptocurrencies to secure transactions. The hash functions encrypt information so the information transfer is only able to be accessed by those intended to be privy to it. Hashing protects the immutability of all the blocks in the bitcoin block chain.
  3. When we say that hash functions need to be collision resistant it means that it has to be virtually impossible for two separate inputs to come up with the same hash. H(a) = H(b), and a ≠ b.
1 Like
  1. Any unique input has a unique output as a hash function, which is a combination of digits of a certain bit length (depending on the function). However it is impossible to go from the hash to the original input.

  2. With bitcoin, Hash functions are used to write new transactions into the blockchain using mining. Miners are competing to solve the hash functions until the new transactions are valid. (I’m really not sure)

  3. When we say that hash function need to be collision resistant, it means that it is very hard to find the same output for two different input

1 Like

Answers

  1. Hash functions take a value in input and return a fixed length output. There are a lot of different hash functions, depending on the algorithm that generates the output. In general, hash functions are useful because you can easy calculate an output starting on a certain input, but the reverse it’s infeasible.

  2. Function SHA-256 in Bitcoin is used for mining and to ensure integrity of the single transactions inside the block. First of all is taken the hash of the content of the new block, then a random string (nonce) is appended to the hash and the new string is hashed again. The final hash is compared to the difficulty : if not the nonce is changed and the process repeats again, if yes the now block is added to the public chain and miners responsible for this are rewarded with bitcoins.

  3. Hash functions need to be collision resistant because we don’t want to find 2 different inputs that produce the same output. SHA-256 is safe to assume that F(a) = F(b) then a = b

1 Like
  1. A hash function gives you a very specific output that is unique to it’s input.

  2. Miners use hash functions to find new blocks. They use unconfirmed transactions, time stamps and previous transactions as inputs along with their own data do generate a hash with a couple of zeros in the beginning (atm 17 I guess). This is the difficulty, the fewer zeros there are, the more difficult it is to find the hash -> more computational power is needed. This difficulty gets adjusted every two weeks.

  3. It is almost impossible to find two identical hashes with different inputs. This is very important for cryptographic hash functions.

1 Like
  1. Each input provides a unique output (digital fingerprint) and is only a one-way function.
  2. Used in cryptocurrencies to encrypt transaction data so it’s secure, fast and unique.
  3. Each and every input provides a unique output with the probability of two different inputs having the same unique output is infeasible.
1 Like
  1. Hash functions give a digital fingerprint of a unique input.
  2. In Bitcoin the hash functions are used to generate verifiably random numbers in a way that requires a predictable amount of CPU effort. Generating a SHA-256 hash with a value less than the current target solves a block and wins you some coins.
  3. A hash function is collision resistant if it is hard to find two inputs that hash to the same output.
1 Like

1 Has functions are complex mathematical functions that are one way

2 Hash functions are used in BTC to enable a wallet address to be non hackable. I think this is due to the one way nature of hash functions.

  1. Collision resistance in reguard to Hash functions means that 2 different inputs will never result in the same output.
  1. Hash function give a unique output to every input, the result of that same input is always the same.
    however, the smallest change in input will give a totaly different output making it impossible to deduce the input with the output. all you can do is guess

  2. hashes are used to verify new transactions. to solve a hash so much computer power is needed that no single computer can do so ( exept quantum maybe )
    all the mining computers use their computer power to solve the hash which verifies the transaction and rewards the miners.

  3. no different inputs should have the same output. a collision occurs once different inputs have the same output. obviously this musn’t happen. thus hash functions must be collision resistance.

1 Like
  1. It makes any input a unique output and cannot go from output to input.
  2. Hash functions are used to make unique bitcoin wallets and encrypt transactions.
  3. It means that all the possible outputs will be unique and one of a kind and not a single one of them inverferes with other output codes.
  1. one way function. Not possible to go from output to imput
  2. as a unique finger print to connect blocks
  3. if H(A)=H(B) that means that A=B probably
1 Like
  1. Hash functions are a method of securing information using the hash function equation SHA256 to create a long number combining 16 digits and letters. This long number is nearly impossible to work backwards to find the original information.
  2. In Bitcoin a transaction is made and the hash function is used to generate the long hash number, this numbers is then verified by the miners who use the computing power of their mining rigs to carry out the hash function and verify the transaction. This hash function contains information from a previous block in the blockchain. If enough miners verify the transaction then it is stored in a new block chain attached to the previous blockchain and the transaction is secure.
  3. Collision resistant means that if two hash inputs are the same it is rare but not impossible that they will have the same hash output. With SHA256 colission resistance means that although colissions are possible they are much harder to locate due to the great length of the hash number and the greater difficulty in brute force to locate it.
1 Like
  1. Hash functions are one way functions.
  2. In BTC a hash function is used to transition transaction data (nonce, transactions in a block, previous block hash) to a 256bits hash that matches the current pattern (based on difficulty).
  3. Collision resistent functions are basically functions that ensure under certain amount of data the output will always be unique.
1 Like