Domain 4PrivEsc & Password AttacksCORE

Password Hashing Algorithms

Comprehensive guide to password hashing algorithms including legacy cryptographic hashes (MD5, SHA), Windows-specific hashes (LM, NTLM, NTLMv2), modern password hashing (bcrypt, scrypt, Argon2, PBKDF2), common hash formats, and hash identification techniques.

Domain: Domain 4: Privilege Escalation & Password Attacks•Updated: 2026-09-01
#hashing#cryptographic-hashes#ntlm#bcrypt#argon2

Password Hashing Algorithms

Module 12, Section 1 — Understanding the cryptographic foundations of password storage is prerequisite knowledge for every password attack in the OSCP exam. If you cannot identify a hash type, you cannot crack it.


Table of Contents

  1. Overview of Password Hashing
  2. Cryptographic Hash Functions (Legacy)
  3. Windows-Specific Hashes
  4. Modern Password Hashing
  5. Common Hash Formats
  6. Hash Identification

1. Overview of Password Hashing

1.1 What Is a Password Hash?

Password hashing is the process of converting a plaintext password into a fixed-length string (the hash) using a mathematical function. This hash is what gets stored in databases, system files, and credential stores — never the plaintext password itself (in properly designed systems).

Plaintext Password  →  Hash Function  →  Fixed-Length Hash
    "password"           MD5()           5f4dcc3b5aa765d61d8327deb882cf99

1.2 Core Properties of a Good Hash Function

A well-designed hash function exhibits the following properties:

Property Description Why It Matters
One-way (Pre-image resistance) Given a hash, it is computationally infeasible to recover the original input Prevents direct reversal of stored hashes
Deterministic The same input always produces the same output Enables authentication — the system can re-hash the supplied password and compare
Avalanche effect A tiny change in input produces a drastically different output Prevents pattern recognition and partial guessing
Fixed output length Regardless of input size, the output is always the same length Provides predictable storage and comparison
Fast to compute (legacy) or intentionally slow (modern) Legacy: speed was a feature; Modern: slowness is a security feature Determines crackability — fast = easy GPU cracking, slow = resistant

1.3 Security Enhancements: Salt, Key Stretching, and Work Factor

Raw hash functions alone are not sufficient for password storage. Three mechanisms address their weaknesses:

Salt

A salt is random data appended (or prepended) to the password before hashing.

Hash = H(salt + password)

Why salt matters:

  • Defeats rainbow tables: Each password gets a unique salt, so pre-computed tables become useless. An attacker would need a separate rainbow table for every possible salt value.
  • Prevents identical passwords from producing identical hashes: Two users with the password password123 will have different hashes if their salts differ.
  • Typical salt size: 128 bits (16 bytes) is considered secure.
User A:  salt = "a3f8b2c1" + password = "Summer2024" → hash = e4d2a1...
User B:  salt = "9x7k2m4p" + password = "Summer2024" → hash = f8c3b7...

Key Stretching (Iterations)

Key stretching applies the hash function repeatedly to increase the computational cost:

Hash = H(H(H(...H(salt + password)...)))   [N iterations]
  • Each additional iteration multiplies the attacker’s cracking time.
  • 10,000 iterations means the attacker must perform 10,000× more work per guess.
  • Used by PBKDF2, Drupal SHA-512, and many custom implementations.

Work Factor (Cost Factor)

A work factor is a parameter that controls the algorithm’s computational intensity. Unlike fixed iteration counts, a work factor is typically exponential:

  • bcrypt uses a cost factor C where the work is 2^C iterations.
  • Cost 10 = 1,024 iterations; Cost 12 = 4,096 iterations; Cost 14 = 16,384 iterations.
  • This allows the security level to be increased over time simply by raising the number, without changing the algorithm.

1.4 The Password Hashing Evolution Timeline

1970s-1990s  →  Unix DES crypt (4,096 iterations, 8-bit salt)
1991         →  MD5 introduced (fast, general-purpose)
1995         →  SHA-1 introduced (NSA, 160-bit)
1999         →  bcrypt introduced (Blowfish-based, designed for passwords)
2001         →  SHA-2 family (SHA-256, SHA-512)
2004         →  MD5 collision attack demonstrated (Chen et al.)
2004         →  PBKDF2 standardized (PKCS #5 v2.0)
2009         →  scrypt introduced (memory-hard)
2017         →  SHAttered — first practical SHA-1 collision
2015         →  Argon2 wins Password Hashing Competition
Present      →  Argon2id recommended as the gold standard

OSCP Exam Tip: You will not be asked to crack bcrypt, scrypt, or Argon2 during the exam. These are considered secure. However, you must be able to identify them and understand why they resist cracking. Focus your cracking efforts on MD5, SHA-1, NTLM, and unsalted variants.


2. Cryptographic Hash Functions (Legacy)

2.1 Why These Are NOT Password-Safe

The following hash functions were designed as general-purpose cryptographic primitives, not as password hashing functions. They share critical weaknesses for password storage:

  1. Extremely fast — Modern GPUs can compute billions of hashes per second.
  2. No built-in salt — The salt (if any) must be added externally.
  3. No key stretching — Single-pass computation.
  4. Vulnerable to rainbow tables — Unsalted hashes can be looked up instantly.

2.2 MD5 (Message Digest 5)

Design: Created by Ron Rivest in 1992. Produces a 128-bit (32 hex character) digest.

Internal Structure: Uses the Merkle-Damgård construction:

  • Input is padded and split into 512-bit blocks.
  • Each block is processed through a compression function.
  • The output of one block becomes part of the input to the next.
  • Four rounds of processing with non-linear functions (F, G, H, I).
Input Message
    ↓ (pad to multiple of 512 bits)
[Block 1] → [Block 2] → ... → [Block N]
    ↓            ↓                 ↓
 Compression  Compression     Compression
    ↓            ↓                 ↓
  Initial    Block 1        Block N-1
  Vector     Output         Output → Final 128-bit Hash

Collision Attacks:

  • 2004: Xiaoyun Chen et al. demonstrated theoretical collision attacks.
  • 2007: Practical collision generation demonstrated — two different inputs producing the same MD5 hash.
  • 2009: MD5 Collision Demo project showed two different PDF files with the same MD5 but different SSL certificates.
  • 2017: Google’s FLOP project generated collisions on GPU clusters in minutes.

GPU Cracking Speed: ~100-300 GH/s (gigahashes per second) on a modern RTX 4090.

# Compute MD5 of a password
echo -n "password" | md5sum
# Output: 5f4dcc3b5aa765d61d8327deb882cf99

# Hashcat modes for MD5 variants
hashcat -m 0    hashes.txt wordlist.txt    # MD5 (raw hash)
hashcat -m 10   hashes.txt wordlist.txt    # MD5($pass.$salt)
hashcat -m 20   hashes.txt wordlist.txt    # MD5($salt.$pass)
hashcat -m 100  hashes.txt wordlist.txt    # MD5($pass) — password as input
hashcat -m 110  hashes.txt wordlist.txt    # MD5($salt.$pass) — salt first
hashcat -m 200  hashes.txt wordlist.txt    # MD5($pass.$salt) — salt last
hashcat -m 300  hashes.txt wordlist.txt    # MD5($salt.$pass.$salt)

2.3 SHA-1 (Secure Hash Algorithm 1)

Design: Created by the NSA in 1995. Produces a 160-bit (40 hex character) digest.

The SHAttered Attack (2017):

  • Researchers from Google and CWI Amsterdam produced the first practical collision.
  • Two different PDF files with the same SHA-1 hash were generated.
  • Required approximately 6,500 CPU years and 250 GPU years of computation.
  • While not a direct password-cracking attack, it proved SHA-1 is cryptographically broken.
# Compute SHA-1
echo -n "password" | sha1sum
# Output: 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8

# Hashcat modes
hashcat -m 10   hashes.txt wordlist.txt    # SHA-1 (raw)
hashcat -m 110  hashes.txt wordlist.txt    # SHA-1($pass.$salt)
hashcat -m 120  hashes.txt wordlist.txt    # SHA-1($salt.$pass)
hashcat -m 100  hashes.txt wordlist.txt    # SHA-1($pass)

2.4 SHA-256 and SHA-512

Design: Part of the SHA-2 family, published by NIST in 2001. No known practical attacks as of 2026.

Algorithm Output Size Internal Word Size Rounds
SHA-256 256-bit (64 hex) 32-bit 64
SHA-512 512-bit (128 hex) 64-bit 80

Why they are NOT password-safe despite being “secure”:

The issue is not cryptographic weakness — it is speed. SHA-256 can be computed at billions of guesses per second on modern GPUs. A 10-character lowercase password has 256 billion combinations — crackable in minutes on a single GPU.

# Compute SHA-256
echo -n "password" | sha256sum
# Output: 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8

# Hashcat modes
hashcat -m 1400 hashes.txt wordlist.txt    # SHA-256
hashcat -m 1700 hashes.txt wordlist.txt    # SHA-512
hashcat -m 1410 hashes.txt wordlist.txt    # SHA-256($salt.$pass)
hashcat -m 1710 hashes.txt wordlist.txt    # SHA-512($salt.$pass)

2.5 GPU Cracking Speed Comparison

Algorithm RTX 4090 Speed 8-char lowercase time 10-char lowercase time
MD5 ~250 GH/s ~1 second ~4 minutes
SHA-1 ~200 GH/s ~1 second ~5 minutes
SHA-256 ~150 GH/s ~1.5 seconds ~7 minutes
NTLM ~200 GH/s ~1 second ~5 minutes
bcrypt (cost 10) ~4,000 H/s ~3 years ~800 years
Argon2id ~500 H/s ~250 years ~60,000 years

OSCP Exam Tip: When you encounter a hash during the exam, the first decision is: can I crack this in a reasonable time? MD5, SHA-1, SHA-256, and NTLM of short passwords are crackable. bcrypt and Argon2 are not. Always try a quick online lookup (hashes.com, CrackStation) before launching Hashcat — many common passwords are already in databases.


3. Windows-Specific Hashes

3.1 LM Hash (LAN Manager)

The LM hash is one of the weakest password hashing mechanisms ever deployed at enterprise scale. Understanding its weaknesses is essential for the OSCP exam.

Exact Algorithm

The LM hash algorithm processes a password through the following steps:

Step 1: Convert password to uppercase
        "Hello123" → "HELLO123"

Step 2: Truncate or pad to exactly 14 characters
        "HELLO123" → "HELLO123" (8 chars, needs padding)
        "HELLO123" → "HELLO123\x00\x00\x00\x00\x00\x00" (padded with null bytes)

Step 3: Split into two 7-byte halves
        Left:  "HELLO12"
        Right: "3\x00\x00\x00\x00\x00\x00"

Step 4: Create two DES keys from each half
        Each 7-byte chunk is expanded to a 7-byte DES key
        (parity bits added to each byte to make 8 bytes)

Step 5: Encrypt a fixed string with each key
        Plaintext: "KGS!@#$%" (ASCII: 0x4B47532140232425)
        Left Hash  = DES_Encrypt("KGS!@#$%", LeftKey)
        Right Hash = DES_Encrypt("KGS!@#$%", RightKey)

Step 6: Concatenate the two 8-byte DES ciphertexts
        LM Hash = LeftHash (8 bytes) + RightHash (8 bytes)
        = 16 bytes = 32 hex characters

Why LM Is Trivially Broken

Weakness Impact
Uppercase conversion Reduces character space from 95 printable ASCII to just 26 uppercase letters
14-character truncation Passwords longer than 14 chars lose information — “Password123!@#$%” and “Password123!@#%^” produce the same hash
7-byte split Each half is cracked independently — effectively two 7-character passwords instead of one 14-character password
DES encryption DES is fast and well-understood; brute-forcing a 7-byte DES key takes seconds on modern hardware
No salt Identical password halves always produce identical hash halves — rainbow tables work perfectly
Null padding Passwords shorter than 14 chars have predictable right halves

Cracking time: A full LM hash can be cracked in seconds on any modern system.

The Static LM Hash for Modern Accounts

On Windows 8 and later (and Windows Server 2012+), LM hashing is disabled by default. When LM is disabled, Windows stores a fixed value for the LM hash field:

aad3b435b51404eeaad3b435b51404ee

This is not the hash of an empty password — it is a sentinel value indicating “LM hash not stored.” However, if you encounter this value for a local account on an older system, it does represent a blank password.

OSCP Exam Tip: When you dump SAM hashes and see aad3b435b51404eeaad3b435b51404ee in the LM field, the account either has LM disabled (ignore) or has a blank password (worth trying). Focus your cracking effort on the NTLM half.

3.2 NTLM Hash (NT LAN Manager)

NTLM was introduced to address LM’s weaknesses. It is significantly stronger but still has vulnerabilities.

Exact Algorithm

NTLM Hash = MD4(UTF-16LE(password))

That’s it. The NTLM hash is simply the MD4 hash of the password encoded in UTF-16 Little Endian.

Password: "Hello123"
UTF-16LE: 48 00 65 00 6C 00 6C 00 6F 00 31 00 32 00 33 00
MD4 of above → 60a8e4a8b6e2b4e2b5e3f5c7d9a1b3c5 (example)

Key properties:

Property Detail
Algorithm MD4 (not MD5!)
Input encoding UTF-16 Little Endian
Case sensitivity Preserves case (unlike LM)
Length limit No truncation (unlike LM)
Salt None
Output 128-bit (32 hex characters)

Weaknesses:

  • No salt → Rainbow tables are effective.
  • MD4 is broken → Collision attacks exist; GPU cracking is extremely fast (~200 GH/s).
  • Single-pass → No key stretching.
# Hashcat mode for NTLM (and combined LM:NTLM)
hashcat -m 1000 hashes.txt rockyou.txt

# Benchmark NTLM cracking speed
hashcat -m 1000 -b

# Crack with rules
hashcat -m 1000 -a 0 hashes.txt rockyou.txt -r rules/best64.rule

3.3 NTLMv2 (Challenge-Response Protocol)

NTLMv2 is not a hash stored in the SAM database. It is an authentication protocol that uses the NTLM hash as a key in a challenge-response mechanism.

How NTLMv2 Authentication Works

Client                          Server
  |                               |
  |  ←── Negotiate ──────────  |
  |                               |
  |  ──→ Authenticate ────────→  |
  |    (contains response)        |
  |                               |
  |  ←── Accept/Reject ─────────  |

The response is computed as:

Response = HMAC_MD5(NTLM_Hash, Client_Challenge + Server_Challenge + ...)

Where:

  • NTLM_Hash is the MD4(UTF-16LE(password)) — the same NTLM hash stored in SAM.
  • HMAC_MD5 provides keyed hashing with the NTLM hash as the key.
  • The challenge includes timestamps, client state, and server state.

Hashcat mode: 5600 (NTLMv2 — typically captured from network traffic or authentication logs)

# Crack NTLMv2 response
hashcat -m 5600 ntlmv2_responses.txt rockyou.txt

OSCP Exam Tip: NTLMv2 responses are captured during network authentication (e.g., using Responder, Inveigh, or from SMB traffic). The hash format looks like: username::Microsoft:0101000000000000:... — the long hex string after Microsoft: contains the challenge-response data.

3.4 The LM:NTLM Format

When hashes are extracted from Windows SAM or NTDS.dit, they appear in the following format:

username:rid:lm_hash:ntlm_hash:::

Example:

Administrator:500:aad3b435b51404eeaad3b435b51404ee:5835048ce94ad0564e29a924a03510ef:::
jsmith:1001:aad3b435b51404eeaad3b435b51404ee:d8e4f5a3b2c1d0e9f8a7b6c5d4e3f2a1:::
guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::

Field breakdown:

Field Description
username Account name
rid Relative Identifier (500 = Administrator, 501 = Guest)
lm_hash 32 hex chars (or the static disabled value)
ntlm_hash 32 hex chars — the actual target for cracking
::: Empty fields (used by some tools for additional data)

When you see aad3b435b51404eeaad3b435b51404ee in the LM field:

  • On Windows 8+/Server 2012+: LM is disabled — this is normal, ignore the LM half.
  • On older systems: The account may have a blank password — the NTLM hash 31d6cfe0d16ae931b73c59d7e0c089c0 is the hash of an empty string.

OSCP Exam Tip: The RID is your friend. RID 500 is always the built-in Administrator. RID 501 is Guest. RIDs ≥ 1000 are typically user-created accounts. When dumping NTDS.dit, focus on RIDs 500, 501, and any account with a non-default NTLM hash.


4. Modern Password Hashing

4.1 bcrypt

Origin: Created by Niels Provos and David Mazieres in 1999. Based on the Blowfish block cipher.

How bcrypt Works

bcrypt uses Blowfish’s Eksblowfish (Expanded Blowfish) key schedule, which is intentionally expensive:

  1. A 128-bit salt is generated (or provided).
  2. The Blowfish key schedule runs 2^cost times, mixing the password and salt into the state.
  3. The string “OrpheanBeholderScryDoubt” (22 bytes) is encrypted 64 times.
  4. The final state (salt + modified key schedule + ciphertext) is encoded in Base64.
bcrypt(password, salt, cost) = {
    state = EF_expand(key=salt + password, rounds=2^cost)
    for i in 1..64:
        state = EEF_crypt_ecb(state, "OrpheanBeholderScryDoubt")
    return encode(cost, salt, state)
}

bcrypt Output Format

$2b$12$LJ3m4ys3LgBsTsqA2wN5F.vZVp8JqKjH3K5xR9mN2bP4cD6eF8gHi
^  ^  ^--------------------------------^ ^--------------------------^
|  |              22-char salt (128-bit)   |       31-char hash       |
|  Cost factor (12) → 2^12 = 4,096 rounds
Algorithm identifier ($2b$)

Algorithm identifier variants:

Prefix Meaning
$2a$ Original bcrypt (OpenBSD)
$2b$ Fixed handling of characters ≥ 127 (current standard)
$2y$ PHP-specific variant (same as $2b$)

Cost Factor Impact

Cost Iterations (2^C) Time per hash (CPU) GPU Cracking Speed
4 16 ~0.001s ~500,000 H/s
8 256 ~0.016s ~30,000 H/s
10 1,024 ~0.064s ~8,000 H/s
12 4,096 ~0.256s ~2,000 H/s
14 16,384 ~1.024s ~500 H/s
# Hashcat mode for bcrypt
hashcat -m 3200 bcrypt_hashes.txt rockyou.txt

# Generate a bcrypt hash (Python)
python3 -c "import bcrypt; print(bcrypt.hashpw(b'password', bcrypt.gensalt(rounds=12)).decode())"

# Verify a bcrypt hash
python3 -c "import bcrypt; print(bcrypt.checkpw(b'password', b'\$2b\$12\$...'))"

4.2 scrypt

Origin: Designed by Colin Percival in 2009 for the Tarsnap backup service.

How scrypt Works

scrypt is a memory-hard function — it requires large amounts of memory to compute, making GPU and ASIC attacks impractical.

Parameters:

Parameter Name Description
N CPU/Memory cost Must be a power of 2. Controls memory and CPU usage. Typical: 2^14 to 2^20.
r Block size (parallelization) Controls the size of each memory block. Typical: 8-16.
p Parallelization Number of parallel streams. Typical: 1-4.

Memory requirement: 128 × N × r × p bytes.

scrypt(password, salt, N=16384, r=8, p=1)
Memory needed = 128 × 16384 × 8 × 1 = 16 MB per invocation

Why memory-hardness matters:

  • GPUs have limited memory per core. A GPU with 24 GB VRAM running 2,000 threads gets only ~12 KB per thread.
  • If scrypt requires 16 MB per thread, the GPU can only run ~1,500 threads — a massive reduction in parallelism.
  • ASICs would need expensive on-chip memory, destroying the cost advantage.
# Hashcat mode for scrypt
hashcat -m 8900 scrypt_hashes.txt rockyou.txt

# scrypt format
$7$log2N$r$p$salt$hash

4.3 Argon2

Origin: Winner of the 2015 Password Hashing Competition (PHC), designed by Alex Biryukov, Daniel Dinu, and Dmitry Khovratovich.

Three Variants

Variant Optimized Against Best For
Argon2i Side-channel attacks (cache timing) Environments where side-channel is the primary threat
Argon2d GPU cracking (data-dependent memory access) Environments where GPU cracking is the primary threat
Argon2id Both (hybrid) General purpose — recommended default

How Argon2id works:

  • Combines the data-independent access pattern of Argon2i (first quarter of passes) with the data-dependent pattern of Argon2d (remaining passes).
  • This provides resistance against both side-channel attacks and GPU cracking.

Parameters:

Parameter Typical Value Description
m (memory) 65536 (64 MB) Memory cost in KiB
t (time) 3 Number of iterations (passes)
p (parallelism) 4 Number of parallel lanes (threads)

Output format:

$argon2id$v=19$m=65536,t=3,p=4$c29tZXNhbHQ$RdescudvJCsgt3ub+b+daw
^      ^  ^    ^     ^    ^    ^ ^----------^ ^------------------^
|      |  |    |     |    |    |   12-char salt     32-byte hash
|      |  |    |     |    |    Version 19
|      |  |     Time cost (3 passes)
|      |  Memory cost (65536 KiB = 64 MB)
|      Parallelism (4 lanes)
Variant (id = hybrid)
Algorithm (argon2)
# Hashcat modes for Argon2
hashcat -m 15100 argon2id_hashes.txt rockyou.txt    # Argon2id (most common)
hashcat -m 15200 argon2i_hashes.txt rockyou.txt     # Argon2i
hashcat -m 15300 argon2d_hashes.txt rockyou.txt     # Argon2d

OSCP Exam Tip: Argon2 is essentially uncrackable during an exam. If you encounter an Argon2 hash, it is almost certainly a distractor or belongs to a system you cannot compromise through password cracking. Focus your time on NTLM, MD5, and SHA hashes.

4.4 PBKDF2 (Password-Based Key Derivation Function 2)

Origin: Defined in PKCS #5 v2.0 (RFC 2898), published in 2000.

How PBKDF2 Works

PBKDF2 applies a pseudorandom function (usually HMAC) repeatedly:

DK = PBKDF2(PRF, Password, Salt, c, dkLen)

Where:
  PRF  = Pseudorandom function (HMAC-SHA1, HMAC-SHA256, etc.)
  c    = Iteration count
  dkLen = Desired key length in bytes

Algorithm:
  U1 = PRF(Password, Salt || INT_32_BE(1))
  U2 = PRF(Password, U1)
  U3 = PRF(Password, U2)
  ...
  Uc = PRF(Password, Uc-1)

  DK = U1 XOR U2 XOR U3 XOR ... XOR Uc

Common variants and Hashcat modes:

Variant Hashcat Mode Common Use
PBKDF2-HMAC-SHA1 1100 WPA/WPA2 (with specific format), older systems
PBKDF2-HMAC-SHA256 1110 Django, modern web frameworks
PBKDF2-HMAC-SHA512 1120 Higher security applications

Security depends entirely on iteration count:

Iterations Security Level Crackability
1,000 Weak Crackable on GPU in hours for short passwords
10,000 Moderate Crackable for weak passwords
100,000 Good Resistant for most practical attacks
600,000+ Strong Recommended minimum (OWASP 2023)
# Django PBKDF2-SHA256 format (common in web apps)
pbkdf2_sha256$260000$randomsalt$hashvalue

# Hashcat for PBKDF2-HMAC-SHA256
hashcat -m 1110 pbkdf2_hashes.txt rockyou.txt

# SSH private key passphrase (uses PBKDF2)
hashcat -m 26600 id_rsa.hash rockyou.txt    # RSA private key (PKCS#8, PBKDF2-HMAC-SHA256)

4.5 Modern Password Hashing Comparison

Algorithm Year Salt Key Stretching Memory-Hard GPU Resistant Recommended Cost
bcrypt 1999 Yes (128-bit) Yes (2^cost) No Moderate cost ≥ 12
scrypt 2009 Yes Yes (N) Yes High N ≥ 2^15
Argon2 2015 Yes Yes (t) Yes Highest m ≥ 64MB, t ≥ 3
PBKDF2 2000 Yes Yes (iterations) No Low iterations ≥ 600,000

5. Common Hash Formats

5.1 Unix/Linux Password Hashes (/etc/shadow)

Linux systems store password hashes in /etc/shadow. The format is identified by a prefix:

Prefix Algorithm Hashcat Mode Notes
$1$ MD5 Crypt 500 Legacy, still found on older systems
$2a$, $2b$, $2y$ bcrypt 3200 Strong, salted, cost factor
$5$ SHA-256 Crypt 1800 Modern Linux default on some distros
$6$ SHA-512 Crypt 1711 Modern Linux default (most common)
$7$ scrypt 8900 Memory-hard, newer distros
$y$ yescrypt — Latest (Alpine Linux, some RHEL)

Example /etc/shadow entries:

root:$6$rounds=656000$saltsalt$hashvaluehashvaluehashvalue::0:99999:7:::
user1:$6$rounds=5000$abc123def456$g7h8i9j0k1l2m3n4o5p6q7r8s9t0::10001:0:99999:7:::
user2:$1$saltsalt$md5hashvalue::1001:1001:99999:7:::
user3:$2b$12$LJ3m4ys3LgBsTsqA2wN5F.vZVp8JqKjH3K5xR9mN2bP4cD6eF8gHi::1002:1002:99999:7:::

Parsing the $6$ (SHA-512 Crypt) format:

$6$rounds=656000$saltsalt$hashvalue...
^  ^--------------^ ^------^ ^------------------^
|  Iteration count    Salt      86-char hash
Algorithm ($6$ = SHA-512)
# Crack Linux shadow hashes
hashcat -m 1711 /etc/shadow rockyou.txt        # SHA-512 crypt
hashcat -m 1800 /etc/shadow rockyou.txt        # SHA-256 crypt
hashcat -m 500  /etc/shadow rockyou.txt        # MD5 crypt

5.2 Windows Hash Formats

Source Format Example
SAM (local accounts) username:rid:lm:ntlm::: admin:1000:aad3b435b51404eeaad3b435b51404ee:5835048ce94ad0564e29a924a03510ef:::
NTDS.dit (domain accounts) Same as SAM Same format, extracted via DCSync/secretsdump
Windows Vault DPAPI-protected Requires master key extraction
LSA Secrets Registry-encoded mimikatz # sekurlsa::lsadump

5.3 Kerberos Hash Formats

Format Prefix Hashcat Mode Description
TGS-REP (RC4) $krb5tgs$23$ 13100 Kerberoasting — RC4-HMAC encrypted service ticket
TGS-REP (AES128) $krb5tgs$17$ 18200 Kerberoasting — AES128 encrypted
TGS-REP (AES256) $krb5tgs$18$ 19600 Kerberoasting — AES256 encrypted
AS-REP (RC4) $krb5asrep$23$ 18200 AS-REP Roasting — RC4
AS-REP (AES256) $krb5asrep$18$ 19700 AS-REP Roasting — AES256

Example Kerberos hash:

$krb5tgs$23$user@DOMAIN.COM$service/server.domain.com~host/server.domain.com$09012023101530...
^      ^  ^-----^  ^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^
|      |   User     etype    Service Principal Name    Ticket data
Algorithm

5.4 WPA/WPA2 Hash Format

$WPA$25$essid$response$01:23:45:67:89:ab$0a:bc:de:f0:12:34$1$208$handshake_data
^    ^  ^^^^^^ ^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^ ^^^^^ ^-------------^
|    |   SSID    EAPOL    AP MAC            Client MAC  #  Len   Handshake
Type Version
# Crack WPA2 handshake
hashcat -m 22000 wpa_capture.hc22000 rockyou.txt

5.5 Web Framework Hash Formats

Framework Format Algorithm Hashcat Mode
Django pbkdf2_sha256$iterations$salt$hash PBKDF2-HMAC-SHA256 1110
WordPress $P$ or $H$ phpass (bcrypt-like) 400
Joomla hash:salt SHA-256 + salt 9700
Drupal 7 $S$ SHA-512 (iterated) 9900
Drupal 8+ $H$ SHA-512 (25 rounds) 10900
OpenSSL $5$ or $6$ SHA-256/512 1800/1711
PHPASS $P$ or $H$ Extended DES 400

Django example:

pbkdf2_sha256$260000$VKfIbq6gxdN5$e8+KlJhFgBcDeFgHiJkLmNoPqRsTuVwXyZ1234567890
^------------^ ^------^ ^--------^ ^------------------------------------------^
Algorithm       Iterations  Salt         Hash (Base64-encoded)

6. Hash Identification

6.1 Why Hash Identification Matters

Before cracking a hash, you must know its type. Using the wrong Hashcat mode produces false results or wastes time. Hash identification is the first step in any offline password attack.

6.2 Prefix-Based Identification (Quick Reference)

This is the fastest method — learn these prefixes:

Prefix/Pattern Hash Type Hashcat Mode
32 hex chars MD5 0
40 hex chars SHA-1 100
64 hex chars SHA-256 1400
128 hex chars SHA-512 1700
$1$ MD5 Crypt 500
$2a$, $2b$, $2y$ bcrypt 3200
$5$ SHA-256 Crypt 1800
$6$ SHA-512 Crypt 1711
$7$ scrypt 8900
$P$ or $H$ WordPress/phpass 400
$S$ Drupal 7 9900
$krb5tgs$ Kerberos TGS-REP 13100/18200/19600
$krb5asrep$ Kerberos AS-REP 18200/19700
$WPA$ WPA/WPA2 22000
username:rid:lm:ntlm::: LM:NTLM 1000
aad3b435b51404eeaad3b435b51404ee: LM disabled + NTLM 1000
pbkdf2_sha256$ Django PBKDF2 1110
$argon2id$ Argon2id 15100
NT:$hash NetNTLMv2 5600
hash:salt (Joomla) SHA-256 + salt 9700

6.3 Automated Hash Identification Tools

Hashcat Built-in Help

# List all supported hash modes
hashcat --help | grep -A 500 "Hash modes"

# Search for a specific type
hashcat --help | grep -i "ntlm"
hashcat --help | grep -i "bcrypt"
hashcat --help | grep -i "kerberos"

Online Hash Identifiers

Tool URL Notes
Hashes.com Identifier https://hashes.com/en/tools/hash_identifier Most comprehensive
OnlineHashCrack Identifier https://www.onlinehashcrack.com/hash-identifier.php Quick and reliable
Hash Identifier (Python) pip install hash-identifier CLI tool, works offline

Python hash-identifier

# Install
pip install hash-identifier

# Run
hash-identifier

# Output example:
 [!] Enter hash: 5f4dcc3b5aa765d61d8327deb882cf99
 [x] MD5
 [x] MySQL
 [x] PostgreSQL
 [x] Domain Cached Credentials
 [x] LM

6.4 Practical Hash Identification Workflow

Step 1: Look at the hash format
        ├── Starts with $? → Check prefix ($1$, $2b$, $6$, etc.)
        ├── 32 hex chars → MD5
        ├── 40 hex chars → SHA-1
        ├── Contains $krb5 → Kerberos
        ├── Contains $WPA$ → WPA/WPA2
        ├── Contains username:rid: → LM:NTLM
        └── pbkdf2_ → Django PBKDF2

Step 2: Verify with tool
        hashcat --help | grep -i "suspected_type"

Step 3: Confirm by testing
        hashcat -m MODE --session=test hash.txt wordlist.txt
        (Check if speed/progress looks reasonable)

Step 4: Crack
        hashcat -m MODE -a 0 hash.txt rockyou.txt -r rules/best64.rule

OSCP Exam Tip: During the exam, you will encounter hashes in various locations: /etc/shadow, Windows SAM dumps, NTDS.dit extractions, Kerberos tickets, and web application databases. Keep this identification table memorized. The $6$ (SHA-512 crypt) and LM:NTLM (1000) formats are the most commonly encountered. When in doubt, copy the first 10-15 characters of the hash and search online — this is a valid exam strategy.


Summary: Hash Type Quick Reference Card

Category Hash Type Output Length Salted? Hashcat Mode Crackable?
Legacy MD5 32 hex No 0 Yes, fast
Legacy SHA-1 40 hex No 100 Yes, fast
Legacy SHA-256 64 hex No 1400 Yes, fast
Legacy SHA-512 128 hex No 1700 Yes, fast
Windows LM 32 hex No 1000 Trivial
Windows NTLM 32 hex No 1000 Yes, fast
Windows NTLMv2 Variable Yes (challenge) 5600 Moderate
Unix MD5 Crypt Variable Yes 500 Moderate
Unix SHA-256 Crypt Variable Yes 1800 Moderate
Unix SHA-512 Crypt Variable Yes 1711 Moderate
Modern bcrypt 60 chars Yes 3200 Very hard
Modern scrypt Variable Yes 8900 Very hard
Modern Argon2id Variable Yes 15100 Nearly impossible
Modern PBKDF2-SHA256 Variable Yes 1110 Hard (depends on iterations)
Kerberos TGS-REP RC4 Variable Yes 13100 Moderate
Kerberos AS-REP RC4 Variable Yes 18200 Moderate
WiFi WPA2 Variable Yes 22000 Moderate

Key Takeaways for OSCP

  1. LM hashes are trivially broken — any LM hash can be cracked in seconds. If LM is enabled, it is an immediate win.
  2. NTLM is the most common target — mode 1000 in Hashcat. Focus your wordlists and rules here.
  3. $6$ (SHA-512 crypt) is the default Linux hash — mode 1711. Salted but still crackable for weak passwords.
  4. bcrypt, scrypt, and Argon2 are exam distractors — you will see them but cannot realistically crack them. Move on.
  5. Always identify before cracking — using the wrong mode wastes precious exam time.
  6. The static LM hash aad3b435b51404eeaad3b435b51404ee means LM is disabled (or blank password on old systems).
  7. Kerberos hashes ($krb5tgs$, $krb5asrep$) come from Kerberoasting and AS-REP Roasting — crackable with RC4 but harder with AES.