Homework on Hash Functions - Questions

  1. Describe hash functions with your own words

A hash function is a mathematical function that converts an input value into an output value. Creating a unique digital fingerprint.

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

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.

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

Difficult To Find Two Inputs That Produce The Same Output Difficult To Find An Input That Produces A Particular Desired Output No Two Inputs Have The Same Output Output Must Be Of Fixed Length

1 Like
  1. Hash functions are one way functions, where you can get an unique output, like a digital fingerprint, from an unique input. The exact same input will always produce the exact same output.
    It’s a cryptographic process and there is no way to get from your output back to the input.

  2. They are used in the mining process. Every mined block gets a unique hash, so it can be identified. The blocks also linked via their hashes.

  3. It means, it is really hard that a hash function creates the same output from two different inputs.

2 Likes
  1. A hash function is a programming function that is used to allocate data of size
    random to data of a fixed length.

2.In Bitcoin, the cryptographic standard SHA256 is used, which means that the output
has 256 bits, it may seem little but the number of possibilities we have at the
The output of this function is 2 256. As it is written it may seem that there are not many
possibilities, but if we translate that number into decimal notation what we get is
astronomical

  1. Resistant to collisions does not mean that collisions do not exist, it means that
    collisions do exist but are extremely difficult to find. I am going to try to
    prove it with an example.
    For the sake of the example, let us create the simplest hash function that can exist, the SHA1 function. Our function will have data as multiple input parameter and will
    have 1 bit as output (remember that a bit is the smallest unit of information
    on a computer and has a binary value is a 0 or a 1).
    If of all the possible entries I choose the alphabet {a, b, c, d, …} when entering the
    letter {a} to the hash function I will get the 0 of my only bit and when I enter the letter
    {b} I will get the value 1 of my bit. Now what is going to happen when you want to
    enter the letter {c}, the hash function will return either a 0 or a 1, thus performing the
    first collision, and since there is 1 collision there are infinite collisions. Then
    we conclude that the 1-bit function is insecure.
1 Like
  1. A hash function is a unique code that has two parts an input ans an output. The input is a asortment of letters both upper ams lower case, numbers and others characters like $!%. In a hash function the output is always generates the same answer of a specific input. But it is nearly impossible to generate what the input is by looking at the output. I must so note that the input a string of characters of an undefiend length it can be as simple as 3 letters or complex udbs9d57eodb3oete9db. The output however is always a fixed number of characters such as in sha 256 with the output set at 64 characters.

  2. Hash fucnctions are used in bitcoin by taking the time stamp, previous block, and unverified recent transactions amd adding a nonce for the input and mine or generate an output come starting with 0s to add to the blcokchain.

  3. A hash funcrion being collision resista means that the inputs cannot be the same. Although if the inputs are the same it will produce the same digest or output. Because the input has a much higher chance of not colliding compared to the more finite digest. It is not imopssible for the inputs to be the same rather it is unlikely to be the same.

1 Like

For example the messge or input for D1 and D2 have difderent outputs or digests. Collison resistance is not having D1 and D1 as the input.

1. Describe hash functions with your own words
** It’s special mathematical functions taking as an input digital bits and as an output, a single original fingerprint HEX / Base 64 bits code. This code is unique for every input and can’t be reversed to find the input. There are many hash functions but the one used with Bitcoin is called SHA-256 (Security Hash Algo 256 bits) :100:**

Get some more insights here.

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 the cryptography techniques. It uses a hash function called also SHA-256. This hash takes a load of data and input it, to get it in a compact small 256 bits value. This hash function is safe and there is no known technologies to get the input from the 256 bits vlaue.
Source here


The hashrate simple explanation

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 means that the cryptographic hash function chosen should be that it’s hard to find 2 inputs that the same hash function will process and get us the same output.
It will be impossible to get :

H : hashrate function
a,b two different text variables.

a ≠ b
H(a) = H(b)


Source here : blockchain hashing

Keep Grinding :metal:
Keep Coding :muscle:
@dapp.coding

Follow me
Twitter @CodingDapp
GitHub @dAppCoding

dapp coding

2 Likes

-1. Each unique input will give you a unique out. If there is any change in the input, it will give a different output.

-2. A hash function is special due to the properties and standards to be considered secured.

Properties:

  1. Deterministic
  2. Quick Computation
  3. Pre-image Resisitence
  4. A small change in the ā€œinputā€ will change the ā€œoutput.ā€
  5. Collision Resistent
  6. Puzzle Friendly

-3. You mean SHA 256. In SHA , it was broken due to having easing access to find a hash and match it. SHA 246 came around and reduced the possibility and increased security. Has not yet been broken.

1 Like
  1. It is a function that produces an unique output form each unique input. This unique input, can“t never be guess by the output since it is a one way function.

  2. Firstly, it is used in order to create the BTC addres (by using de SHA256 function).
    But it is also a key aspect in the blocks generation (it is used in the markle“s tree creation).
    By last, this function will be used again by the nodes, in order to verify that everyting is rigth.

  3. It means that it has to be impossible to get the same output by different inputs

1 Like

Homework on Hash Functions - Questions

  1. Describe hash functions with your own words
    Crypto Hash functions are function that translates any information into a fix string of text, improbable to reverse and avoids collision.
  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).
    Uses the hash function of SHA 258
  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).
    One outcome should be uniquely tied to one input, i.e. there should not be any outcome that can be derived from two or more input
1 Like

Collision resistance means it is improbable for two inputs to generate the same output. For example if D1 and D2 would both return the same hash output H, that would mean a collision. :slight_smile:

Can you explain how was SHA-1 broken? :wink:

Its true, it uses SHA256 (I think 8 is a typo). Can you give a particular example how it is used in Bitcoin? :slight_smile:

1 Like
  1. A hash function is an equation, where the output cannot be used to find the input.
  2. Hash functions in Bitcoin are used to encrypt and protect transactions. Because it’s impossible to find the input for a given output. These inputs are things like your recovery seed phrase. Allowing you access to your wallet without enabling someone to steal that phrase.
  3. It should not be possible to get the same output with different inputs. When this is possible, there a chance of a collision attack.
1 Like
  1. Hash functions are functions that take your input and scrambles it into a hash or another set of numbers or characters. Some hash functions can be two way hash functions where you need a hash key to determine the input and others like SHA256 are only one way hash functions which are used and necessary for Bitcoin and other cryptocurrencies so nothing can be done with the hash to determine the input.

  2. Hash functions in cryptocurrencies like bitcoin are used to scramble the data about the transactions through both the mining process, the creation of Merkle Tree, reproducing Nonce’s and the creation of Bitcoin addresses. In the mining process SHA-256 must be used twice to determine the previous block hash parameter in the block header. It must also be used again to produce the Merkle Tree root in the block header and produce and often repeat the NONCE variable which may need be changed repeatedly if the total value is not below the difficulty level. In regards to the creation of Bitcoin addresses, its creates the private key from a randomly selected number and then uses SHA-256 and another hash function called RIPEMD160 to limit the amount of characters or bits of the address for the public key to 160 bits or 40 characters.

  3. Cryptographic hash functions are considered collision resistant if it is infeasible to find two inputs hash to the same output.

1 Like

Homework on Hash Functions - Questions

  1. Describe hash functions with your own words – a one way function where you put in your unique input and receive a unique fixed length output or digital fingerprint.
  2. How are hash functions used in cryptocurrencies like bitcoin? Hash functions are used for processing data from a block through a mathematical function which results in an fixed length output for that particular input.
  3. What does it mean when we say that hash functions need to be collision resistant? Needs to be CR so attacker cannot find any 2 random inputs that hash to the same output hash.
1 Like

Is the hash function used to generate the public key? :wink:

  1. A safe way to change data (INPUT) into an ā€œuncrackableā€ unique fix range of numbers and letters (OUTPUT)

  2. Data like keys and btc amounts and addresses and additional info (INPUT) is turned into a unique OUTPUT. This can be used to track a transaction and to connect them to the right spot in the chain (former block hash must be included into the next block). Coming one world wide ledger.

  3. Different INPUTS do not generate the same hash OUTPUT (statistically very unlikely)

1 Like

This is how I understood it, https://www.mycryptopedia.com/sha-256-related-bitcoin/#:~:text=SHA-256%20is%20a%20cryptographic,output%20of%20a%20fixed%20size.&text=This%20powerful%20feature%20of%20the,Mining

go to CREATION IF BITCOIN ADDRESS section

In order to produce a Bitcoin address, a private key, which is a randomly selected number, is multiplied using an elliptic curve to produce a public key. This public key is then put through both the SHA-256 and RIPEMD160 hashing algorithms.

Where K = the public key and A = Bitcoin address:

A = RIPEMD160(SHA-256(K))

1 Like
  • Describe hash functions with your own words
    hash function is a function given unique input gives out unique output. Creating essentially being an unique digital fingerprint that cannot be reversed.

  • 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).
    The hash functions are used in Bitcoin as minting new transactions on the blockchain known as mining.

  • 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 to make it highly unlikely that 2 different inputs could not get same output from a hash function.

1 Like

Yes of course - thank you for the correction.

1 Like