Skip to main content

Security and Risk

Hashing

Hashing is one-way, which is exactly why passwords use it. If a service can show you your existing password, it has told you something important.

Definition

Hashing turns any input into a fixed-length string of characters, and it only runs in one direction. You cannot reverse a hash to recover what went in.

What It Actually Means

That one-way property is what separates hashing from encryption. Encryption is designed to be undone by whoever holds the key. Hashing is designed so that nobody can undo it, including the people who run the system.

Why Passwords Use It

When you set a password, a well-built system does not store it. It stores the hash. When you sign in, it hashes what you typed and compares the results.

The consequence is that the business cannot see your password. Not the developers, not support, not an attacker who reaches the database. What leaks in a breach is a set of hashes, which is meaningfully different from a set of passwords.

This produces a test any non-technical person can apply. If a service can email you your existing password, it is not hashing them. It is storing them in a recoverable form, which means the staff can read them and so can anyone who gets in. A password reset link is correct behaviour. A password reminder containing the password is a finding.

Not All Hashing Is Equal

Speed is a virtue in most computing and a liability here.

Fast general-purpose hashes such as MD5 and SHA-1 were widely used for passwords and are unsuitable. An attacker holding stolen hashes can try billions of guesses per second against them, so common passwords fall almost immediately. Both are also broken for other purposes and should not appear in anything current.

Password hashing needs algorithms built to be slow and memory-hungry: bcrypt, scrypt or Argon2. The delay is imperceptible for one login and ruinous for an attacker attempting to work through a stolen file.

Salt is the other half. A random value is added to each password before hashing, so identical passwords produce different hashes. Without it, an attacker cracks one and immediately knows everyone who shares it, and precomputed tables do the work for them. Any competent implementation salts automatically.

What To Ask

  • Are passwords hashed with bcrypt, scrypt or Argon2? A supplier should answer immediately. Hesitation is informative.
  • Can anyone in the business see a user’s password? The answer must be no.
  • What happens if the database leaks? With proper hashing, the passwords are not usable.

Where Else It Turns Up

Hashing is not only for passwords, and the other uses are worth recognising because they show up in ordinary conversation.

It verifies that a file has not changed, since any alteration produces a different hash. It underpins version control, where each commit is identified by a hash of its contents. It lets two systems check they hold the same data without exchanging the data itself.

In all of those the value is the same: a short fingerprint that is cheap to compare and effectively impossible to forge. Passwords are just the case where the consequences of getting it wrong arrive publicly.

More terms are in the glossary.

Portrait of Alexander De Sousa, founder of Digital Royalty
Founder-led
“I’ve put everything I know into how this company works — the standards, the method, the care on every project. It runs through the whole team, and I hold us all to it.”

Alexander De Sousa · Founder LinkedIn

Featured on BBC Radio Solent

Get started

Tell us what you need

A few quick questions, then a straight answer from a real person — usually within a few hours.

What happens next

  1. 1 We reply A real person reads your answers and gets back to you, usually within a few hours.
  2. 2 Questions or a short call If anything isn't clear, we ask by email or book a short call. Before any call we audit your website and make the quick fixes it finds, free.
  3. 3 Your fixed quote A clear, fixed price in writing, within 48 hours of any call. There is no obligation to go ahead.

Tell us what you're working on

Whether it's a new site, a platform, or a process that shouldn't be manual any more — we'll tell you honestly if we can help.