Password Generator

This pane writes a random password drawn from a character pool. The head sets the length and the count, and turns uppercase, lowercase, digits, and symbols on or off. Dropping lookalikes removes 0, O, 1, l, and I. Each result contains at least one character from every set that is on. Changing those options does not draw again. Generate does.

Guess count is the alphabet size raised to the length

A password drawn uniformly from an alphabet of size A and length n has A to the power n candidates, which is n times log2(A) bits. Uppercase, lowercase, digits, and the 25 symbols in this pool are 87 characters, about 6.4 bits each. Sixteen characters are about 103 bits; eight are about 52. After letters and digits are already included, a symbol class adds about half a bit per character. Going from 8 to 16 multiplies the guess count by the alphabet, eight times over. Dropping 0, O, 1, l, and I shrinks the pool a little, because those glyphs look alike when a person copies them. A password is a secret. A digest is a function of content — see hash digest. Storing a login secret wants a slow hash — see bcrypt. A UUID names a row — see UUID generator — and anyone who can see it can point at that row.

What length, the alphabet, and the draw each change

Why one extra character usually multiplies guesses more than one extra symbol class

  1. Bits per character are the base-2 log of the alphabet size. Eighty-seven symbols are about 6.4 bits. Digits alone are about 3.3 bits, so sixteen digits are only about 53 bits.
  2. Sixteen characters from those 87 symbols are about 103 bits. Eight are about 52. Doubling the length squares the number of guesses.
  3. Letters and digits are 62 symbols, about 6.0 bits. Adding the 25 symbols reaches 87, about half a bit more per character, roughly eight extra bits at length 16.
  4. A site that caps length at 8 and then demands a symbol still has a short password. The cap sets the ceiling. The extra symbol does not.

Why a “must include each class” rule shrinks the set an attacker searches

  1. Without the rule, every string of length n counts. The size of that set is the alphabet size to the power n.
  2. Requiring one character from each enabled class throws out every string that misses a class. An attacker who knows the rule skips those strings.
  3. The same rule still accepts short, common strings such as Password1!. Matching the rule is not the same thing as being hard to guess.
  4. A draw that promises one of each class picks those characters first, fills the rest from the whole pool, then shuffles. The shuffle stops the required characters from always sitting at the front. It does not enlarge the alphabet.
  5. NIST SP 800-63B dropped composition rules as a requirement. It looks at length, and at whether the secret already appears in a breach corpus.

Why 0, O, 1, l, and I leave some alphabets

  1. They are different code points with similar glyphs in many fonts. A person reading a screen or a printout mixes 0 with O, and 1 with l or I.
  2. A paste of the whole string does not need that filter. The code points were already distinct, so a machine does not misread them.
  3. Removing I and O from uppercase, l from lowercase, and 0 and 1 from digits takes this 87-character pool down to 82. That is about 0.1 bit per character.
  4. Pipe and quotation marks are often grouped with those lookalikes, but they are not among these 25 symbols, so the filter here moves letters and digits, not the symbol class.
  5. One extra character of length pays the missing tenth of a bit back. The filter is for a human reader, not a bonus added to the entropy.

Why a password, a digest, and a UUID are three different objects

  1. A password is a secret drawn from an alphabet. Its job is to stay unknown to everyone except the person who chose it.
  2. A digest is a function of content that already exists. A fast digest such as MD5, or a single SHA-256, can be tried in bulk against a stolen list.
  3. A stored login secret should be a slow hash: bcrypt, Argon2, or PBKDF2 with a salt and a cost. The salt makes one password produce different digests. The cost makes each guess pay time or memory.
  4. A UUID identifies a row. Seeing it is not a login, and it was not drawn from the password alphabet.

What a secret, a digest, and an identifier each carry

A string a password manager will store, rather than a memory

Random characters carry no words, and a manager only has to keep the string. A person who must memorize wants words. The EFF long list has 7776 words, about 12.9 bits each, so six words are about 77 bits, near twelve characters drawn from 87 symbols. Either way the strength is the log of the space, not how scrambled the text looks.

A secret that is about to be written into a user table

The table should not hold the characters. A slow hash plus a salt makes every guess pay the iteration or the memory. A UUID can be the primary key of that row. It is not the password, and reading it should not sign anyone in.

Frequently asked questions

How long should a strong password be?
Length is a count of characters, and strength is the log of the alphabet raised to that length. From 87 symbols, each character is about 6.4 bits, so 8 characters are about 52 bits, 16 are about 103, and 20 are about 129. Doubling the bits squares the number of guesses. It does not add them. Sixteen digits, with only ten symbols in the pool, are about 53 bits, close to eight characters from the full pool. A site that stops you at 8 characters and then asks for a symbol still issued a short password. NIST SP 800-63B puts the floor on length for a memorized secret and asks for a check against breached passwords. It does not treat “must contain a symbol” as the requirement. The allowed maximum ought to reach at least 64 characters, so a passphrase still fits.
Does adding a character class help more than adding length?
After uppercase, lowercase, and digits are already in the pool, the pool has 62 symbols, about 6.0 bits each. The 25 symbols bring it to 87, about half a bit more per character. At length 16 that is about 8 extra bits, a few hundred times more guesses. One more character at that alphabet multiplies the whole pool again, about 6.4 bits, a factor near 87. Growing from 8 characters to 16 multiplies by the alphabet eight times. Once letters and digits are on, extra length usually buys more than one more rare symbol. A meter that awards points for a symbol and a small point for length is scoring the policy, not the log of the search space.
Why drop 0, O, 1, l, and I from a password?
Those are different code points that look alike in many fonts. Someone copying 0 and O, or 1, l, and I, off a screen or a sheet of paper will swap them. A vertical bar and quotation marks are often put in the same lookalike set. Pasting the whole string does not need the filter, because the code points were already different and a machine does not read the glyph. Taking I and O out of uppercase, l out of lowercase, and 0 and 1 out of digits shrinks an 87-character pool to 82, about a tenth of a bit per character. One extra character of length covers that. The filter is there for a human reader. It is not an increase in entropy.
What is the difference between a random string and a passphrase?
A random string draws each character from an alphabet, so the entropy is the length times the log of that alphabet. A passphrase draws words from a list. The EFF long list has 7776 words, about 12.9 bits a word, and six words are about 77 bits, the same order as twelve characters from an 87-symbol alphabet. The words are easier for a person to remember. The strength of the phrase sits in the size of the list and the number of words, not in whether one of the words contains a capital or a symbol. Replacing the spaces with symbols does not by itself become a different entropy. Words fit a memory. A long draw from a character pool fits a password manager, which does not care whether the string can be pronounced.
Is generating a password the same as hashing one?
No. Generating draws a secret that nobody was supposed to know yet, from a character pool. Hashing turns content that already exists into a fixed-length digest — see hash digest. The digest changes when the content changes, and a fast digest can be tried in bulk. A login table should not store the characters, and it should not store only MD5 or a single SHA-256. It should store a slow hash: bcrypt, Argon2, or PBKDF2 with a salt and an iteration count. See bcrypt. The salt makes the same password produce different digests. The cost makes each guess expensive. The generator never sees the user table, and the hash function does not make the password longer.
Does “must include upper, lower, digit, and symbol” make the search larger?
It usually makes the search smaller. With no such rule, every string of length n is a candidate, and the count is the alphabet size to the power n. After each class must appear at least once, every string that misses a class is excluded. An attacker who knows the rule searches only the remainder and does not bother with digits alone. The rule also lets a short, common string such as Password1! count as valid. Valid is not the same as hard to guess. Picking one character from each class first, filling the rest, then shuffling is how a draw meets the rule without leaving those required characters stuck at the front. The shuffle does not grow the alphabet. NIST later removed composition rules from the requirements and looks at length and at breach lists instead.
What goes wrong if a password is drawn with an ordinary random number?
Math.random and similar generators are built for simulations and for interface jitter. Their state can be recovered from the outputs, and the seed space is small, so they are a poor source for a secret. A password wants a cryptographic generator, the sort an operating system exposes as a CSPRNG; on the web platform that call is crypto.getRandomValues. A second, separate mistake is modulo bias. Taking a 32-bit unsigned word modulo the alphabet size is not uniform when that size does not divide 2 to the 32. The smaller remainders get one extra bucket, so characters earlier in the pool show up slightly more often. The unbiased draw sets a ceiling at the largest multiple of the alphabet size that still fits in 32 bits, and it draws again when the word lands on or above that ceiling. The tilt is small. A password still should not carry it.
What happens if the same password is used on many sites?
Once one site’s table is stolen, that password is tried on the others. That is credential stuffing. Length and alphabet size only raise the cost of guessing this one string. They do not help after the string has already leaked. A different password on each site keeps the leak inside that site. A password manager is what remembers the different strings. A person who reuses one password so it is easy to recall has collapsed every site down to the strength of the weakest stolen table. A variant that only adds the site name at the end is still something a reuse rule will try.