DEV Community

Kokal Limited
Kokal Limited

Posted on • Originally published at strongpassfactory.com

Strong Password Generators: What Actually Makes a Password Secure?

Most people have already been breached and don't know it. The 2023 Verizon DBIR found that 86% of data breaches involve stolen or weak credentials — making password hygiene the single highest-leverage security improvement most users can make.

And yet "P@ssw0rd1!" still passes most strength checkers. Here's what actually matters.

The Core Problem: Human Bias

Humans are terrible at generating random strings. We pick patterns, keyboard walks, and dictionary words with symbols bolted on. A proper strong password generator removes that bias entirely by using a Cryptographically Secure Pseudorandom Number Generator (CSPRNG).

In the browser, that means the Web Crypto API:

function generatePassword(length = 16, charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*') {
  const array = new Uint32Array(length);
  window.crypto.getRandomValues(array);
  return Array.from(array, n => charset[n % charset.length]).join('');
}
Enter fullscreen mode Exit fullscreen mode

This draws entropy from the OS random pool — the same source used in TLS key generation. Crucially, each character is statistically independent of the last, which is what makes the output unpredictable. Contrast this with Math.random(), which is seeded and deterministic — never use it for security-sensitive output.

Length Beats Complexity Every Time

This is the result most people find counterintuitive. Here's estimated brute-force cracking time against a modern GPU cluster at 10B guesses/sec (via Hive Systems 2024):

Length Character Set Est. Crack Time
8 Lowercase only < 1 minute
8 Full mixed 8 hours
12 Full mixed 3,000 years
16 Full mixed 1 billion years
20 Full mixed Practically infinite

A 12-character fully mixed password is already strong by any practical measure. At 16+ characters, you're in "heat death of the universe" territory.

What a Trustworthy Generator Looks Like

When evaluating or building one, check for:

  • Client-side only — no password is transmitted over a network
  • CSPRNGwindow.crypto.getRandomValues() in browsers, secrets module in Python, crypto/rand in Go
  • Configurable — length and character set should be user-controlled
  • No logging — the output is never stored or cached
import secrets, string

def generate_password(length=16):
    alphabet = string.ascii_letters + string.digits + string.punctuation
    return ''.join(secrets.choice(alphabet) for _ in range(length))
Enter fullscreen mode Exit fullscreen mode

The Takeaway

Stop optimizing for "looks complex." Optimize for length and genuine randomness. A 16-character password from a CSPRNG-backed generator is astronomically harder to crack than any 8-character pattern a human would invent — no matter how many ! symbols you add.

Use a password manager, generate 16+ character passwords for everything, and let the entropy do its job.


Originally published on StrongPassFactory

Top comments (0)