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

  • If you are in Jordan looking for app development support you should read this

    From downloading a mobile app  to visiting a brick-and-mortar store, customers today value every interaction with a brand. A great customer experience leaves a lasting impression in their minds about the happy and satisfying experience.  Winning the customer experience race Every  interaction offers  a make-or-break opportunity for a brand to either  build a loyal customer […]

  • Enhanced Efficiency & Optimized Cost of Project Development with Sweden Hybrid Model.

    Going beyond the cost factor and striving to deliver quality, innovation and flexibility to its customers across the globe, Toobler introduced a Hybrid (Onshore and Offshore) Software Development Model. Huge popularity of the hybrid model is fuelled by scores of organizations choosing to keep design and architecture phases at geographic proximity.  Driven by a customer-centric […]

  • 7 Pro Tips: Network Like a Boss at GITEX 2019

    The biggest tech show in the Middle East, North Africa & South Asia- GITEX Technology week takes place in Dubai World Trade Centre from Oct 6 – Oct 10. The opportunity to network with prospects, key decision-makers and business heads of the tech industry makes GITEX an unmissable event.  What makes the show exceptional is […]

Leave a Reply

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