Crypto Academy / Season 3 / Week 2 - Homework Post for [@pelon53] Hash and Cryptography

in SteemitCryptoAcademy4 years ago

IMG-20210710-WA0005.jpg

Hello professor @pelon53, I'm happy you're here again to fill us with your knowledge. Learnt a lot from you last season. Here's my homework post. I hope you like it.

image.png


1. Explain what does the resistance to collision mean? And what does resistance to preimage mean?


Resistance to Collision


Hash functions are purposed for generating unique characters as output to encrypt information in a block. As many sets of information are transformed into a series of characters, there's a possibility that two sets of information may produce the same hash. For example, H(A)=H(B) where A=Car and B=Boat and H(A)=a567sh7890yu=H(B).

This type of error is what is referred to as a collision in Hash. Hash functions present standard characters as outputs to encrypted messages. Since the inputs are never-ending, the probability of generating the same hash for different inputs(information) isn't 0%.

Resistance to collision is the ability of a hash function to reduce the probability of generating a hash for two inputs. In other words, the ability of a hash function to avoid generating the same hash for different inputs.

Collision resistance basically provides more security to a system. MD5 and SHA-1 are the two hash functions known to have more efficient techniques to counter collisions.

Preimage Resistance


Preimage resistance is a property of a hash function that makes it impossible to be decrypted. It simply means when an input is made and the hash is generated, it's impossible to find the information inputs using the output.

Though it is said to be impossible, outputs could be decrypted but that would require a lot of time and resources. Thus, a hash function with preimage resistance makes it extremely difficult to obtain the input from a hash.

image.png


2. Use tronscan and etherscan to verify the hash of the last block and the hash of that transaction. A screenshot is required for checking.


Using Tronscan to Check the Hash of a Block and Transaction



Firstly, go to https://tronscan.org. Scroll down a bit. You'd find the last validated block from the Block section.

PicsArt_07-10-10.46.09.jpg

Tronsscan Homepage | Screnshot from Tronscan

After the screenshot above, the last block recorded was 31811261. Click on the block to open the details. The block hash is:
0000000001e566bd95623d1791279b92777493cec4f9af269a2c229c1865fc7b

PicsArt_07-10-10.57.41.jpg

Block Details | Screnshot from Tronscan

To view the hash of the transaction of the last block, go to the Transactions section. Click on the first hash. This is actually the last hash of the block transactions recorded.

PicsArt_07-10-11.01.14.jpg

Block Transactions | Screnshot from Tronscan

The transaction hash is recorded as:
ed5fb157851386599b1ba29bce04a7a20f178faa7168f0fb246629da3eca2fed

PicsArt_07-10-11.04.33.jpg

Hash of Transaction | Screnshot from Tronscan


Using Etherscan to Check the Hash of a Block and Transaction



Visit https://etherscan.io. Select the first block from the Latest Blocks section.

PicsArt_07-10-11.07.58.jpg

Etherscan Homepage | Screenshot from Etherscan.io

You'll have the block details available. The block height is 12798798.

PicsArt_07-10-11.10.33.jpg

Block Details | Screenshot from Etherscan.io

Scroll down and click view more to see the hash of the block. The hash is:
0xc00e74fde4f2eb6b8cceeb91c57e72c900457766b1610b25d74541513debfb02

PicsArt_07-10-11.14.16.jpg

Block Details | Screenshot from Etherscan.io

To view the transaction hash, click on the highlighted number of transactions from the Block details.

PicsArt_07-10-11.16.36.jpg

Transactions | Screenshot from Etherscan.io

Select the first hash to view the details.

PicsArt_07-10-01.50.01.jpg

Transactions | Screenshoy from Etherscan.io

The Hash of the transaction is:
0x773ab2b2bfcdb985f9deb68a62690bb844736735962317e953c573b6abe80381

PicsArt_07-10-11.22.17.jpg

Transaction Hash | Screenshot from Etherscan.io

image.png


3. Generate the hash using SHA-256, from the word CryptoAcademy and from cryptoacademy. Screenshot required. Do you see any difference between the two words? Explain.


Generating a Hash using SHA-256


To generate a hash from a word using SHA-256 go to https://passwordsgenerator.net/sha256-hash-generator. I'm going to generate a hash from two inputs; CryptoAcademy and cryptoacademy.

PicsArt_07-10-10.37.03.jpg

SHA-256 Generator | Source

The Hash generated from CryptoAcademy is:
D03CA34B258E6E0FD06B2070DDE61B50BD4EEF6161A8EDAA4A420C9AE1BEB7F9

PicsArt_07-10-10.40.41.jpg

SHA-256 Generator | Source

The Hash generated from the word cryptoacademy is:
0592F5DD27DC72E675B2AB9C77487A69FAAF84196597FA052EC099C18EE7C4C5


Is there any Difference and why?

Clearly, you can see that there's a difference between the two inputs. With the generation of Hash, it's the characters that are important and not the appearance. A single change in a character input would change the hash. Note that space is also a character. Adding it to an input is sure to change the result.

As you can see, the outputs are totally different also. The inputs only differ by 2 characters. But the outputs are not similar in any way. This is because of the collision resistance of the Hash function.

image.png


4. In your own words explain the difference between hash and cryptography.


Difference Between Hash and Cryptography


Hash and cryptography are mainly used to encrypt and protect information from third parties. Though they have something common, they differ significantly.

  • Hash is faster and easy to use as compared to cryptography. This is because Hash doesn't require passwords to encrypt the data. It is also very efficient.

  • Hash outputs cannot be reversed to give the input data. Cryptography allows the reversal of the encrypted data to get the original data.

  • Cryptography is used in many areas across the internet while Hash is mainly used on blockchain networks.

  • Hash functions produce the same number of alphanumeric characters as outputs for all inputs, thus every hash has an equal length. This is different in Cryptography.

image.png


Conclusion


Hash functions are useful in securely sending different types of information such as keys and transactions within blocks. Its irreversible nature makes it very safe. Not to mention its resistance to preimage and collision which are important qualities to avoid confusion and conflict over the system.

Would like to thank @pelon53 for sharing his knowledge with us. Understanding Hash makes us get more understanding about how Blockchain networks operate. I'm looking forward to your next lecture.
Sort:  
 4 years ago (edited)

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.7
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.3.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.3.0
4En sus propias palabras explique la diferencia entre el hash y la criptografía.2.0

Recomendaciones:

  • Prestar atención a cada pregunta, para responde de acuerdo a lo que se solicite.

Calificación: 9.7

 4 years ago 

Please @pelon53, I don't understand how they do not match. I skipped a screenshot and so when I started editing the images fortunately the tab I opened the latest block was still open. If you check the block height is the same on the last block and transaction block. It's just the time that is different.

 4 years ago 

@pelon53, maybe I'm not seeing why you're saying they do not match but if what I think is the reason please if you can I'd like a review. Thanks

 4 years ago 

@pelon53, please this is to get your attention.

Saludos, si tienes la razón. Si coinciden. Ya está revisado.

 4 years ago 

Alright Sir, thanks.

Coin Marketplace

STEEM 0.12
TRX 0.34
JST 0.032
BTC 121482.05
ETH 4330.89
USDT 1.00
SBD 0.78