Dictionary attack — How it works in detail

Time2Crack project reference document
Audience: developers, security researchers, advanced users

Contents

  1. Overview
  2. Historical and academic background
  3. Why dictionaries work
  4. Architecture of a modern dictionary attack
  5. Corpora of real passwords
  6. The HIBP check (k-anonymity)
  7. Time2Crack language wordlists
  8. Dictionary rank: rankDictionary()
  9. De-leetification
  10. From rank to cracking time
  11. Comparison with derived attacks
  12. Limits of the dictionary attack
  13. Effective defences
  14. References

1. Overview

The dictionary attack is the oldest password cracking method, the simplest to understand, and statistically the most effective against real human passwords. Instead of enumerating every possible combination like brute force, it tests a pre-compiled list of candidates — the "dictionary" — in decreasing order of probability.

Why it works so well. People do not choose their passwords at random. Decades of data leaks show that real passwords are extremely concentrated: in the RockYou leak, 123456 alone was used by 290,731 accounts, about 2% of the total. A well-built dictionary attack tests these candidates first and finds them in a fraction of a second, where brute force would need years.

Time2Crack uses two independent mechanisms:

The two are complementary: HIBP knows the passwords that have already leaked, the wordlists cover ordinary words that have not leaked yet.


2. Historical and academic background

2.1 Origins

The dictionary attack predates modern computer security. Early Unix systems stored password hashes in the world-readable file /etc/passwd: anyone who could read it could test a word list against every account.

YearEvent
1979Morris & Thompson publish the first academic paper on Unix password security; a large share of the passwords they studied were common words or names.
1988The Morris worm spreads in part by guessing passwords with a built-in list of 432 words, then the system dictionary /usr/share/dict/words.
1991Crack (Alec Muffett): the first widely used Unix password cracker, with word-mangling rules.
1996John the Ripper popularises the "wordlist + rules" mode.
2009RockYou leak: 32 million accounts stored in plain text (14.3 million distinct passwords) reveal how people really choose passwords.
2013Troy Hunt launches Have I Been Pwned. The same year, the Adobe breach exposes 153 million accounts whose passwords were encrypted without salt, so identical passwords could be spotted.
2015Hashcat becomes open source; GPU dictionary attacks become accessible to everyone.
2019"Collection #1–5": billions of email/password pairs compiled from earlier leaks circulate publicly.

2.2 Founding leaks

Some leaks changed the dictionary attack by revealing the real distribution of human passwords:

2.3 How fast is a dictionary attack?

A list of 1 million words, tested with the speeds used by Time2Crack (12× RTX 5090, the default "Standard" profile):

AlgorithmSpeedTime for 1 million candidates
NTLM4,081 GH/s0.25 microseconds
MD52,634 GH/s0.38 microseconds
SHA-1837 GH/s1.2 microseconds
SHA-256332 GH/s3.0 microseconds
bcrypt (cost 5)3,658 kH/s0.27 seconds
Argon2id1,000 H/sabout 17 minutes

The dictionary attack is therefore instantaneous against fast hashes (MD5, SHA-1, NTLM) and remains fast even against bcrypt.


3. Why dictionaries work

3.1 The power law of human passwords

Empirical studies all reach the same conclusion: human passwords are not uniformly distributed. They follow a power law (Zipf's law): a few passwords concentrate a disproportionate share of choices.

Formally: if passwords are sorted by decreasing frequency, the frequency of the password of rank r is roughly proportional to r−s, where the exponent s depends on the corpus (Wang et al., 2017).

Direct consequence: an attacker who tries only the 10 most common passwords already has about one chance in 20 of succeeding against a given account.

3.2 Cognitive biases in password creation

People apply predictable habits when creating a password:

3.3 Two ways of being "in the lists"

A password can appear in an attack list for two different reasons:

These two cases correspond to the two mechanisms of Time2Crack described below.


4. Architecture of a modern dictionary attack

4.1 General pipeline

A modern dictionary attack runs in four phases:

Phase 1: Build the wordlist
    ├── Leaked passwords (HIBP, RockYou, compilations)
    ├── Language wordlists (dictionaries, first names, places)
    ├── Thematic wordlists (sport, pop culture, tech, religion)
    └── Targeted wordlists (company domain, employee names)

Phase 2: Prepare the wordlist
    ├── Sort by frequency (most likely first)
    ├── Remove duplicates
    ├── Filter by length (target length ± 2)
    └── Normalise (lowercase, Unicode NFC)

Phase 3: Hash and compare
    for each candidate w in the wordlist:
        if hash(w) == target_hash: found
    (billions of candidates per second on GPU for MD5)

Phase 4: Report
    └── Cracked passwords, coverage statistics

4.2 Hardware optimisations

Modern dictionary attacks run massively in parallel on GPUs:

For a list of 1 billion leaked passwords on 12× RTX 5090:

This gap of about six orders of magnitude between MD5 and bcrypt shows why the choice of hash algorithm matters so much.

4.3 Order of the candidates

The wordlist is not tested in alphabetical order but by decreasing probability:

  1. The most common leaked passwords (RockYou top 100)
  2. Passwords that appear in many leaks (sorted by HIBP frequency)
  3. Common words of the target language
  4. Proper names (first names, cities, celebrities)
  5. Terms related to the target
  6. Variants and inflected forms

With this order, a weak password is found in the first milliseconds, whatever the hash speed.


5. Corpora of real passwords

5.1 Have I Been Pwned (HIBP)

HIBP is the global reference because it covers almost all major public leaks, it records how often each password appears, and it is actively maintained. An attacker with the full list can test the most frequent passwords first.

5.2 RockYou (2009): the founding corpus

14.3 million distinct passwords stored in plain text. The top of the list:

RankPasswordAccountsShare
1123456290,7312.03%
21234579,0780.55%
312345678976,7900.54%
4password59,4620.42%
5iloveyou49,9520.35%

Takeaway: a handful of candidates, tested in a few nanoseconds against MD5, are enough to compromise a measurable share of the accounts in a leaked database.

5.3 Specialised wordlist collections

These corpora are publicly downloadable: their existence is an established fact of offensive security.


6. The HIBP check (k-anonymity)

6.1 The k-anonymity protocol

Time2Crack checks the password against HIBP without ever sending it, nor its full hash. The protocol works as follows:

1. Compute SHA-1(password)
     → e.g. CBFDAC6008F9CAB4083784CBD1874F76618D2A97
2. Send only the first 5 characters to the HIBP API
     → GET https://api.pwnedpasswords.com/range/CBFDA
3. The API returns every hash suffix starting with this prefix
     (several hundred lines, padded with fake entries)
4. Look for the rest of the hash in the response, locally
     → C6008F9CAB4083784CBD1874F76618D2A97
5. Found: the password has leaked, and HIBP gives how many times
   Not found: the password is not in HIBP

Privacy guarantee: the HIBP server only sees a 5-character prefix shared by hundreds of passwords. It cannot know which password was checked. The comparison is done in the browser.

6.2 Implementation in Time2Crack

The check runs half a second after you stop typing, in parallel with the local analysis:

// app.js - checkHIBP()
async function checkHIBP(password) {
  const sha1 = await sha1Hex(password);   // uppercase hex SHA-1
  const prefix = sha1.slice(0, 5);        // sent to the API
  const suffix = sha1.slice(5);           // never leaves the browser

  const res = await fetch(`https://api.pwnedpasswords.com/range/${prefix}`, {
    headers: { "Add-Padding": "true" },   // hide the real size of the response
  });
  if (!res.ok) return null;               // API unavailable

  const text = await res.text();
  for (const line of text.split("\n")) {
    const [hashSuffix, count] = line.trim().split(":");
    if (hashSuffix === suffix) return parseInt(count, 10); // number of leaks
  }
  return 0;                               // not found
}

The result is shown as a badge: "found N times", "not found", or "unavailable" when the API cannot be reached. It does not change the cracking times, which are computed locally.

6.3 Reading the HIBP count

The count is the number of times this exact password was seen in indexed leaks:

CountMeaning
More than 1,000,000Among the most used passwords in the world: tried first by every attacker
10,000 to 1,000,000Very common
1,000 to 10,000Common
100 to 1,000Uncommon but known
1 to 100Rare, but compromised

Even a count of 1 is a warning: the password is in the lists available to attackers, and anyone targeting the account it leaked from will try it.


7. Time2Crack language wordlists

7.1 Why language wordlists in addition to HIBP

HIBP covers passwords that have already leaked, not ordinary words that have not leaked yet. A French speaker who chooses éphémère may not be in HIBP, but the word is in the French wordlist of any attacker targeting French-speaking users. The language wordlists of Time2Crack fill this gap:

LanguageFileWords
Englishen.txt.gz748,958
Frenchfr.txt.gz550,235
Spanishes.txt.gz284,834
Portuguesept.txt.gz507,721
Germande.txt.gz2,009,880
Italianit.txt.gz3,252,670
Dutchnl.txt.gz2,678,323
Polishpl.txt.gz3,670,705
Turkishtr.txt.gz400,442
Total14,103,768

The first versions came from the Wikipedia word lists of SecLists and from the kkrypt0nn wordlists; they have been enriched since. When a list is loaded, each line is trimmed and lowercased, and words shorter than 3 characters are discarded.

7.2 Lazy loading

The wordlists are not bundled with the code. Only the list of the selected language is downloaded, the first time it is needed, as a gzip file:

// app.js - loadDictionary() (simplified: progress bar updates removed)
async function loadDictionary(lang = AppConfig.lang) {
  // Already loaded for this language
  if (AppConfig.dictWords !== null && AppConfig.dictLang === lang) return;

  // 1. Local cache (IndexedDB)
  const cached = await cacheGet(`dict_${lang}`);
  if (cached) {
    AppConfig.setDictionary(new Set(cached), lang);
    return;
  }

  // 2. Download the compressed list
  const res = await fetch(`${basePath}data/wordlists/${lang}.txt.gz`);
  if (!res.ok) throw new Error(`HTTP ${res.status}`);
  const buffer = await res.arrayBuffer();

  // 3. Decompress in the browser (plain .txt if DecompressionStream is missing)
  let text;
  try {
    text = await new Response(
      ReadableStream.from([new Uint8Array(buffer)])
        .pipeThrough(new DecompressionStream("gzip"))
    ).text();
  } catch {
    text = await (await fetch(`${basePath}data/wordlists/${lang}.txt`)).text();
  }

  // 4. Normalise, filter, index
  const words = text.split("\n")
    .map(w => w.trim().toLowerCase())
    .filter(w => w.length >= 3);
  AppConfig.setDictionary(new Set(words), lang);

  // 5. Keep it for the next visit
  await cachePut(`dict_${lang}`, words);
}

Why a Set? A JavaScript Set answers dictWords.has(word) in constant time, whether the list holds 285,000 words (Spanish) or 3.7 million (Polish). With an Array, each lookup could require one comparison per word.

7.3 Local cache (IndexedDB)

The prepared list is stored in the browser's IndexedDB under the key dict_<language>. On the next visit, it is read from the cache instead of being downloaded and decompressed again:

First visit                          Next visits
-----------                          -----------
fetch fr.txt.gz                      cacheGet("dict_fr")
  └── gunzip (DecompressionStream)     └── new Set(words)
        └── trim / lowercase / ≥ 3           └── ready
              └── new Set(words)
                    └── cachePut("dict_fr")
                          └── ready

The password never leaves the browser: the list is downloaded from the Time2Crack server and the comparison is done locally.


8. Dictionary rank: rankDictionary()

8.1 Principle: a rank, then a time

Time2Crack does not only ask "is this a dictionary word?", but "after how many guesses would a dictionary attack find it?". This number of guesses is the rank. The function rankDictionary() (file core/rank/dictionary.js) returns it, or null when the attack does not apply:

// core/rank/dictionary.js - rankDictionary()
export function rankDictionary(password, dictWords = null) {
  const lower = password.toLowerCase();
  const deleeted = deleet(password);
  const alpha = password.replace(/[^a-zA-Z]/g, "");
  const uCost = uppercaseCost(alpha);        // capital letters, see 8.3

  // 1. In the top passwords as is?
  const topIdx = TOP_PASSWORDS.indexOf(lower);
  if (topIdx !== -1) return { rank: (topIdx + 1) * uCost, model: "dictionary" };

  // 2. De-leeted form in the top passwords?
  const deIdx = TOP_PASSWORDS.indexOf(deleeted);
  if (deIdx !== -1) return { rank: (deIdx + 1) * 10 * uCost, model: "dictionary" };

  // 3. In the wordlist of the selected language?
  if (dictWords instanceof Set) {
    if (dictWords.has(lower) || dictWords.has(deleeted)) {
      const mid = Math.floor(dictWords.size / 2);
      if (passwordLength(password) >= 9) {
        // a long word may also be split into shorter words, see 8.4
        const compound = rankGermanCompound(password, dictWords);
        if (compound && compound.rank < mid)
          return { rank: compound.rank * uCost, model: "dictionary" };
      }
      return { rank: mid * uCost, model: "dictionary" };
    }

    // 4. Compound made of several dictionary words?
    const compound = rankGermanCompound(password, dictWords);
    if (compound) return { rank: compound.rank * uCost, model: "dictionary" };
  }

  // Not found: the dictionary attack does not apply
  return { rank: null, model: "dictionary" };
}

8.2 Four levels

LevelRuleExampleRank
1. Top passwordsPosition in a list of 105 of the most common passwords (RockYou, HIBP)password2
2. Leetspeak variantPosition of the de-leeted form × 10p@ssw0rd20
3. Language wordlistHalf the size of the listsoleil (French)275,117
4. Compound wordSee 8.4apfelbaumkuchen (German)21,129

Why half the list? The wordlists are not sorted by frequency, so the position of a word in the file says nothing about when an attacker would try it. On average, an attacker going through the list finds a given word halfway.

8.3 Capital letters

An attacker starts with lowercase words, then tries capitalised variants. The rank is multiplied by the number of variants needed to reach the capitalisation of the password (function uppercaseCost(), same method as zxcvbn):

CapitalisationMultiplierExampleRank
All lowercase× 1soleil275,117
First letter only× 2Soleil550,234
Last letter only× 2soleiL550,234
All uppercase× 2PASSWORD4
Any other mixsum of C(n, i) for i = 1 … min(uppercase, lowercase)PaSsWoRd324

8.4 Compound words

German (and Dutch) glue words together: Apfelbaumkuchen = Apfel + Baum + Kuchen. Such a word is often absent from the list, but an attacker can build it by combining shorter words. Time2Crack tries to split the password into 2 to 4 words of the list, allowing the usual German linking letters (-s-, -es-, -n-, -en-, -er-, -e-). The rank is then the mask rank of the password multiplied by 0.25 (2 words), 0.16 (3 words) or 0.10 (4 words), and by 0.75 when the last piece is a common suffix (-heit, -ung, -haus…).

The split is also tried on long words that are in the list (9 characters or more), and kept when it gives a lower rank: Sonnenblume gets a rank of 42,680 instead of half the German list (1,004,940).


9. De-leetification

9.1 Leetspeak is not a protection

Leetspeak replaces letters with similar-looking digits or symbols: a → @, e → 3, i → 1, o → 0, s → $. People use it to "strengthen" a common word: password → p@$$w0rd.

In reality, these substitutions are among the first rules applied by cracking tools. They do not slow down a competent attacker.

9.2 The deleet() function

// core/rank/dictionary.js - deleet()
function deleet(pw) {
  return pw
    .toLowerCase()
    .replace(/0/g, "o")
    .replace(/1/g, "i")
    .replace(/3/g, "e")
    .replace(/4/g, "a")
    .replace(/5/g, "s")
    .replace(/7/g, "t")
    .replace(/8/g, "b")
    .replace(/@/g, "a")
    .replace(/\$/g, "s")
    .replace(/!/g, "i");
}

The password is looked up both as typed and in its de-leeted form. In the top passwords, the de-leeted form costs 10 times more (the attacker has to try the variants): p@ssw0rd → 20 instead of 2. In the language wordlist, it costs the same as the plain word.

9.3 What is not decoded


10. From rank to cracking time

The rank is converted into seconds by dividing it by the hashing speed of the attacker:

// core/time.js - rankToSeconds()
export function rankToSeconds(rank, algo, profile = "experienced") {
  const baseRate = HASH_RATES[algo];   // guesses per second, 12× RTX 5090
  if (!baseRate) throw new Error(`Unknown algorithm: ${algo}`);
  const multiplier = ATTACKER_MULTIPLIERS[profile] ?? 1;
  return rank / (baseRate * multiplier);
}

Example for soleil (French wordlist, rank 275,117), with the default profile:

AlgorithmSpeed (12× RTX 5090)CalculationTime
NTLM4,081 GH/s275,117 / 4,081 × 10967 nanoseconds
MD52,634 GH/s275,117 / 2,634 × 109104 nanoseconds
SHA-1837 GH/s275,117 / 837 × 109329 nanoseconds
SHA-256332 GH/s275,117 / 332 × 109829 nanoseconds
bcrypt (cost 5)3,658 kH/s275,117 / 3,658,0000.08 seconds
Argon2id1,000 H/s275,117 / 1,0004 minutes 35 seconds

Even with Argon2id, a plain French word falls in less than 5 minutes. The attacker profile changes the speeds: from a single GPU ("Amateur" profile) to about 10,000 GPUs ("Nation-state" profile). Like every other model, the dictionary rank can never exceed the brute-force rank of the same password.


11. Comparison with derived attacks

The "pure" dictionary attack is the first of a family of attacks that all start from a word list. Time2Crack computes nine models (brute force, dictionary, hybrid, mask, PCFG, Markov, combinator, keyboard patterns, dates), each attacking the password from a different angle.

11.1 Dictionary vs hybrid

CriterionDictionaryHybrid (dictionary + rules)
CandidatesThe words of the list, as isEach word with its mutations (digits, symbols, capitals…)
Cracked examplespassword, soleilP@ssw0rd!, soleil2024
SpeedFewer candidates, so fasterMuch wider coverage
Applies whenThe exact word is in the listThe password is derived from a word of the list

The hybrid attack starts where the pure dictionary stops: it applies systematic mutation rules to every word of the list (in the spirit of hashcat's best64.rule).

11.2 Dictionary vs PCFG

CriterionDictionaryPCFG
ModelFixed list of candidatesProbabilistic grammar of password structures
StrengthExact wordsStructures such as word + digits, capital + lowercase + symbol
Examplepassword ✓Password123 ✓ (structure recognised)

Password123 is not a dictionary word as such, but PCFG recognises its structure [capital][lowercase][digits] and cracks it very quickly.

11.3 Dictionary vs Markov

CriterionDictionaryMarkov
CandidatesPre-compiled listGenerated on the fly by a statistical model
CoverageKnown vocabularyAny sequence that "looks human"
AdvantageVery fast on exact wordsAlso covers words absent from the lists

Markov covers passwords that look like human words without being in any list.

11.4 Dictionary vs credential stuffing

CriterionDictionaryCredential stuffing
GoalCrack a hashLog in to an account
MechanismLocal hash computationRemote login attempts
SourceGeneric wordlistLeaked email/password pairs
DefenceSlow hash algorithmRate limiting, MFA, IP blocking

Credential stuffing does not attack a hash: it tries leaked email/password pairs directly on online services. It is a different attack, but it uses the same data (leaks such as those indexed by HIBP). Time2Crack does not model it.


12. Limits of the dictionary attack

12.1 Intrinsic limits

12.2 What Time2Crack does not model


13. Effective defences

13.1 What protects

A slow hash algorithm (bcrypt, Argon2id). This is the most effective server-side defence: each guess costs more. For soleil (rank 275,117):

A slow hash slows the attacker down, but it does not save a dictionary word: the list is simply too short.

A unique salt per account. It makes precomputed tables (rainbow tables) useless and forces the attacker to work account by account. It does not prevent a wordlist attack on a single account.

Length and randomness. A single dictionary word is always vulnerable. A passphrase of 4 or 5 words resists the pure dictionary attack, but not the combinator attack if the words are predictable: they must be drawn at random.

Randomly generated passwords. The real solution: a password manager that generates long random passwords (20 characters or more). They are in no dictionary.

Multi-factor authentication (MFA). It does not prevent offline cracking of stolen hashes, but it stops the attacker from logging in with a cracked password.

Rate limiting and anomaly detection. They protect against online attempts, not against offline cracking of stolen hashes.

13.2 What does not protect

13.3 Practical recommendations


14. References

Academic sources

Industry sources

Background


Source code: core/rank/dictionary.js (rankDictionary, deleet), core/rank/uppercase.js (uppercaseCost), core/time.js (rankToSeconds), app.js (loadDictionary, checkHIBP).