Close

The SHA-1 Hash Function

In this blog post, we are going to explore a core concept of the “Git” Technology :

the SHA-1 Hash function.

Briefly, any file in a computer can be thought of as a series of bytes, each of which is 8 bits. If  you put these bytes from left to right, all files can be thought of as very large numbers represented in binary (base-2) format. Cryptographers have come up with a very interesting function called SHA-1 which has the following curious property: any binarynumber, up to 264 bits, can be rapidly mapped to a 160 bit (20 byte) number that we can visualize as a 40 character  long number in hexadecimal (base-16) format. Here is an example using node’s crypto module:

sha-1-hash-function

The point is that, even binary numbers which are very close,  map to completely different 20 byte SHA-1 values, which means SHA-1(x) is very different from most “normal” functions like cos(x)

SHA-1 Hash function

Because a hash can be assumed to map 1-to-1 to a file, rather than conveying the full file’s contents to distinguish it, you can just use the hash. Indeed, you can just use a hash to uniquely identify any string of bits less than 264 bits in length.

Latest stories

  • Manage Remote Teams and Productivity During COVID-19

    With more than  471,862 cases around the globe, the coronavirus (COVID-19) pandemic has a devastating impact not only on the lives of hundreds of thousands of people but also on the global economy. The government aiming to contain and mitigate the disease has initiated the largest Coronavirus lockdown in the country. This has affected the […]

  • Hybrid Mobile Application Development: When, Why, and How

    When it comes to Hybrid mobile application development there is no one-size-fits-all solution. Every solution comes with its own set of pros and cons.  React native Vs Flutter Vs Native app Native and cross-platform approaches using React Native or Flutter have emerged to be popular mobile app development solutions. While native app development has carved […]

  • How To Hire React Native Developers? Highlighting Key Skills

    From being Facebook’s internal Hackathon project to one of the most trending frameworks for cross-platform app development-React Native has made it big! Numerous giants like Instagram, Airbnb, Walmart have developed their apps using React Native technology. Planning to adopt React Native for your next app development project ? Do you want to hire React Native […]

Leave a Reply

Your email address will not be published. Required fields are marked *