Homework on Hash Functions - Questions

1.Hash is when each unique input gives out unique output and the output. If the input changes, the output changes as well.

  1. In cryptocurrencies the input is the transaction data (like with bitcoin). Transactions are bundeled together and all this info is then hashed to give out a unique signature for each block.

  2. Collision means that different inputs can give out a same hash. Collision resistance means this can’t occur, but in reality no hash function is completely collision resistant, it just takes millions of years for this to happen

1 Like
  1. hashfunctions is a way of securing information sent to an intended recipient by means of converting the data of this message into a huge number called the output which is unique to that excact piece of data.

  2. Hashfunctions are used in bitcoin: the transaction between wallets is converted into a hash as described above, and to find the transaction, the computers have to try and guess the huge number that the transaction data was converted into. The first few computers that guess the number correct then confirms the transaction?

  3. Collision resistance means: It must be very hard to find two inputs with the same outputs. If two different input data’s have the same resulting huge hash number

1 Like
  1. Hash function is a process that takes text string (alphanumeric value) of any length as an input and using certain hashing algorithm (for example SHA-256) it transfers it to different alphanumeric string of fixed length as an output.

  2. hash functions in cryptocurrencies are used mainly for mining (creating blocks of transactions)
    … all the blocks in the blockchain have to be hashed, also the hash input of the new block has to contain the hash of the previous block in the way they are pointed to each other and create an immutable chain - this is due to security, if hacker tried to change even the slightest detail in one block, it would resulted to completely different hashes not only in that block but also in all following ones hence the network would not allow such a change
    … also all the transactions within one block are hashed in certain sequence (Merkle tree) resulting in one final hash. That is not only space saving but also much more efficient in terms of transactions search then it would be if transactions would be added as a plain text one after another.

  3. hash function is collision resistant when it is almost impossible to get exactly the same hash for differen inputs (it is never completely impossible because sooner or later there comes time when hashing differen inputs results in identical hash … but for example within the SHA-256 algorithm the probability is 1:2^128)

1 Like
  1. Describe hash functions with your own words
    Hash functions take an input and apply an algorithm to produce a string of letters and numbers of fixed length. There are different types of hash functions which use different algorithms and produce outputs of different lengths. e.g. the Sha 256 hash function produces an output of 256 bits with 64 characters. Hash functions are one directional in that given an input, you can easily find the output, but given the output, it is extremely difficult to find the input.

  2. How are hash functions used in cryptocurrencies like bitcoin?
    All transactions within a block are hashed using the SHA-256 hash function and joined together in a merkle tree, the hash of the merkle root is placed in a block along with the hash of the previous block. In order to add a new block to the blockchain, miners must use brute force to continuously attempt different nonces (which are random strings) concatenated to the hash of their block. Once the hash of the concatenated nonce and hash of the block satisfies the difficultly level, the block will be added to the blockchain.

  3. What does it mean when we say that hash functions need to be collision resistant?
    Collision resistance means that given any two different inputs, the outputs should always be different. It is not impossible for this to be the case with hash functions but it is extremely unlikely. Since there are 2^256 possible outputs, the probability of two different inputs having the same hash is 50% with Sqrt(2^256) different inputs.
    The impact of a hash function not being collision resistant is that it would be possible to have two transactions with different contents producing the same hash.

1 Like

Homework on Hash Functions - Questions

1)Describe hash functions with your own words

A hash function takes any string of data and converts it to fixed length output.

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

Transactions are taken as an input and run through a hashing function which gives an output of a fixed length.

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

Source (article) from previous assignment: ‘Collision resistant means: given two different inputs A and B where H (A) and H (B) are their respective hashes, it is infeasible for H (A) to be equal to H (B).’

1 Like

Not sure if this is a stupid question, but can someone explain where hashing algorithms come from? Surely someone must have come up with the algorithms for them to exist?

  1. Describe hash functions with your own words

A hash function is the process of taking an input and passing it through a function such as SHA-256 to give it a unique output. Regardless of the size of the input the output will be consistent length of characters. In the case of SHA-256 that will be a 64 character output.

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

These hash functions are critical to to the blockchain functioning, cryptographic hash functioning to be exact. these hash functions contain the required properties to secure and enable a proper blockchain. The hashing is used in combination with data structure. Our previous homework reading taught us about linked lists and pointers. the basic blockchain structure is the linked list connected by a hash pointer. within those connected blocks is a bunch of data. That data has also been hashed. For efficiency the data is arranged in a series of nodes called The Merkel Tree.
Hashing is also required to solve the puzzle of the block in the mining process.
H(k | x)=Y
k is the nonce
x= hash of the block
Y= the difficulty target
So without going over board with stuff from the reading about mining a whole bunch of hashing is going on.

  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 resistance is one of the 6 required properties for a cryptographic hash function. The idea is that each input will generate a unique output for the most part. There can only be so many until a duplicate happens. no hash function is collision free but the odds must be extremely high. This is a factor that is taken into consideration when determining with block time.
1 Like
  1. A one-way conversion of any amount of data to a predetermined fixed number of bits.

  2. Hash functions are used in Bitcoin to write new transactions into the blockchain through mining process and is a cryptographic method used to verify the integrity of data of transaction. Also used for security and to encrypt the data on the ledger.

  3. Collision resistant means that the hash functions should not allow for different strings of data input to have identical output hash strings.

1 Like
  1. Describe hash functions with your own words

A hash function is an algorithm that can accept any data of string type and produce an output of fixed length (a hash). Its purpose is to create a unique digital fingerprint for any unit of data that cannot be reverse engineered to reproduce the data from the hash.

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

Cryptocurrencies make use of hash functions to create an immutable database capable of storing transactions in a tamper-proof format. Currencies that make use of a blockchain such as bitcoin divide the transaction data into ‘blocks’ that are each hashed before being added to the blockchain. Each block also contains the hash of the previous block - this creates the immutable property since the entire chain would have to be recomputed in order to change a single transaction. To control the flow of new blocks a difficulty mechanism is implemented by appending a random number to the block hash (known as a nonce) and hashing this new string once more. The block may only be accepted if this new hash fits a strict specification.

  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 hasing collision occurs when two data strings create the same hash after being run through the hasing algorithm. This breaks the ‘unique fingerprint’ property of the algorithm. However if collisions are sufficiently improbable they become very difficult to exploit. It may not be possible for an algorithm to be ‘collision proof’ but they can be highly collision resistant if it takes a vast amount of processor time to find such a matching hash.

1 Like
  1. Describe hash functions with your own words
    hash functions takes a unique input and gives a unique output

  2. How are hash functions used in cryptocurrencies like bitcoin?
    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.

  3. What does it mean when we say that hash functions need to be collision resistant?
    collision resistant 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.

1 Like
  1. Computing a Unique input that results in a unique output.

2 Hash functions are used in the hashing algorithm to write new transactions onto the blockchain.

3 Identical Hash cannot be output If the input put is different.

1 Like
  1. Describe hash functions with your own words
    -Hash functions are values generated from a string of text using a mathematical function. Each unique input gives a unique output, like a digital fingerprint, but you are not able to get the input from the output.

  2. How are hash functions used in cryptocurrencies like bitcoin?
    -Hash functions are used in cryptocurrencies as how new transactions are written into the blockchain.

  3. What does it mean when we say that hash functions need to be collision resistant?
    -When we say hash functions need to be collision-resistant, we mean that it should be extremely difficult to find two or more inputs that give the same output.

1 Like

Homework on Hash Functions - Questions

  1. Describe hash functions with your own words
    A hash function is a type of computation that maps or lays out inputs of any length, into hashes of a fixed size. The hashes outputted each have a unique digital fingerprint. Furthermore, it takes an inordinate time for someone to decipher the original input from the outputted hash.

The values produced through Hash functions can subsequently be organised in associated hash tables. This combination of hash function and hash table, is a way for organising and efficiently retrieving large stores of 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 particularly useful in cryptocurrencies such as bitcoin because;
a) they allow transactions to be unique and imutable
b) they can register every input and allow fast and efficient tracing or validating of transactions
c) hash functions ensure a full, accurate, unchangeable ledger

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

This means hash functions have to ensure that the same output hash is not given for two different inputs.

2 Likes
  1. Hash functions are functions, where you input any data and getting specific output
  2. Miners using their computational power to guess the output that begins with 0000000
  3. Means that we need to have hash with one specific input, that there is no other input with different info with the same hash
1 Like

1.Hash functions take any string of text and generate a numeric output of fixed length which is unique to the input.
2. Hash functions are used to hash the contents of a block and link it to the last block
3. each input will have its own unique hash. In collision resistance, it would be infeasible to have 2 different inputs have the same hash.

1 Like
  1. A hash function takes an input to generate a unique (in most cases) output. The same input will always result in the same hash output.

  2. The hash function is used to reference an address on the Bitcoin Blockchain. A hash is used instead of the actual Bitcoin location so that it will remain private and can only be accessed by someone who has the hash reference.

  3. A hash function collision resistance refers to it’s probability of generating a hash reference that is unique to the input and that input only. A very high collision resistance is critical for user confidence in the Bitcoin platform.

1 Like
  • A Hash function will produce a unique output for each unique input
  • A Hash function is unary directional, meaning we can determine the output based on the input, but we can never determine the input based on the output
  • A small change to the data inputted to the Hash function will result in a big change to the hashed output
  • The Hash function SHA256 output is represented in hexadecimal Base16 format, meaning the hash is a combination of numbers and letters from the the sequence 0-9 and letter set a-f, which is 16 in total, hence Base16
  • The hash function can be used in Bitcoin in the following way
  • H(k|x) = Y
  • k is the nonce, x is the hash and Y is the difficulty level
  • The nonce is an arbitrary string generated from of distribution in the order 1…10^24, which is a massive distribution
  • x is the hash of the block
  • The nonce k is concatenated with the hash of the block x, and the result is compared to the difficulty target Y
  • If the result is less than the difficulty target Y, then this block can be added to the blockchain, but usually it is very hard to achieve this result so the process has to be repeated many times to be successful
  • Hash functions need to be collision resistant
  • If we had for example two different inputs generating two identical hashes, we would have a hash collision
  • In reality this is infeasible, because due to the massive distribution that the hashes are generated from, the chances of a hash collision are virtually impossible

There are many types of hash functions. You can always invent one yourself.
Here is an overview of SHA (Secure Hashing Algorithm)

(Sha 2 was designed by the NSA)

2 Likes

Every transaction will end up in the mempool. Miners will pick transactions from the mempool and bundle them up into a block. Miners will hash this block. In order for the block to be accepted by the network and getting a reward for it, this blockhash needs to be lower than target. (depends on the current mining difficulty) so the hash will have to start with a bunch of leading zero’s. In order to get a hash starting with a bunch of zero’s, you need to add a random (small) number. Hash it again. And check if the hash is low enough. This is hard todo because hashes are always scrambled if you change something. So you keep changing that random number (nonce) and hash it and check again if the blockhash is low enough. When it is, The block gets appended to the blockchain. The miner gets the block subsidy + all transaction fee’s that were included in the block.

2 Likes
  1. They encrypt an input creating an output (digital fingerprint)
  2. Used by bytecoin also
  3. that means that two different inputs won’t give the same output.
1 Like