← Back to All Guides
Security & Privacy • 8 min read • September 25, 2026

The Mathematics of Password Security: Shannon Entropy, NIST Guidelines & Cryptographic Randomness

Why complex passwords still get cracked, how CSPRNG generates true unpredictability, and calculating brute-force crack time.

By ToolHero Security & Cryptography Research Group

The Illusion of "Complex" Passwords

For decades, IT administrators enforced strict password composition rules: at least 8 characters, at least one uppercase letter, one number, and one special symbol.

Human psychology quickly adapted by creating predictable patterns:

  • Capitalize the first letter: P

  • Follow with a dictionary word: assword

  • Append a common digit: 1

  • End with an exclamation mark: !

  • Result: Password1!
  • To modern brute-force hash-cracking clusters powered by GPUs (utilizing tools like Hashcat and John the Ripper), these pattern-based masks are tested within the first milliseconds of an attack.


    Calculating Password Information Entropy

    In information theory, Shannon Entropy measures the unpredictability or randomness of an information source. For passwords, entropy is expressed in bits:

    H = L \times \log_2(R)

    Where:

  • H = Password entropy in bits

  • L = Length of the password (number of characters)

  • R = Size of the character pool (alphabet) from which each character is chosen
  • Comparing Character Pool Sizes (R):

  • Numbers only (0-9): R = 10 (\approx 3.32 bits/char)
  • Lowercase letters (a-z): R = 26 (\approx 4.70 bits/char)
  • Alphanumeric (a-z, A-Z, 0-9): R = 62 (\approx 5.95 bits/char)
  • Full printable ASCII (letters, digits, symbols): R = 94 (\approx 6.55 bits/char)
  • Entropy Comparison Matrix:
    ┌─────────────────────┬─────────┬────────┬──────────────┬─────────────────────────┐
    │ Password            │ Length  │ Pool R │ Total Bits   │ Brute Force Resistance  │
    ├─────────────────────┼─────────┼────────┼──────────────┼─────────────────────────┤
    │ "Secret1!"          │ 8 chars │ 94     │ 52.4 bits    │ Cracked in < 1 minute   │
    │ "Tr0ub4dor&3"       │ 11 chars│ 94     │ 72.1 bits    │ Cracked in ~ 3 days     │
    │ "correct-horse-..." │ 28 chars│ 26     │ 131.7 bits   │ Uncrackable (Billions y)│
    │ "xK9#m$Q2!vL7@pW1"  │ 16 chars│ 94     │ 104.9 bits   │ Uncrackable (Centuries) │
    └─────────────────────┴─────────┴────────┴──────────────┴─────────────────────────┘

    NIST Special Publication 800-63B Recommendations

    The US National Institute of Standards and Technology (NIST) overhauled modern password authentication recommendations:

  • Length Over Composition: Length is significantly more effective at defeating brute-force attacks than arbitrary symbol requirements. A 16-character alphanumeric passphrase provides far greater security than an 8-character symbol salad.

  • Eliminate Periodic Expiration: Forcing users to change passwords every 90 days actually decreases security, prompting users to make tiny predictable variations (Summer2026! \to Fall2026!).

  • Check Against Breached Wordlists: Sites should check passwords against known leaked databases (such as HaveIBeenPwned) rather than banning specific characters.

  • True Cryptographic Randomness: Math.random() vs. CSPRNG

    When generating passwords in web software, using JavaScript's standard Math.random() is a critical security vulnerability:

  • Math.random() is implemented via pseudo-random algorithms like Xoroshiro128+. It is deterministic: observing a few output values allows an attacker to reconstruct the internal seed and predict all future outputs.

  • The Secure Alternative: ToolHero exclusively utilizes the browser native Cryptographically Secure Pseudo-Random Number Generator (CSPRNG):

  • const buffer = new Uint32Array(length);
    window.crypto.getRandomValues(buffer);

    crypto.getRandomValues() draws hardware entropy from the operating system kernel (thermal noise, hardware interrupts, disk timings), ensuring unbiased, mathematically unguessable password generation.

    Frequently Asked Questions

    How many bits of entropy make a password unbreakable?

    A password with 80 bits of entropy or higher is considered virtually uncrackable against current GPU brute-force clusters. A 16-character random alphanumeric password achieves ~95 bits of entropy.

    Why is Math.random() insecure for password generation?

    Math.random() is a pseudo-random algorithm designed for speed, not cryptographic unpredictability. Attackers can deduce its internal state from prior samples and predict subsequent passwords.

    Does ToolHero store or see generated passwords?

    No. Password generation occurs 100% locally inside your web browser using window.crypto.getRandomValues(). No passwords ever travel over the internet.

    Put This Theory Into Practice

    Experience zero-upload, client-side processing with ToolHero suite of free online utilities.

    Explore All Free Tools →