top of page
Writer's picturePrakul Neupane

Hash Code

Updated: Nov 10, 2022

Hello!

Welcome to my blog for my YouTube channel, Stick2Tech!







Today we will be talking about Hash codes.


1. What are Hashes?


Hashes are like fingerprints that are used so data can be identified. Hashes are randomly generated by an algorithm.


2. Rules of Hashes?

There are three rules when generating a hash:

  1. Collision Resistance

  2. Hides Input

  3. Puzzle Friendly

It needs to be collision-resistant, meaning it should take an unreasonable amount of time to find two different inputs that correspond to the same output when put into the hash function. This is so that one hash key doesn't reference two different inputs.




It needs to be hidden, which means that if the data is similar, it will be put through an algorithm that will make sure there is variance in the keys so that the input will not be able to be figured out from the hash key (high min-entropy just means a data set is highly distributed)




Finally, there is always a value that we will call K. The Algorithm uses that to identify the input x. Still, it needs to be puzzle friendly, which means there is no solving strategy for this type of puzzle that is much more time-efficient than trying 2^n, assuming n is the number of bits.


3. Where are hashes commonly used?



Hash keys are the fingerprint for all different types of digital data. They help to prevent any tampering with the data because any time the data is changed, the hash is put into the Algorithm again, meaning the hash key will be changed from before.



A. Comparing Large Datasets:


In this example, there are two databases with a large dataset. Comparing the small change in the data between these two databases will take time. For this, we can use Hash code to find if the datasets are the same.


  • The code is generated for each dataset

  • The hash code is compared, and it is found to be equal.

  • That proves that the datasets are the same.

In a similar example

  • The code is generated for each dataset

  • The hash code is compared, and it is found to be changed.

  • That proves that the dataset is changed.


B. Finding tampering in contracts:



In this example, we can use a contract at different points in time to see if there is any change before signing it.


  • We can generate a Hash key for the contract sent a few days back

  • Then generate the Hash key on the day of signing to compare if anything has been changed before signing the contract


4. Algorithms to generate Hashes



There are many algorithms to generate a Hash key. The most commonly used hash code algorithms are MD5, SHA-2, and CRC32. As per your request, I can give more details on the Algorithm.[2]


5. Benefits



There are many benefits of using Hash Code

  • Hash Code can be fingerprinted for any digital data

  • It helps in the fast comparison of huge datasets

  • This helps in detecting tampering, as we have seen in the contract example

  • This can be used to compare encrypted files as those files are not human readable

  • There are many places hashes can be used, like Cryptocurrencies or Digital Signatures


6. Shortcomings


The main shortcoming of Hash code is that the collision happens as you can see, the percentage of collision in 32-bit hashes are high. This probability of collision is significantly lowered by increasing the Hash-code bits.


Thank you for reading my Blog about Hash Keys, I will be making other blogs relatively soon, and I want to hear your opinion about what I should talk about. Should I go more in-depth with this topic, or is there something you want specifically, like Hash Keys in relation to Block Chain? If this topic interests you, I encourage you to do your own research on the subject or write in the comments below if you have any questions for me.



Acknowledgment:

71 views0 comments

Recent Posts

See All

Commentaires


bottom of page