Steemit Crypto Academy Season 3: Week 2 |Homework Post for @pelon53,Hash and Cryptography.

in SteemitCryptoAcademy3 years ago

COLLISION RESISTANCE

The collision resistance is said to be a property of the hash function in cryptography, you cannot talk about the collision resistance without making mention of the cryptographic hash function. A hash function is said to be collision resistant when it becomes difficult to get 2 inputs hashing to the same output. This is to say for instance having two inputs say x and y in that H(x) will be equal to H(y). Whenever hash functions possess more inputs than it possesses outputs, they will definitely experience collisions. When we talk about hashing, we are talking about the process of creating an output that has a fixed size from an input that a different sizes. This can only be achieved by employing the use of mathematical formulas that are referred to as hash functions. Even though it is not all hash functions that involves using cryptography, the hash functions are the essentials of the cryptocurrency. This has made block chains and other distributed systems to attain a very significant level of security and data integrity.

As mentioned, a collision ensues when dissimilar inputs produce the exact same hash. This means that the hash function is said to be resistant to collision till the moment when someone is able to find its collision. Collisions will always be available for hash functions because the potential inputs are limitless, while the potential outputs are limited.

That is to say, a hash function is resistant to collision when the likelihood of discovering a collision is so small that it needs so many years of arithmetic. So, although there are no hash functions that are free from collision, there are some hash functions that are strong enough to be referred to as resistant. This could be said in the case of SHA-256. Talking of the SHA algorithms, the combinations of SHA-0 and SHA-1 are deficient in terms of security because of collisions but we can say that when we combine SHA-2 and SHA-3 they are said to be resistant to collision.

A collision takes place when an attacker is able to lay hands on 2 inputs say a1 and a2 that will both result in the same output.
Look for any two inputs a1 and a2
so that H(a1) will be equal to H(a2)
and will all be equal to Y(and a1 will not be equal to a2).

This is quite different from the second preimage attack (which later be discussed as we make progress) because the attacker can decide both the inputs, this makes it much easier to accomplish.
The collision resistance becomes a necessity when you depend on the hash functions to be able to generate 2 inputs to 2 varying outputs. when the output space is small compared to the input space, then many inputs will generate the same outputs.

Although we are certain of the existence of collisions, we can still make use of certain subset hash functions for cryptography. This is what we refer to as collision resistant hash function.

RESISTANCE TO PRE IMAGE

This is an absolute necessity for hash functions because it means that the function is one way, The concept of preimage is related to one way functions. When we talk about preimage resistance in hash function, we are referring to when there is very small chance of a person finding the input that will give an output. This security property is different from the previous one because the person trying to attack will have to guess what the input is by looking at an output. This is not so for a collision as a collision occurs when someone finds different inputs that generate the same output, but the input used is necessarily not a considered factor.

In the preimage attack we are given the output to find the input that generated it. That is we are given say x = H(a) to find a.
The preimage resistance is very important in hash functions in the protection of data since just a hash of the message can confirm whether it is authentic or not even without revealing important info.

SECOND PREIMAGE RESISTANCE

This kind of attack happens when someone is able to lay hands on a particular input that can result in the same output as an already known input. This involves looking for the collision but instead of looking to just any input can produce the desired output, what they do is to find an input that will be able to produce the same hash just like another input.
We will be using tronscan and etherscan to verify the hash of the last block and the hash of the transaction.

USING ETHERSCAN TO VERIFY HASH

Below are the steps that should be duely followed if you want to verify the hash of a block and the transaction the hash.

20210708_073651.png

The first step I took is to visit etherscan’s website https://etherscan.io

20210708_073656.png

After opening the website, I scrolled down to the last block and then I selected the last block 12780360

To get the hash for the block, I tapped the said block above thereby opening all the informations about the block e.g the block height, the hash, the transactions and so many other informations.
From the displayed information, the hash to the block is [0x41afe41ea89e09fba8d05eb8b44136bcd81bddb72f7063fb037d0e9f068635a4]
Input the hash into the search bar above

20210708_073702.png

20210708_073706.png

The total number of transactions that was carried out on this block is 174.

USING TRONSCAN TO VERIFY HASH

Below are the steps that should be duely followed if you want to verify the hash of a block and the transaction the hash on tronscan.

20210708_073711.png

As always the first step is to download the tronscan app from your mobile’s playstore or alternatively login through their website (for this demo, we will login through their website, www.tronscan.org).

20210708_073716.png

Scroll down to see the block section
As in etherscan above; click on the block #31729848

20210708_073720.png

To get the hash for the block, I tapped the said block above thereby opening all the informations about the block e.g the block height, the block hash so many other informations.

The block hash for the block above is [0000000001e428b8337bd59e9089aa535e74a195503a552c4f6b1e41435ccfa5]
Below the informations is the transaction column for transactions carried out in the above block which is a total of 453.

20210708_073725.png

GENERATING HASH USING SHA-256, FROM THE WORD CryptoAcademy and cryptoacademy

To generate hash using SHA-256
I visited https://passwordsgenerator.net/sha256-hash-generator/
Then in the search space provided I input the word I want to generate hash for ‘CryptoAcademy’ then I clicked on generate

20210708_073730.png

The result I got was D03CA34B258E6E0FD06B2070DDE61B50BD4EEF6161A8EDAA4A420C9AE1BEB7F9

Then in the search space provided I input the other word I want to generate hash for ‘cryptoacademy’ then I clicked on generate
The result I got was 0592F5DD27DC72E675B2AB9C77487A69FAAF84196597FA052EC099C18EE7C4C5

20210708_073735.png

The reason why the hashes for the two words are different is because it has different casing, the first word we searched for had Upper cases in them while the second word only had lower cases. From these results we can say that hash is collision resistant since 2 same words produced different results.

THE DIFFERENCE BETWEEN HASH AND CRYPTOGRAPHY

HASH

When we talk of hashing, we are referring to a method of cryptography that is used to convert data into an exceptional string of text. They are used for encoding data into unique alphanumeric string, this is to ensure security and privacy. It is important to note that all kinds of data can be hashed as there is no type, length nor size constraint. The result of any generated hash always has a fixed length. Like we said at the beginning, the hash acts as a one way function. Every hash has a different output, just like in the demonstration we carried out above. The same data will always generate the same output.

CRYPTOGRAPHY

Cryptography ensures the security of both transactions and the users.
Cryptography carries out encoding and decoding tasks of various data by using mathematical methods. It is the method of sending secure messages between many users, how it is done is that the sender of the message will encrypt the message using a specific key and algorithm, and then when the receiver at the other end receives this message, he will have to decrypt the message to be able to get the original message sent.

The encryption keys are very vital when it comes to cryptography because messages sent cannot necessarily be read by a wrong recipient as the intended recipient will be the only one who can decrypt the message sent.

DIFFERENCES BETWEEN HASH AND CRYPTOGRAPHY

Below are few observable differences between the hash and the cryptography.
Hash does not make use of keys while cryptography makes use of keys to be able to recover its informations.

The length of output in hash is always the same no matter the type of data while in cryptography as information increases, the length also increases.
Data in hash cannot be recovered while in the case of cryptography it can be recovered by the use of keys.
Both are very essential in ensuring the security of block chain and cryptocurrency.

Thank you @pelon53 and @steemcurator02

Sort:  

Gracias por participar en Steemit Crypto Academy Season 3:

Espero seguir leyendo tus publicaciones.

NoPreguntas.Puntaje.
1Explique ¿Qué significa la resistencia a la colisión? Y ¿Qué significa resistencia a la preimagen?1.5
2Use tronscan y etherscan para verificar el hash del último bloque y el hash de esa transacción. Se requiere capture de pantalla para su comprobación.1.0
3Genere el hash usando SHA-256, de la palabra CryptoAcademy y de cryptoacademy. Se requiere capture de pantalla. ¿Observa alguna diferencia entre ambas palabras? Explique.2.5
4En sus propias palabras explique la diferencia entre el hash y la criptografía.1.5

Las captures de pantalla no tienen el nombre de usuario. Y no demostró el hash de la transacción del último bloque (no es visible).

Recomendaciones:


Párrafos muy extensos y hacen tedioso la lectura, hay que hacerlos menos largos.
Una presentación inicial es importante para cualquier blog. Incluido el título y datos relevantes.
Debe colocar el nombre de usuario a cada capture de pantalla.
Cada tarea debe llevar las conclusiones a que se llegó con la investigación.

Calificación: 6.5

Coin Marketplace

STEEM 0.19
TRX 0.15
JST 0.029
BTC 63635.72
ETH 2597.20
USDT 1.00
SBD 2.91