Homework on Hash Functions - Questions

Hi there!! I hope @Mauro can answer, but leave my input as well here so you can get a response.

As you mention with the hash, yes you count 64 numbers and letters (alphanumeric). But, if you check closely, we have numbers from 0-9 and letters from A-F, this is a hexadecimal format.

As mauro mentions, SHA-256 produces 256 bits. In binary, 255 is represented as 11111111. The same value 255 in hexadecimal is FF. This is why mauro says that 1 byte = 8 bytes. So, for each pair of letters or numbers in the hash, we have 8 bits, and 32 * 8 = 256 (32 bytes).

Check this website and play with numbers, or even paste a hash and see the binary format it generates: https://www.rapidtables.com/convert/number/decimal-to-binary.html

Hope this makes sense!!

Felipe.

2 Likes

Hi there. Yes, but what can you tell us about the relationship between input and output?

Yes, so collision resistant means that this should not happen, as this will break the protocol. SHA-256 is pretty safe in this aspect.

It is deterministic, which means that you can only go from input to output but not vice versa.

1 Like
  1. When applied to any text input, a hash function is a mathematical function that generates an output value which is matched to the orignal input.

  2. When used in cryptocurrencies, it is a secure way to insure against tampering against the information that is used and stored on the blockchain.

  3. When two different inputs result in the same output after being hashed, it’s a collision. Using the SHA-256 algorithm for hashing on the blockchain, it’s possible for a collision to occur, but it’s infeasible that it will actually happen because the odds of a collision using the complex hash function are so small that it would take a very long time for it to happen.

1 Like
  1. Hash Functions are a computational method of specifying a unique input and generating an individually unique output that, depending on the hash method used (i.e. SHA256), results in a string of numbers and letters in a unique combination. The output or hash for the input is always the same and any even small changes to the input will generate a different unique output (Deterministic). This output is secure for a number of important features: Deterministic, Quick Computation time, Pre-Image Resistant, Collision Resistant, and Puzzle Friendly.

  2. The Bitcoin Blockchain is a permanent sequential record of each transaction that has been verified which is stored on all nodes of the blockchain and open to inspection. Since the output or past transactions can not be changed or tampered with, these can be utilized in the hashing to compare with those related to the current transaction to verify all of the previous information and adjust it accordingly to reflect the latest contents of that entry which then goes on the blockchain.

  3. Collision Resistance means that due to the very large number of items in the sequence of possibilities, it is infeasible for 2 given inputs A & B with outputs H(A) and H(B) for those outputs to be the same since in the hashing with a 128 bit hash there would be 2^128 different possibilities.

1 Like

1.) Hash function is a one way of hashing input data to a digital fingerprint with no turning back.
2.) Hash function is used to hash the transaction data in bitcoin.

  1. A hash function is an algorithm used to take an input and give a unique output. It is not possible to use the output to find the input.

  2. hash functions are used in bitcoin to keep track of transaction, while still keeping privacy. It does this by turning input data into an output data which is always a fixed length. It is not possible to determine the input by having the output.

  3. A collision in the hash function is when the two different inputs give the same output. the output of every hash function is unique. no matter how small the difference is in the input there is a significant change in the output. This means it is “almost impossible” for two different inputs to have the same output. We say “almost impossible” because mathematically it is possible it is just so unlikely to happen that it is ok to assume it will not.

1 Like

Hi @PeterAngeloFischer you forgot to answer the third question :slight_smile:

1 Like
  1. Describe hash functions with your own words

In Hash Functions, each unique input produces one unique output. Each unique input entered provides a unique output. In an “un-cracked” Hash Function, you can go from the input to the output, but provided the output, you cannot decipher the input. Hash functions are strictly one-way functions.

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

“Cryptographic” hash functions are to be distinguished from hash functions in that they make it much more difficult to decipher the contents of a message. The hash function used by Bitcoin is SHA-256. The miners must use brute force to continuously generate random characters and numbers to eventually crack the hash algorithm. When this is achieved, bitcoins are rewarded by the blockchain. The time, computer power, and electrical energy expended is what drives the price that miners expect to receive from the bitcoins they mine.

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

Collision resistance aims at making it more unlikely that two different inputs will result in the exact same output. This potential occurrence is explained by the “birthday paradox.” The birthday paradox states that in a group of x people, there is a probability that two or more people will have the same birthday. This is analogous to two totally different phrases generating the same hash value. If this is prevalent, then the hash is not as secure as expected, and can be cracked more easily than previously imagined. I think that the way of helping to amend this potential weakness is via the property of “Puzzle Friendly”ness.

I f collision resistance is not achieved, then the hash function (in this instance SHA-256) would be considered no longer effective. It would be rendered ineffective because it can be cracked by methods other than brute force, leading it to be cracked faster.

1 Like

The more hash rate on the block makes the system more secure and it will hard to hack.

  1. Hash functions convert data inputs into a fixed value output. If the same input is type several times, the hash result will be always the same, like a fingerprint. This behavior is expect from a deterministic function.

  2. Cryptocurrencies like bitcoin rely on hash functions, that guarantees the security of the transactions and the participants, independence of operations from a central authority; verification of the transfer of digital assets and tokens, etc. Basically, as SHA-256, they are mathematical operations run on digital data.

  3. Collision resistant means that for any different input, there will be different outputs always.

1 Like
  1. Describe hash functions with your own words
    Hash functions have a random input (e.g. number, text, a file) and produce an output which is the digital fingerprint of that input. The exact same input will always have the same output as a result of the hash function, but you can never conclude on the input from the output. The output can have any length, but the output always has a fixed length.

  2. How are hash functions used in cryptocurrencies like bitcoin?
    A block of many transactions is hashed by miners, and the root hash added to the blockchain. The use of hash functions makes the chain of blocks full of transactions immutable. In the end, thanks to hashing, cryptocurrencies are safe with regards to potential retroactive manipulation.

  3. What does it mean when we say that hash functions need to be collision resistant?
    The hash function results should be unique, meaning that there should never be the same has for two different pieces of input.

1 Like

Hi Nida! Although this is correct, collision resistant is related to inputs and outputs in a hash function. Do you know which one?

1 Like
  1. Hash functions are one way functions that take in some bytes and output a unique hash. The same input will create the same hash.

  2. Hash functions are used to hash previous blocks to the newly created block verifying the history is unalterable.

  3. Collision resistance refers to the fact that the pool of hashes that can be created from sha256 is so large it’s not probable to generate a duplicate hash from two different inputs.

1 Like
  1. Collision resistance means that it is many different input and it will be different every outputs
1 Like

Hash Function Homework Questions:

  1. Given input data of any length the hash function produces an encrypted 256 bit digital output that cannot be reversed.
    2.Hash functions are used to encrypt bitcoin data to allow secure transactions.
    3.If a hash function is not collision proof an adversary can infiltrate and break the function.
1 Like

Brute force attack. Hash function with more inputs than outputs will have collision. With discrete logarithm is provably secure. But bitcoin Hash using SHA 256 all mathematically equals the input and output it is hard to brute force.

1 Like
  1. Hash functions are a way of giving a unique “fingerprint” or identity to data.
  2. Hash functions can be used in things like creating keys and addresses for transactions.
  3. They are collision resistant because it’s unlikely that 2 different inputs would create the same output.
1 Like

What do you mean by a scrambled puzzle that cannot be put together? What is special about a has function?

To find 2 different inputs, that will result in the same output/hash. :slight_smile: