Skip to content

Expert · Deeper lab skills: passwords, privilege, Metasploit, wireless · topic 25 of 35 · 20 min

Password hashing and cracking (your own hashes only)

Explanation

Systems should store passwords as hashes, not plain text. "Cracking" means guessing the original password that produced a hash, by hashing many guesses and comparing. You practise only on hashes you created yourself, to understand why slow hashing and strong passwords matter.

Why hashes exist

A hash is a one-way fingerprint of some data: the same input always gives the same hash, but you cannot reverse the hash back into the input. Systems store the hash of your password, not the password itself, so that a database leak does not immediately reveal everyone's password.

What "cracking" really is

Because hashing is one-way, an attacker who steals hashes cannot reverse them. Instead they guess: take a candidate password, hash it, and see if it matches the stolen hash. Tools like hashcat and John the Ripper automate this at huge speed, trying dictionary words and variations. This is "cracking". It is only practised, legally and safely, on hashes you generated yourself for learning.

Think of it like this: A hash is like grinding a spice into powder: easy one way, impossible to un-grind. Cracking is grinding many spices to find which one makes the same powder. Fast grinders (fast hashes) help the attacker; a deliberately slow grinder (bcrypt/Argon2) makes guessing painfully slow.

Why slow, salted hashing wins

  • Fast hashes (like plain SHA-256) are made for speed, so attackers can try billions of guesses per second. They are wrong for storing passwords.
  • Slow hashes (bcrypt, scrypt, Argon2) are deliberately expensive, so each guess is slow and cracking becomes impractical.
  • A salt is random data added to each password before hashing, so identical passwords get different hashes and precomputed tables (rainbow tables) do not work.
  • The best defence of all is strong, unique passwords (or passphrases) plus MFA, so even a cracked hash has limited value.

Detection and defence

Cracking happens offline on stolen hashes, so it cannot be detected directly. The defences are preventive: store passwords with a slow, salted algorithm; enforce strong passwords and check them against known-breached lists; add MFA; and protect the password database so it is never stolen in the first place. Detection focuses on the theft (unusual database access) and on login abuse, not on the offline cracking itself.

Careful: Only ever crack hashes you created yourself, or that you are explicitly authorised to test. Cracking other people's hashes, or using stolen/breached hash dumps, is illegal. This topic exists to show why good password storage matters, not to attack anyone.

Need help?

Stuck on a word or an idea? Search this course, or every course, and jump straight to the explanation or a worked question.

Try:

Watch the lesson

Password hashing and cracking (your own hashes only) · 1/7

Hash = one-way fingerprint

A hash is a one-way fingerprint: same input, same hash, but not reversible.

Prefer a video by a teacher? Find free videos on “password hashing salting bcrypt vs sha256 explained” on YouTube ↗

In real life: Feeling the difference

A learner hashes the word "password" with SHA-256 and with bcrypt in her lab, on hashes she made herself. A dictionary guess against the fast SHA-256 hash is found almost instantly; the same guess against the slow bcrypt hash takes far longer per attempt. The lesson lands physically: fast hashes are wrong for passwords. She writes the fix for any app she reviews: bcrypt or Argon2, with a salt, plus MFA.

Practice (0/3 done)

Task 1 · Question

A hash is…

Task 2 · Question

Why is bcrypt better than plain SHA-256 for storing passwords?

Task 3 · Code · Python

Use Python's standard library to hash text. Write sha256_hex(text) that returns the SHA-256 hex digest of the text (encode it as UTF-8 first). Import hashlib.

Quick quiz

Question 1

1.Cracking a hash means…

Question 2

2.A salt is used to…

Question 3

3.You may practise cracking on…

Question 4

4.Even a cracked password matters less when the account has…

Read more (free)

Open a question to see the answer and why. The first ones are this topic's own quiz, so try the quiz above before you peek.

Cracking a hash means…

Answer: Hashing guesses until one matches

You cannot reverse a hash; you guess and compare.

A salt is used to…

Answer: Make identical passwords hash differently and defeat rainbow tables

A unique salt per password defeats precomputed tables.

You may practise cracking on…

Answer: Only hashes you created or are authorised to test

Only your own or explicitly authorised hashes.

Even a cracked password matters less when the account has…

Answer: Multi-factor authentication

MFA requires a second factor beyond the password.

Why is plain SHA-256 a bad password hash?Related

Answer: It is too fast, so attackers can try billions of guesses per second

Password hashes must be slow. Fast hashes let attackers test huge password lists quickly.

From Storing passwords safely

Why is a salt added before hashing passwords?Related

Answer: So identical passwords get different hashes and pre-computed tables fail

A unique random salt per user defeats rainbow tables and hides reused passwords.

From Hashing: fingerprints for data

A salt in password hashing is…Related

Answer: Extra random data so identical passwords hash differently

A salt makes each hash unique and defeats precomputed tables.

From SSRF and authentication flaws

What should a website store instead of your plain password?Related

Answer: A slow, salted password hash such as bcrypt or Argon2

A slow salted hash lets the site check your password at login without keeping the password itself.

From Project: password strength checker

Pass the quiz (60% or more) or mark this topic as done when you are ready.

Your progress is saved on this device only.

Next steps

  1. 3 more topics in “Deeper lab skills: passwords, privilege, Metasploit, wireless” before its exam: Privilege escalation concepts (labs only), Metasploit basics (in the lab), Wireless security concepts.
  2. Module 8 exam: deeper lab skills · 12 questions · 20 min, without help. 4 topics of this module still to finish first.
  3. Then the next module, Post-exploitation ethics and reporting. 35 topics left in the course before the final exam.

← Previous: SSRF and authentication flaws