ADVERTISEMENT

Hashing vs encryption vs salting: what's the difference?

hashing vs encryption featured image
Paul Greenamyer
Sep 22, 2020 Updated: 14 March 2022 10 min read
TL;DR: Encryption is a reversible process, whereas hashed data cannot be decrypted. Salting is a method to make hashing more secure.

How does encryption work?

Hashing vs encryption
The AES cipher – an example of symmetric encryption.
Whatever the situation, the important thing to understand is that encryption is a reversible process.

Encryption algorithms

  • Asymmetric encryption algorithms
  • Symmetric encryption algorithms
  • Deterministic encryption algorithms
  • Probabilistic encryption algorithms

Symmetric encryption algorithms

  • Block ciphers. They encrypt bits in discrete blocks of equivalent sizes. During the encryption process, the algorithm holds data in its memory until enough data is acquired to create a block.
  • Stream ciphers. Data is encrypted as it arrives and is not stored in memory.
  • AES (Advanced Encryption Standard)
  • DES (Data Encryption Standard)
  • IDEA (International Data Encryption Algorithm)
  • Blowfish (Drop-in replacement for DES or IDEA)
  • RC4 (Rivest Cipher 4)
  • RC5 (Rivest Cipher 5)
  • RC6 (Rivest Cipher 6)

Asymmetric encryption algorithms

  • RSA
  • Diffie-Hellman
  • Elliptic-curve algorithms

Deterministic encryption algorithms

Probabilistic encryption algorithms

What is hashing?

hashing algorithm
Hashing differs significantly from encryption, however, in that it is a one-way process.

So what good is this hashed data?

ADVERTISEMENT

Hashing algorithms

  • MD5. The MD5 algorithm encodes a string of information into a 128-bit fingerprint. It’s one of the oldest and most widely-used hashing algorithms in the world, but it is also starting to show its age in the form of a high risk of hash collision.
  • SHA-2. Developed by the NSA, this cryptographic hash function builds on the older SHA-1 algorithm. Both the current algorithm and its predecessor use six hashing algorithms in 244-, 256-, 384-, or 512-bit configurations.
  • CRC32. “CRC” stands for “cyclical reduction check.” It’s a kind of code used to discover errors or changes in a data set. Mostly used in zip files or for file integrity checks, CRC32 produces the same hashed output every time it is run.
  • RipeMD. Available in multiple bit configurations with 160-bit the most popular, RipeMD is a cryptographic hashing algorithm that is used in the Bitcoin standard. Other cryptocurrencies use it as well.
  • Tiger. Tiger is a hash function invented to work with 64-bit platforms. Available in 128-bit and 160-bit configurations, Tiger has no distinguishing initializing values. It appends a byte with hexadecimal value 0x01. A variation, Tiger2, appends a byte with hexadecimal value 0x08.
  • xxHash. xxHash is a non-cryptographic hash function known for its exceptional speed, working at RAM speed limits. The most up-to-date variation, XXH3, performs exceptionally well with small data.
  • BCrypt. This hash function is designed to be slow, with the intention of making password cracking more time-consuming and discouraging cybercriminals attempting to execute quick attacks.
  • Argon2. Argon2 uses an “adaptive” hashing algorithm that can be calibrated with a “work factor,” making the hash more or less complicated.

Which algorithm creates the most secure hashes?

Avalanche effect

Hash collision

hash collision

Merkle-Damgard hash functions

Can you spot the algorithm from the hashed password?

However, most hashing algorithms produce equivalent hashes for equivalent inputs.

What is salting?

Rainbow table

Password salt

Why is salting important?

So what is the difference between hashing and encryption?

  • Encryption is a two-way process that depends on keys to unlock ciphertext and return it to its original form as readable plaintext. You can use probabilistic encryption algorithms to produce different ciphertext for each plaintext input, even if it’s identical.
  • Hashing is a repeatable process that produces the same hash whenever you enter an equivalent input into the same hashing algorithm. However, hashing is a one-way process, with no key to unlock the input in its original format.

Bottom line

ADVERTISEMENT