Cryptography

What are hash functions and what are they used for?

Easy
15 min

What are hash functions?

Cybersecurity is the practice of protecting systems, networks, and programs from digital attacks. These attacks are usually aimed at accessing, changing, or destroying sensitive information; extorting money from users; or interrupting normal business processes. Implementing effective cybersecurity measures is particularly challenging today because there are more devices than people, and attackers are becoming more innovative.

Hash functions, or in this context they can also be called cryptographic hashes, are also known by the English term "hash functions", and they are the cornerstones of digital security. They enable data to be transformed into a unique, fixed-length bit string, providing a reliable tool for ensuring data integrity, protecting passwords, and implementing digital signatures. Let's delve deeper into the characteristics and applications of cryptographic hashes.

Properties of cryptographic hashes

Cryptographic hashes are based on four basic principles:

  • One-wayness (pre-image resistance): When one-wayness works well, calculating the hash from the input is easy, but recovering the original input based on the hash is practically impossible. This feature protects information from being revealed, even if the hash falls into the hands of outsiders.
  • Collision resistance: When collision resistance is good, it is extremely unlikely that two different inputs would produce the same digest. This feature is crucial as it prevents attackers from creating another document that would produce the same digest as the original document.
  • Avalanche effect: Making even a small change to the input (e.g. changing one bit) should result in a completely different digest.
  • Speed: The hash function must be fast enough to be calculated efficiently in order to be effectively integrated into various systems and applications. On the other hand, a hash that is calculated too quickly is also easier to break!

Applications

Cryptographic hashes have found versatile uses in various corners of the digital world:

  • Password storage: Modern systems store password hashes, not the actual passwords. When a user enters their password, the system compares its hash to the stored hash. This method protects users' passwords if the database security is compromised.
  • Data integrity verification: The sender can create a digest of a file and share both the file and the digest. The receiver can then verify the integrity of the file by calculating and comparing the digest. This method is common in software downloads and updates.
  • Digital Signatures: Digital signatures use cryptographic hashes to ensure the authenticity and integrity of messages. The signer creates a hash of the message, encrypts it with their private key, and the recipient can verify the signature by decrypting it with the sender's public key.
  • Blockchains and cryptocurrencies: Blockchain technology, which is the basis of Bitcoin for example, uses cryptographic hashes to create interconnected blocks. Each block contains the hash of the previous block, creating an immutable and tamper-proof chain of blocks.

Task

Identify which of the following is not a hashing algorithm?

hakatemia pro

Ready to become an ethical hacker?
Start today.

As a member of Hakatemia you get unlimited access to Hakatemia modules, exercises and tools, and you get access to the Hakatemia Discord channel where you can ask for help from both instructors and other Hakatemia members.