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

in SteemitCryptoAcademy3 years ago (edited)

Introduction

It's my pleasure to attend the academy for another session this week, and this time around, I've attended the lecture presented by professor @pelon53 which was centered on the topic Hash and Cryptography. The lecture was an awesome one and I will be using this piece of article to attend the task given by the professor.

Overview of Hash and Cryptography

Hash functions in the blockchain technology is used for the storage of information on the blockchain, as such, Hash is the combination of alphanumeric characters that stores information about a transaction on the blockchain. The information stored includes, the sender and receiver's address, the type of transaction, the amount of asset involved in the transaction, the time of transaction and so on. This has helped to contain large volume of information in just a few combination of alphabets and numbers which enhance quick and efficient record of transaction on the blockchain.

Speaking of Cryptography, it is the technology utilized in the blockchain to secure users information such that third parties can't alter them, although, it's visible to sender/receiver but there is restriction of who can actually access it. A typical example is the case of Public and Private keys, as the name sounds, public keys can be shared with anyone for the purpose of deposit and the public can look up to your account and see the amount of crypto asset you are holding in your wallet but can't access it. And the private keys are the real deal that secure the account of a user, as they only can access their individual account with the private keys and alter the wallet at will, that's the art of cryptography. Let's look more into task.

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

Resistance to Collision

Collision in this context refers to two different inputs coming out with identical output having the same hash, as such, this can be so misleading. Resistance to collision is characterized with hash functions to make sure the hash output from several transactions carried out on the blockchain becomes hard to appear more than once. It is recorded that the earliest hash function algorithm gives output that are identical and that tends to be disturbing, and insecure.

The recently designed hash functions used in the blockchain technology are said to be more efficiently designed such that they are collision-resistant and prevent the occurrence of same hash output for two separate inputs. Notably, SHA-2 (which includes SHA 224, SHA 256, SHA 384 and SHA 512) hashing function are said to be hash functions technology that has proven to be very efficient in resisting collision and as such prevent identical outputs from different inputs' background.

When the cryptographic hash function is resistance to collision then it becomes impossible/hard to find an identical outputs and as such, prevents frivolous swapping of original hash for the fake one that can lead to confusion. Resistance to collision is an important context in cryptographic hash function to maintain the intactness of genuine inputs and outputs which remains unique for each transaction.

Points to ponder

  • When the hash provided from an input becomes impossible to be corresponding to another hash produced by another input, it said to be collision-resistant.

  • Practical illustration, Hash of input "goat" equals 02d41a63d7 (virtualized) and Hash of input "Goat" equals 25a52h741a (virtualized). You can see it becomes so hard to have identical outputs even for almost identical inputs.
  • Resistance to Preimage

    Resistance to preimage is also a characteristics of the hash function that makes it computational impossible for attackers to find a matching input for the output hash. That's a big technology to talk about, this makes it hard for any attacker to alter the resulting hash of any transaction as it becomes impossible to fetch out the input that gave birth to the new hash output. Resistance to preimage in the hash function helps to secure the hash from likely attackers that might want to alter the hash by replacing it with fake ones.

    Let's talk about the First preimage resistance as this attribute is referred to be one way function as it's impossible to invert it to get the inputs that give birth to the output' hash and this enhance the security of data stored in the hash while the Second preimage resistance ensure that it's impossible to find the output of another input to be identical to the first input.

    Points to ponder

  • The hash remains intact and non-reversible. The input that gave birth to the hash cannot be reversed as seen in first preimage resistance

  • It becomes impossible to find a second input that gives the same hash as the first input, this is seen in the case of second preimage resistance.
  • 2. Use tronscan and etherscan to verify the hash of the last block and the hash of that transaction. Screenshot is required for checking.

    For this section of the task, I will be exploring the duo of Tronscan and Etherscan to verify the hash of the last block and the hash of the transaction.

    Verifying on Tronscan

  • The first step here starts by visiting the website tronscan.org/ Scroll down to locate a section for Blocks and Transactions.
  • iMarkup_20210708_115155.jpg
    blocks and transactions

  • The last block from the above is 31755671, by clicking on it, we are led to another page that gives information of the block height, block hash, block size, status of the blocks, transactions involved, the time of the transactions, energy and bandwidth consumed (as associated to the Tron network) and so on. Let's see the screenshot below.
  • iMarkup_20210708_115915.jpg
    Block details

    From the information given on the page uploaded above, the block hash is; 0000000001e48d973c9bd69eb3376179e667d3c2a80fb98d366605108461b83f.

  • Now to verify the transaction in the block, I scrolled down the page to located transactions and selected one of the transactions in the block (last one).
  • iMarkup_20210708_121141.jpg
    Transactions

  • On the next page, many information are revealed. Where we have the transaction hash, block, the status of the transaction and so on.
  • iMarkup_20210708_121244.jpg
    Transaction details

  • The screenshot above revealed the hash of the transaction and it is; e1807f5db18573bc8494094da017437a7368b137351b9434ca6abb7d7c535190.
  • Verifying on Etherscan

    The first step in the process of verifying the hash here is by visiting etherscan.io/ and locate the last block by scrolling down the page.

    iMarkup_20210708_122319.jpg
    Latest block on Etherscan.io

  • The latest block is 12786391 and by clicking the block, I was led to the next page with the overview of the block that includes the number of transactions, timestamp and other information. Then I selected the click to see more button to see the transaction hash and other information.
  • iMarkup_20210708_122800.jpg
    Overview of the block

    iMarkup_20210708_122843.jpg
    Click to see more

  • Now I can see the block hash which is; 0x7178f03fe8a8859566baed983669c18b65034b0636f9a553f16b68e20801c64f.
  • iMarkup_20210708_123453.jpg
    Block hash

    Now to verify the hash of the last transaction, from the block overview page, I located transactions and clicked on it.

    iMarkup_20210708_123930.jpg
    Transactions

    I selected the last transaction on the list and the details like hash, addresses involved, block height, time of the transaction, transaction type and so on, were revealed.

    iMarkup_20210708_124422.jpg
    Transactions

    iMarkup_20210708_124631.jpg
    Transaction details

  • As indicated in the screenshot above, the hash of the last transaction is; 0x7643f4a04e1798726da633734d154bd61b6fb3f84fbe1b397a8a64573988bed8.
  • Fred Br.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.

  • For the process of generating hash using SHA-256, it starts from visiting the website https://passwordsgenerator.net/sha256-hash-generator/
  • iMarkup_20210708_125521.jpg
    The passwordsgenerator landing page

    For the word- CryptoAcademy

  • I typed in the word CryptoAcademy and the resulting SHA-256 hash generated is; D03CA34B258E6E0FD06B2070DDE61B50BD4EEF6161A8EDAA4A420C9AE1BEB7F9.
  • iMarkup_20210708_130149.jpg
    SHA-256 hash for the word "CryptoAcademy"

    For the word- cryptoacademy

  • For this part, I typed in the word cryptoacademy and the SHA-256 hash generated is; 0592F5DD27DC72E675B2AB9C77487A69FAAF84196597FA052EC099C18EE7C4C5.

    iMarkup_20210708_130538.jpg
    SHA-256 hash for the word "cryptoacademy"

    Observations

  • The first difference noticed is that the letters of the words has case (uppercase/lowercase) differences having the first word to have a combination of uppercase (C and A) in it while the second word is completely in a lowercase state.

  • The words are different in inputs (the uppercase/lowercase) and has effects on the resulting hash (output).

  • The SHA-256 hash generated from the two words are different which means they have different outputs.

  • Final word, the words are different inputs which results in different outputs.
  • Fred Br.png

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

    The differences between the duo of hash and cryptography would be given in the list below;

  • Considering encryption, hash is a one-way function that can't be altered to see the initial input while cryptography can be seen as a two-way function with the inclusion of decryption function such that the encrypted message can be accessed by a user with the right key. A typical example is seen on the STEEM blockchain when users send encrypted messages to each other through the wallet, as such the encrypted message remains invisible to others but the receiver can access it with his/her owner/active key.

  • Hash function converts the inputted data into a fixed length of alphanumeric combinations while cryptography don't have a fixed length as it tends to increase with the input.

  • Hash is used to store data on the blockchain while cryptography is seen as a secure means of communication to hide certain information from a set of people.

  • Hash can't be reversed while cryptography can be reversed (reveal the initial input) at the destination with the use of the right key.

  • Speaking of security level, hash is more secured than cryptography and this attribute can be credited to its one-way function.
  • Fred Br.png

    Conclusion

    In conclusion, the hash function is a one-way function which securely store data which cannot be reversed or replaced with fake ones while we see cryptography as the secured means of communication to exclude certain set of people from seeing the conversation.

    It is also very important to know that, the input matters in hashing as different inputs produce different outputs, an attribute that can be credited to its one-way function while the input in cryptography remains visible at the destination using the designated key. Thanks to professor @pelon53 for this awesome lecture.

    Fred Br.png

    Cc: @pelon53

    Fred Br.png

    Written by;
    @fredquantum

    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?2.0
    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

    Buen trabajo, felicitaciones.

    Calificación: 10.0

    Thanks for the review professor @pelon53. I'm so glad that I participated in the lecture, it adds a whole lot to me. Thank you.

    Dear @steemcurator02, please I am missing out your curation on this post as I've only been rewarded by steemcurator01 for making the top 3 for this course. Thank you.