Hashing meaning, in plain words

Hashing turns data into a one-way value, which protects stored passwords. What NIST and OWASP say about password hashing and salt, and how it differs from.

Written by: Mio Kanzaki(Security Analyst (AI))Reviewed by: 千葉圭介Updated

Hashing is processing that converts data into a form that cannot be reversed, and it protects passwords. The NIST glossary defines a hash function as a function that maps a string of arbitrary length to a string of fixed length. The same input always gives the same result.

How does hashing work?

Think of a fingerprint. You cannot rebuild a person's appearance from a fingerprint, but by matching a fingerprint you can tell whether it is the same person. With hashing too, you cannot take the original string back out of the result, but you can match.

At registration, the site keeps only the hash value of the password. At login, it makes a hash value from the typed string by the same calculation and compares it with the stored one. OWASP describes hashing as a one-way function and a method suited to checking passwords. Encryption can be undone, so it is limited to exceptional cases where the original password is needed.

Hashes are also used to detect tampering with data. NIST's FIPS 180-4 lists, as a use of a hash value, checking whether a message has changed since the value was made.

To store passwords, a dedicated method is used that deliberately takes effort to compute. NIST explains its aim as making each guess costly for an attacker who has got hold of the stored values. The whole picture of protection is set out in cryptographic failures. For a review of how you store passwords, contact us.

Why does hashing matter?

Prepare on the premise that a site's database may leak. If passwords are stored in plain text, everyone's can be read as they are. If they are hashed, the original string cannot be read directly from the leaked value. NIST rules that passwords be stored in a form resistant to offline attack, hashed with a salt.

Not every method is equally strong, however. For storage OWASP puts Argon2id first, then scrypt, bcrypt only for legacy systems, and PBKDF2 where compliance with a public standard is required. Hashing is a way to limit the damage after a leak, not something that prevents the leak itself. What an operator checks is this.

  • Do not store passwords in plain text or with reversible encryption.
  • Use a method made for passwords.
  • Mix in a salt before hashing.
  • Do not make your own method. Use a part with a track record.

Related terms

  • Salt: a string made at random for each password, mixed in before hashing and stored with the hash
  • Rainbow table: a precomputed table for working back from a hash value to the original string
  • Digital signature: a mark that shows a document is genuine and has not been rewritten on the way
  • Key management: the series of management that makes, protects, and replaces encryption keys

Frequently asked questions

What is the difference between hashing and encryption?

Encryption is processing that can be undone with a key. Hashing is one-way processing that cannot be undone. OWASP says to use hashing to store passwords, and to limit encryption to exceptional cases where the original password is needed.

If I hash passwords, am I fine when they leak?

Not necessarily. If the method is weak, or no salt is used, the original password may be worked out from the leaked value. NIST rules that passwords be hashed with a salt, using a method made for passwords.

Next step

Leaks caused by cryptographic failures are in cryptographic failures. The free URL check shows only what is visible from outside your member site, and for a review of how passwords are stored, contact us.

Frequently asked questions

What is the difference between hashing and encryption?

Encryption is processing that can be undone with a key. Hashing is one-way processing that cannot be undone. OWASP says to use hashing to store passwords, and to limit encryption to exceptional cases where the original password is needed.

If I hash passwords, am I fine when they leak?

Not necessarily. If the method is weak, or no salt is used, the original password may be worked out from the leaked value. NIST rules that passwords be hashed with a salt, using a method made for passwords.

See what an attacker can see, today

The free URL check returns a grade in under a minute. For costs and next steps, book a free consultation.