Introduction


Hashing is a significant information structure intended to tackle the issue of proficiently finding and putting away information in a cluster. For instance, assuming you have a rundown of 20000 numbers, and you have given a number to look in that list you will examine each number in the list until you track down a match.


It requires a lot of your opportunity to look in the whole list and find that particular number. This manual course of checking isn't just tedious yet wasteful as well. With hashing in the data structure, you can limit the inquiry and track down the number in no time.


What exactly is Hashing?


Hashing in the data structure is a procedure of planning an enormous piece of information into little tables utilizing a hashing function. It is also called the message digest function. It is a procedure that uniquely recognizes a particular thing from an assortment of similar things.


It utilizes hash tables to store the data in an array format. Each value in the array has a unique index number. Hash tables utilize a method to produce these unique index numbers for each value put away in an array format. This procedure is known as the hash technique.


You just need to track down the index of the required item, rather than tracking down the data. With indexing, you can rapidly filter the whole list and recover the item you wish. Indexing additionally helps in insertion tasks when you really want to insert data at a particular location. Regardless of how enormous or little the table is, you can refresh and recover information in no time.


The process of Hashing


  1. The hash function changes over the item into a little whole number or hash value. This number is utilized as an index to store the first information.


  1. It stores the information in a hash table. You can utilize a hash key to find information rapidly.


Real life example of Hashing:


  1. Each employee in a company has his/her unique ID number. The employers can use this number to retrieve all the information about their employees. 


  1. College authorities can get information about their students with the help of the students' General Registered Number.


 

The Hash Function


The hash function in a data structure maps subjective size of data to fixed-sized data. It returns the accompanying values: a small number value(otherwise called hash value), hash codes, and hash sums.


The hash function should 

  1. Be easier to figure out.

  2. Never get stuck in bunching and distribute keys thoroughly across the table.

  3. Avoid collision in case two keys get assigned a single hash value.


The Hash Table


Hash tables are used to store key-value pairs.The hash table then, at that point, utilizes the hash function to produce a inrex. Hashing utilizes these index numbers to perform addition, update, and search tasks.



Use of Hashing in blockchain technologies:


Hashing is something imperative in Blockchain innovation. It is a numerical interaction that is utilized to compose new exchanges into a blockchain. The interaction is executed by a Hash function with the assistance of a Hashing algorithm.


A hash function is a function wherein contribution of any length of information or string will give a result of a fixed length. The result of a hash function is known as Hash.


Features required for secure Hashing in Blockchain:

  1. The Hash function must be Deterministic. It means that the output or the ‘Hash’ should be the same even if we give the same input twice or more. If we get different hashes every time for the same inputs, obviously we can’t keep track of the input value.


  1. The hash function used should be able to produce the output or hash as quickly as possible.


  1. For each hash, say H(A), it ought to be infeasible to find an input 'A' from H(A).

 Assume we are utilizing a 128-digit hash where the data is extremely gigantic and 'Brute Force technique' is the best way to see the first info. In Brute Force Technique, an arbitrary value is chosen and hashed and is contrasted with the objective hash. This cycle is rehashed until it tracks down a match. For the most part, it's anything but a functional strategy as the data is immense in volume.

  1. For each little change in the information, it should roll out an immense improvement in the hash.


Considering these restrictions, the following few methods are generally used majorly in blockchain technology.


  1. SHA-256(Secure Hash Algorithm 2): Used in Bitcoin

  2. Keccak-256: Used in Ethereum


Fundamentally, data is put away in Blockchains. Furthermore, obviously, it will have a Data Structures. There are mostly two data structures utilized in Blockchain, Pointers, and Linked lists. We realize pointers are variables that store the location of different variables. In Blockchain,more than the location the pointers additionally store the hash value of the past block.


In data structure level view, we can say that Blockchain is essentially a Linked list in which every node stores a hash pointer and a data header. While the data header will store the information of that block, the pointer will have the location of the first block just as well as the hash value.


Source Hashing Technology in Blockchain 


Mining is just a process that adds new blocks to the Blockchain. The miners check a transaction that has been pushed to the blockchain and adds it to the Blockchain assuming it is a valid transaction.


Each blockchain network will have a time limit for the making of a block. Assuming the blocks are made quicker, it will bring about generation of more hash functions in a brief time frame which might bring about the collision of hashes. Additionally when new blocks are made quicker specific blocks can't be the piece of the main chain as more blocks are added at the same time to the chain. So to keep away from this issue a specific difficulty level is set for 'hash'.


Let us take a look at the case of Bitcoin,


In Bitcoin, when another block shows up, the hash function hashes every one of the contents of the block.


From that point onward, the hashed output is connected with a nonce, a random string.


The whole connected string is then hashed again and a difficulty level comparison is done.


If the new result is not exactly difficult then the block is added to the chain and the nonce is changed and the cycle is restarted until it passes the rules.


Comments

  1. Nice explanation though . Liked the detailing and information about secure hashing in blockchain... .. .

    ReplyDelete
  2. Application of hashing in blockchain is very well explained

    ReplyDelete
  3. Amazing! Nice content...esp th usage in blockchain

    ReplyDelete
  4. Well explained ๐Ÿ™Œ๐Ÿ‘

    ReplyDelete
  5. I’m blown away by the level of detail in this blog. Simple, intellectual, informative and interesting. Will surely keep an eye out for blogs published by you guys in the future. Brilliant job guys!!

    ReplyDelete
  6. Hashing Concept expand very well

    ReplyDelete
  7. Liked the detailing of topic
    Good efforts guys๐Ÿ‘

    ReplyDelete
  8. This is topic is new to me but it is explained in simple way great work Siddhesh and team.๐Ÿ˜‡๐Ÿ”ฅ

    ReplyDelete
  9. End sem will be better now

    ReplyDelete
  10. Thanku for those wishes, hoping end sem to go better

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
  11. Property explained how hashing is used in blockchain!๐Ÿ”ฅ๐Ÿ”ฅ

    ReplyDelete
  12. Pyaar ishq sabh dhoka hai sudharjo abhi bhi moka hai

    ReplyDelete
  13. Nice explanation about hashing

    ReplyDelete

Post a Comment