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:


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

  • How to Measure Your Kubernetes Maturity?

    What started as an open-source project by Google is now making big waves in the tech industry-Meet Kubernetes. Startup to tech giants, Kubernetes adoption is skyrocketing and shows no sign of slowing down. Kubernetes adoption hits a new high Survey results indicate widespread adoption of Kubernetes (91%), especially in production environments (75%). Supported by a […]

  • Understanding Cloud- Native

    Adding a new dimension to the ever-changing IT landscape, cloud native is emerging as the de-facto standard for developing and deploying complex, scalable systems. It is a lot more than just running your software in private/public cloud. So, what is Cloud Native? First up, Priyanka Sharma, general manager at Cloud Native Computing Foundation  says “Cloud-native […]

  • How Kerala’s IT Sector Braces To Fight COVID-19?

    In India and around the world, the impact of the coronavirus pandemic is evident across all sectors of the economy.  With  COVID-19 spreading rapidly around the world, the pandemic has not only affected the lives of hundreds of thousands of people but also demonstrated a growing impact on the global economy. From companies chalking out […]

Leave a Reply

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