Hash

Table of contents

Summarise with:

A hash is a mathematical function that takes an input (such as a file, a message, or any type of data) and returns a fixed-length alphanumeric character string, which uniquely represents that entry. Put simply, it is like our ID number on the identity card of the country in which we reside: it is made up of a unique sequence of characters that uniquely defines us.

Thus, the hash codes are unique and unrepeatable, The two identical ones will not be found and each one represents a single file. Moreover, they are unidirectionals, in the sense that the hash is generated from the file properties, but the file properties cannot be guessed by analysing a hash code.

These two properties of hash functions have a direct consequence: any slightest change in the file can trigger a flood of automatic changes in the hash code.

How is a hash code generated?

A hash is generated as follows:

  • Data entry: The hash function receives an input, which can be any type of data, such as a file, a message, a password, etc.
  • Processing: It applies a specific mathematical algorithm to the received input that performs a series of calculations based on the input data to generate a unique character string.
  • Hash generation: As a result of these calculations, the hash code is produced, unique to that entry in representation of the information it contains.
  • Hash output: Finally, the hash function returns the generated hash code as output and assigns it to the file.

What are hashes for?

Hash codes are a central component of the technology of blockchain, Hash codes are frequently used in the banking and transactional system because of their cybersecurity benefits. By extension, hash codes have the following practical applications:

Secure storage of passwords 

Instead of storing users' passwords in plain text, the most current authentication systems store the hash of the passwords. When a user tries to log in, the system compares the hash of the password entered with the hash stored in the database. Thanks to this technology, if an attacker accesses the database, he will only see the hashes instead of the actual passwords and will not be able to crack it.

Data integrity

Hashes are used to verify whether data has been altered or corrupted. That is to say, are useful for identifying security breaches and deduce some criminal activity online. For example, when downloading a file from the Internet, a hash of the original file can be provided. After downloading, you can calculate the hash of the downloaded file and compare it with the original hash to ensure that it has not been modified.

Rapid indexing of information

Hash functions are used in the creation of data structures, such as hash tables, which allow for a quick access to the stored information. These structures are used in databases, search systems and other applications where fast data retrieval is required.

Cryptography

In cryptography, hashes are used in the creation of electronic signatures, where the hash of a message is encrypted with the sender's private key to verify the authenticity of the message and generate a unique sequence of characters as a personal signature.

Cryptocurrencies and NFT

In cryptocurrencies such as Bitcoin and Ethereum, hash functions are used to ensure the security and integrity of the blockchain. For example, Bitcoin uses the SHA-256 hash function to calculate the hash of each block in the chain. This use of hash codes is also seen in the creation of NFT (non-fungible digital assets).

Share in:

Related articles

Stack

What is a stack? A stack in the context of web development refers to the set of technologies and tools that are used to create a web application or website. This stack can be divided into two main areas: the front-end and the back-end.

3 examples of products with planned obsolescence

Planned obsolescence is a highly controversial strategy allegedly employed by companies to make a product unusable after a period of time since its manufacture. The purpose of planning the obsolescence of the products that are manufactured is to ensure a

9 examples of deep learning algorithms

The world of artificial intelligence has been revolutionised by deep learning, a fascinating field of study that has transformed the way machines learn and understand the world around us. In this blog post, we will explore

Scroll to Top