Encryption vs. Hashing vs. Salting - What’s the Difference? (2024)

Mar 1, 2022

-minute read

Encryption vs. Hashing vs. Salting - What’s the Difference? (1)

Andrew Hughes

  • Identity Security

Encryption and hashing are foundational concepts in computing for any type of “secret,” but you might not notice how prevalent they are. For the purpose of this blog, we’ll focus on encryption, hashing and salting for passwords. Passwords are the least secure method of logon authentication, but are still widely used. Bad actors can exploit compromised credentials for data breaches, account takeover fraud, ransomware and other criminal activities.

Read about best practices for enterprise deployments of adaptiveMFA.

Encryption, hashing, and salting only secure the password itself. Learn how MFA can protect against a variety of attacks and provide greater security for your users.

Get the White paper Get the White paper

Encryption vs. Hashing vs. Salting - What’s the Difference? (2)

Hashing and encryption are both ways to keep data safe, but have different functions. Password encryption is used when the plaintext must be recovered for any reason. Password hashing is typical on the server side when the server operators don't need to know the plaintext, they just need to demonstrate that the user knows the plaintext. These functions take place in the background, as does salting, without adding friction to the user experience.

Enterprises that must use passwords should always use proven cryptographic tools for keeping passwords safe rather than trying to build their own from scratch. Read on to learn more about encryption, hashing and salting and how they are used.

What is Encryption?

Encryption is a method for securing a password (plaintext) by converting it, using a mathematical formula, into a scrambled version (ciphertext). Encryption is a two-way function, meaning the original plaintext password that is encrypted into ciphertext can be returned to plaintext by decrypting it. Some authentication systems still require reversible passwords. Anyone with the correct cryptographic key can take ciphertext and reverse it to reveal plaintext passwords, making them less secure. Protecting cryptographic keys is essential, since a bad actor with the key can unlock the encryption to recover passwords. A hardware security module (HSM) can perform core cryptographic operations and store keys in a way that prevents them from being extracted from the HSM.

Encryption can play an important role in password storage, and numerous cryptographic algorithms and techniques are available. For example, password managers use encryption to safeguard the confidentiality of the stored secrets. When a password is needed by a user, the password manager decrypts the ciphertext and inserts the plaintext password into the web browser form because plaintext is the only format the browser allows.

Hashing also uses an algorithm to transform a plaintext password into ciphertext that obscures the actual password. Unlike encryption, hashing is a one-way function. If you take an arbitrary plaintext password of any length, run it through a hashing algorithm, it spits out a string or hexadecimal number that is unique to the supplied plaintext. The length is dependent on the algorithm used. Hashes of passwords cannot be transformed back to the original plaintext password.

The server stores a hashed version of the password. When the user types in a plaintext password, the system calculates the hash and compares the hashes. If the hashes are equal, the server is able to confirm the password and the user is given access.

Common Hashing Algorithms

Less secure hash algorithms:

  • Message-digest algorithm 5 (MD5) takes a message of any length as input and converts it to an output of a fixed 128-bit hash value length to be used for authenticating the original message.

  • Secure hash algorithm (SHA) is also a cryptographic hash function. SHA-1's 160-bit values are more secure than MD5's 128-bit hash value lengths, but it also has weaknesses, which led to the SHA-2 hash code family.

More secure hash algorithms:

  • SHA-2 hash code family is widely used today, with algorithms that are longer and harder to break. The names of SHA-2 algorithms are connected to length, so SHA-224 represents 224 bits in length. The same format works for SHA-256, SHA-384 and SHA-512.

What is Salting?

Just as you add salt to enhance your food, a random string of characters (salt) is added to passwords to enhance them. Each user is assigned a different salt, which is only known to the server, making them unique and more secure. The salt can be placed on either side of the password. For example, adding salt to the password "Password" could result in a salted password like "4(j3Li95Password" or "Password4(j3Li95." After the salt is added, the combination of plaintext password and salt is then hashed, making it more secure than a hashed password alone.

Combining Salting and Hashing for Security

Password hashing makes storage and management more secure, and applies to both salted and unsalted passwords. Salted passwords that are also hashed make it harder for bad actors to crack passwords at scale. Because random characters are added to passwords prior to hashing, the hacker loses the ability to quickly figure out the plaintext password. Without guessing, it's almost impossible to take the output of a hash function and reverse it to find out the original value. The unique hash created with salted passwords defends against attack vectors, including dictionary, brute force and hash table attacks.

Let's say a hacker wants to test a password. The hacker first has to steal the server file containing hashed passwords. An experienced hacker will have already taken commonly used passwords, dictionary entries and passwords found on the dark web, run them through standard hash algorithms and put the results in a table. A hash table is a pre-calculated database of hashes and a rainbow table is a pre-calculated table of reversed hashes used to decipher password hashes. The hacker searches the server file for matches in the pre-calculated hashes on their rainbow table. Because the rainbow table was created from all the possible plaintexts, they now know that user's password. The hacker will be able to access the user's account unless other security measures, like multi-factor authentication (MFA), are in place.

A hacker with pre-calculated tables based on typical passwords will be unable to easily figure out salted passwords because random extra characters have been added. The hacker will be forced to try millions of hashed password-salt combinations in order to uncover passwords. Just as a car thief will skip difficult break-ins to find an unlocked car with the keys in the ignition, the hacker will move on to less secure targets.

Recap: Encryption vs. Hashing vs. Salting

Password encryption is used when the plaintext must be recovered for any reason. Encryption is a reversible method of converting plaintext passwords to ciphertext, and you can return to the original plaintext with a decryption key. Encryption is often used for storing passwords in password managers.

Password hashing is useful on the server side when server operators don't need to know the plaintext, only that the user knows the plaintext. Hashing is a one-way process that converts a password to ciphertext using hash algorithms. A hashed password cannot be decrypted, but a hacker can try to reverse engineer it.

Password salting adds random characters before or after a password prior to hashing to obfuscate the actual password. Because of the randomness of the salt, hackers have a very difficult time figuring out actual passwords from hashed salted passwords because their pre-calculated tables of passwords won't work.

Passwords alone are not sufficient for identity and access management (IAM) and need to be reinforced with other authentication methods. To learn more about multi-factor authentication (MFA), read our white paper on the Best Practices for Securing the Modern Digital Enterprise.

Share this Article:

Related Resources

Ping Leadership Predicts the 2024 Global Identity Landscape Dustin Maxey Dec 28, 2023 Explore the Ping Leadership team’s insights into the evolving identity landscape in 2024.
Ping Identity Positioned in the 2023 Critical Capabilities Report Dustin Maxey Dec 1, 2023 Ping Identity was positioned among the highest-ranked two vendors in all four Use Cases in the 2023 Gartner Critical Capabilities report.
Encryption vs. Hashing vs. Salting - What’s the Difference? (2024)

FAQs

Encryption vs. Hashing vs. Salting - What’s the Difference? ›

These techniques share a common purpose. But there are several differences between them as well. Encryption is about encoding data accessible with a key; hashing is about irreversible calculations. In salting, we add random data to the main information and make it more secure for storage.

What is the difference between encryption and hashing and salting? ›

Encryption is a two-way function where information is scrambled in such a way that it can be unscrambled later. Hashing is a one-way function where data is mapped to a fixed-length value. Hashing is primarily used for authentication.

What is the most important difference between hashing and encryption is that hashing? ›

Basically, encryption is the process of scrambling plaintext into unreadable ciphertext, which you can decrypt with a relevant key, while hashing turns plain text into a unique code, which can't be reverted into a readable form.

What is the difference between hashed and salt? ›

Hashing is a one-way process that converts a password to ciphertext using hash algorithms. A hashed password cannot be decrypted, but a hacker can try to reverse engineer it. Password salting adds random characters before or after a password prior to hashing to obfuscate the actual password.

Is salting considered encryption? ›

The salt and the password (or its version after key stretching) are concatenated and fed to a cryptographic hash function, and the output hash value is then stored with the salt in a database. The salt does not need to be encrypted, because knowing the salt would not help the attacker.

Should passwords be hashed or encrypted? ›

Hashing and encryption can keep sensitive data safe, but in almost all circ*mstances, passwords should be hashed, NOT encrypted. Because hashing is a one-way function (i.e., it is impossible to "decrypt" a hash and obtain the original plaintext value), it is the most appropriate approach for password validation.

What is an example of hashing? ›

This method involves multiplying the key by a constant and taking the fractional part of the product as the hash value. For example, if the key is 23 and the constant is 0.618, the hash value would be 2 (floor(10*(0.61823 - floor(0.61823))) = floor(2.236) = 2).

Can a hash be decrypted? ›

No, hashed data cannot be decrypted. Hashing is a one-way process, which means that the original data cannot be obtained from the hash value. It is designed to be irreversible, making it suitable for storing passwords and verifying data integrity.

What is encryption vs hashing vs encoding? ›

Encoding is a technique where the data is transformed from one form to another. Hashing is a technique where the data is converted to hash using different algorithms present there. Encryption is a technique used for protecting the confidentiality of the data. Encryption is used for preserving the usability of the data.

Does hashing require a key? ›

A hash function is a cryptographic algorithm which is used to transform large random size data to small fixed size data. The data output of the hash algorithm is called hash value or digest. The basic operation of hash functions does not need any key and operate in a one-way manner.

What is the secret of hashing salt? ›

Password hash salting is when random data – a salt – is used as an additional input to a hash function that hashes a password. The goal of salting is to defend against dictionary attacks or attacks against hashed passwords using a rainbow table.

Why is it called salt in hashing? ›

Salting hashes sounds like one of the steps of a hash browns recipe, but in cryptography, the expression refers to adding random data to the input of a hash function to guarantee a unique output, the hash, even when the inputs are the same.

Why is it more secure to salt hashes? ›

Attackers use many tools to crack password hashes. This is because hash tables are designed to be fast but are not necessarily secure. By adding randomness to the original plaintext password value before hashing, salting ensures that a different hashed value is generated.

Which is better, hashing or encryption? ›

Hashing vs Encryption – Hashing refers to permanent data conversion into message digest while encryption works in two ways, which can encode and decode the data. Hashing helps protect the integrity of the information and Encryption is used to secure the data from the reach of third parties.

What is more secure than encryption? ›

Since encryption is two-way, the data can be decrypted so it is readable again. Hashing, on the other hand, is one-way, meaning the plaintext is scrambled into a unique digest, through the use of a salt, that cannot be decrypted.

Which is more secure, SSL or HTTPS? ›

SSL cannot be used all alone for a particular website. It is combined with HTTP protocol then used for encryption. HTTPS is more secure and it is the latest version of the HTTP protocol which has been available to date. SSL is discontinued and now TLS (transport layer security) is used in its place.

What's the difference between hashing encoding and encrypting? ›

Encoding is a technique where the data is transformed from one form to another. Hashing is a technique where the data is converted to hash using different algorithms present there. Encryption is a technique used for protecting the confidentiality of the data. Encryption is used for preserving the usability of the data.

What is the difference between hashing and signing and encryption? ›

In summary, encryption protects data confidentiality, hashing verifies data integrity, and digital signatures authenticate the sender and the integrity of the message or document.

What is the difference between hashing and encryption and tokenization? ›

Tokenization replaces sensitive data with a token, or randomly generated number, which has no value outside the system. Encryption uses algorithms to encode data so that authorized users can only decode it. Hashing is a one-way function that converts data into a fixed-length string of characters.

What is the difference between hashing and encryption quizlet? ›

Encryption involves key(s), and "encrypting" something implies you want to have a way to reverse that (decrypt) so that you can retrieve the original information. Hashing is different. Hashing does not involve any secret (e.g., key), and it is one-way (i.e., you cannot retrieve the input message from the hash digest).

Top Articles
The 39 Best Apps for Real Estate Agents (Including 2 to Watch) in 2024
Debt-Free With 3 Rentals (in 3 Years!)
Diario Las Americas Rentas Hialeah
Dte Outage Map Woodhaven
Live Basketball Scores Flashscore
Ymca Sammamish Class Schedule
Chelsea player who left on a free is now worth more than Palmer & Caicedo
Notary Ups Hours
Lowes 385
Best Restaurants Ventnor
Slag bij Plataeae tussen de Grieken en de Perzen
Transfer Credits Uncc
Learn2Serve Tabc Answers
Define Percosivism
Sadie Proposal Ideas
Stardew Expanded Wiki
Officialmilarosee
Gayla Glenn Harris County Texas Update
Our History
Reborn Rich Kissasian
Village
Bennington County Criminal Court Calendar
Airtable Concatenate
Plost Dental
Geico Car Insurance Review 2024
Horses For Sale In Tn Craigslist
Nearest Ups Ground Drop Off
Angel Haynes Dropbox
Tottenham Blog Aggregator
Roseann Marie Messina · 15800 Detroit Ave, Suite D, Lakewood, OH 44107-3748 · Lay Midwife
CohhCarnage - Twitch Streamer Profile & Bio - TopTwitchStreamers
Franklin Villafuerte Osorio
Does Circle K Sell Elf Bars
Bimmerpost version for Porsche forum?
Game8 Silver Wolf
Planet Fitness Santa Clarita Photos
What Does Code 898 Mean On Irs Transcript
Conroe Isd Sign In
Daly City Building Division
Cygenoth
Improving curriculum alignment and achieving learning goals by making the curriculum visible | Semantic Scholar
Sun Tracker Pontoon Wiring Diagram
Luvsquad-Links
Tableaux, mobilier et objets d'art
Lesson 5 Homework 4.5 Answer Key
Pronósticos Gulfstream Park Nicoletti
Fresno Craglist
David Turner Evangelist Net Worth
Craigslist Monterrey Ca
The Ultimate Guide To 5 Movierulz. Com: Exploring The World Of Online Movies
Latest Posts
Article information

Author: Jeremiah Abshire

Last Updated:

Views: 6218

Rating: 4.3 / 5 (54 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Jeremiah Abshire

Birthday: 1993-09-14

Address: Apt. 425 92748 Jannie Centers, Port Nikitaville, VT 82110

Phone: +8096210939894

Job: Lead Healthcare Manager

Hobby: Watching movies, Watching movies, Knapping, LARPing, Coffee roasting, Lacemaking, Gaming

Introduction: My name is Jeremiah Abshire, I am a outstanding, kind, clever, hilarious, curious, hilarious, outstanding person who loves writing and wants to share my knowledge and understanding with you.