How Password Anvil works
A password generator should be trustworthy by construction, not just by promise. Here's what happens when you click "New".
1. Generated on your device
Every password, passphrase and PIN is created by JavaScript running in your browser. There is no server-side component: our hosting serves the same static files to everyone, and nothing you generate is ever sent back.
2. Isolated from the rest of the page
Any script running on a web page can read what's on that page. On many password sites that
includes advertising and analytics code from other companies. To rule that out, the generator
runs in a frame served from an entirely separate website, gen.passwordanvil.org.
Browsers' same-origin policy forbids scripts on this page from reading inside that frame, so
scripts on this page, ours or anyone else's, are blocked from seeing what it generates. Because
it's a different site, not just a subdomain, modern browsers also run it in its own process,
which keeps it out of reach of even low-level attacks on memory.
The frame and this page exchange only two things: the frame's height, so the page can size it to fit, and your choice of options, so they can be remembered. The height is fixed by the layout and never depends on what was generated. No generated value is ever sent.
3. No network access, enforced by the browser
The generator frame is served with a strict
Content Security Policy
(connect-src 'none', default-src 'none') that tells your browser to
block it from making network requests or loading code from anywhere else. The frame is also
sandboxed,
so it can't open new windows or navigate this page somewhere else, which closes the other common
ways a page could carry data out.
4. Cryptographically secure, unbiased randomness
Random values come only from crypto.getRandomValues, your browser's
cryptographically secure random number generator. Math.random, which is not
designed for security, is never used.
Turning random numbers into characters is where many generators go subtly wrong. Taking a random number "modulo" the number of characters makes some characters slightly more likely than others. Password Anvil uses rejection sampling: random values that would cause bias are discarded and redrawn, so every character is exactly equally likely.
When you require at least one character of each type, the generator does not insert one of each and shuffle. That also skews the odds. Instead it generates the whole password at random and starts over if a type is missing. Every password that meets your rules is equally likely, and the strength meter counts exactly how many such passwords exist.
5. Nothing stored
Generated values are never saved. The only thing remembered is your choice of options, such as length, in this site's local storage in your browser, so they're there next time. The generator frame itself stores nothing at all. Everything else the site does is covered in the privacy policy.
Credits
Passphrases use the EFF Large Wordlist by the Electronic Frontier Foundation, licensed under CC BY 3.0 US.