At its core, hashing is about transforming data of any size into a fixed size. The output, known as a hash, is a string of characters.

Back to glossary

Hashing is a fundamental concept that underpins many of the security protocols and systems we rely on daily. Hashing is a process that takes an input (or 'message') and returns a fixed-size string of bytes, typically a 'digest' that is unique to each unique input. It is a one-way function, meaning that the data that goes in cannot be retrieved simply by reversing the process.

This article will delve into the intricate details of hashing, exploring its various aspects, applications, and implications in the field of cybersecurity. We will dissect the concept, examine its mechanics, and illustrate its role in ensuring the integrity and security of digital information. Strap in for a comprehensive journey into the world of hashing.

Understanding hashing

At its core, hashing is about transforming data of any size into a fixed size. The output, known as a hash, is a string of characters that represents the original data. The fascinating part about hashing is that even a minor change in the input data will produce a drastically different output hash. This property is what makes hashing so valuable in cybersecurity.

Imagine hashing as a complex mathematical algorithm that takes your data and churns it into a jumbled, nearly unrecognizable string of characters. This process is deterministic, meaning the same input will always produce the same output. However, it is virtually impossible to reverse-engineer the original data from the output hash, making it a one-way street.

The properties of a hash function

A good hash function has certain properties that make it effective for cybersecurity purposes. First, it is deterministic, meaning that the same input will always produce the same output. Second, it is fast to compute the hash value for any given input. Third, it is infeasible to regenerate the original input value from the hash value. Fourth, a small change to the input should produce such drastic changes in the hash that the new hash appears uncorrelated with the old hash. Lastly, it should be infeasible to find two different inputs that hash to the same output.

These properties ensure that a hash function can securely represent data without revealing the data itself. They also make hash functions useful for a variety of applications in cybersecurity, such as password storage, data integrity checks, and digital signatures.

Common hashing algorithms

There are several commonly used hashing algorithms in cybersecurity. These include MD5 (Message Digest Algorithm 5), SHA-1 (Secure Hash Algorithm 1), and SHA-256. Each of these algorithms has its strengths and weaknesses, and they are used in different contexts depending on the specific security requirements.

MD5, for example, is fast and produces a relatively short hash, but it is not as secure as other algorithms. SHA-1 is more secure than MD5, but it has been found to have vulnerabilities that make it less secure than originally thought. SHA-256, part of the SHA-2 family, is currently one of the most secure hashing algorithms available, but it is slower and produces a longer hash than either MD5 or SHA-1.

Hashing in cybersecurity

Hashing plays a crucial role in many aspects of cybersecurity. It is used to ensure data integrity, secure password storage, and create digital signatures, among other things. Each of these uses takes advantage of the unique properties of hash functions to provide security in the digital world.

For example, hashing is used to verify the integrity of data during transmission. When data is sent from one place to another, it can be hashed before transmission, and then the hash can be sent along with the data. Upon receipt, the data can be hashed again, and if the new hash matches the one sent with the data, the recipient can be confident that the data has not been tampered with during transmission.

Hashing and password storage

One of the most common uses of hashing in cybersecurity is for password storage. Instead of storing users' passwords in plain text, which would be a major security risk, websites and applications typically store a hash of the password. When a user enters their password, it is hashed, and the hash is compared to the stored hash. If they match, the password is correct.

This method of password storage is much more secure than storing plain text passwords, but it is not perfect. If an attacker can get hold of the hash, they can use a 'rainbow table' - a precomputed table of hashes for common passwords - to try to find a match. To defend against this, many systems use 'salt' - a random string added to the password before hashing. This makes rainbow table attacks much more difficult, as the attacker would need a different rainbow table for each possible salt.

Hashing and digital signatures

Hashing is also used in the creation of digital signatures, which are a key part of ensuring the integrity and authenticity of digital communications. A digital signature is essentially a hash of a message that has been encrypted with a private key. Anyone with the corresponding public key can decrypt the signature, hash the message themselves, and compare the two hashes. If they match, the message is authentic and has not been tampered with.

Digital signatures are a crucial part of many cybersecurity protocols, including SSL and TLS, which secure the connections between web browsers and servers. They are also used in email encryption, secure file transfer, and many other applications.

Hashing vs. encryption

While both hashing and encryption are used to transform data, they serve different purposes and have different properties. Encryption is a two-way function; data can be encrypted and then decrypted back into its original form. Hashing, on the other hand, is a one-way function; once data has been hashed, it cannot be unhashed.

Furthermore, encryption is about maintaining confidentiality; it hides data so that only someone with the correct key can read it. Hashing, on the other hand, is about maintaining integrity; it provides a way to check that data has not been altered without detection.

When to use hashing

Hashing is used when the integrity of data is important. It is used to verify that data has not been tampered with and to securely store passwords. Hashing is also used in digital signatures to ensure the authenticity of a message. If you need to check that data has not been altered, or if you need to represent data in a way that doesn't reveal the data itself, hashing is the way to go.

However, hashing is not suitable for storing sensitive data that needs to be retrieved in its original form. Because hashing is a one-way function, once data has been hashed, it cannot be unhashed. Therefore, if you need to store data in a way that it can be retrieved later, encryption is a better choice.

When to use encryption

Encryption is used when the confidentiality of data is important. It is used to protect data from being read by anyone who does not have the correct key. Encryption is used in a wide variety of applications, from securing internet connections to protecting sensitive data stored on a computer or in the cloud.

However, encryption alone does not protect the integrity of data. An attacker could alter the encrypted data, and the changes would not be detected when the data is decrypted. Therefore, if you need to ensure the integrity of data, you should use hashing in addition to encryption.


Hashing is a fundamental concept in cybersecurity, underpinning many of the protocols and systems we rely on to secure our digital world. It provides a way to represent data in a way that doesn't reveal the data itself, and to check that data has not been altered without detection. From password storage to digital signatures, hashing plays a crucial role in keeping our digital lives secure.

While it is a complex topic, understanding hashing is essential for anyone interested in cybersecurity. By understanding how hashing works and how it is used, you can better understand the security measures that protect your data and your digital identity. So the next time you enter a password or send a secure message, you can appreciate the intricate dance of hashing that helps keep your data safe.

This post has been updated on 17-11-2023 by Sofie Meyer.

Author Sofie Meyer

About the author

Sofie Meyer is a copywriter and phishing aficionado here at Moxso. She has a master´s degree in Danish and a great interest in cybercrime, which resulted in a master thesis project on phishing.

Similar definitions

Confidentiality Distributed denial of service (DDoS) Personal digital assistant (PDA) Non-volatile memory (NVM) File transfer protocol (FTP) Digital rights management (DRM) Electronic data capture (EDC) Proof of concept (POC) Dongle Ubiquitous computing Cryptography Key fob CompuServe Request for proposal (RFP) Bespoke software