Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Passphrase Generator

A fast, offline, dependency-free passphrase generator inspired by Bitwarden's — with the options Bitwarden is missing: fewer than 3 words, a maximum-length cap, configurable number placement, and fixed prefix/suffix text.

It's a single HTML file. No build step, no install, no tracking, no network calls at runtime. Open it in any browser, or host it on GitHub Pages.

License: MIT No build step Single file

Live demo: https://Claire.github.io/passphrase-generator/ (update after you enable Pages)

Screenshot of the passphrase generator


Features

EFF large wordlist The same 7,776-word list Bitwarden uses, for ~12.9 bits of entropy per word.
1–20 words Bitwarden's floor is 3; this goes down to 1 for short, low-stakes phrases.
Custom separator Any character(s), with quick-pick chips (dash, underscore, dot, space, none).
Capitalize Uppercase the first letter of each word.
Number placement Add a random digit at the end/start of a random word, the start/end of the passphrase, or the end of every word.
Fixed prefix & suffix Optional literal text added verbatim at the very start/end (e.g. to satisfy a site's rules).
Maximum length cap Words are chosen to fit a character budget — the result never exceeds your limit.
Live strength meter Shows entropy in bits and a Weak → Excellent rating that updates as you tweak.
Light / dark theme Follows your OS by default, remembers an explicit choice, applies before first paint (no flash).
Local persistence Settings and history are saved on your device (when run as a saved file or hosted).
History The last 20 generated passphrases, one click to copy, with a clear button.
Secure randomness Uses crypto.getRandomValues with unbiased rejection sampling — never Math.random.
Accessible Full keyboard navigation, visible focus, ARIA live announcements, a progressbar strength meter, reduced-motion support, and WCAG AA contrast.

How it works

Randomness

Every choice — which word, which digit, which word gets the digit — comes from window.crypto.getRandomValues, the browser's cryptographically secure RNG. A small rejection-sampling helper removes modulo bias so each word in the list is exactly equally likely. Math.random is never used.

Entropy & strength

Strength is reported as entropy in bits, assuming an attacker knows exactly how the passphrase was built (the standard, paranoid assumption). Only genuinely random choices count:

  • Each random word: log₂(7776) ≈ 12.9 bits
  • Random-word digit: log₂(10) for the value + log₂(words) for which word
  • Fixed-position digit (phrase start/end): log₂(10)
  • "Every word" digit: log₂(10) per word
  • Capitalize / prefix / suffix / separator: 0 bits — they're predictable, so they add length but not strength

Ratings: Weak < 40 · Fair 40–59 · Good 60–79 · Strong 80–109 · Excellent 110+. For reference, anything Strong (80+ bits) is already far beyond brute-forcing in any human timescale.

Maximum length (budgeting)

Instead of generating-and-praying, the generator reserves space for the fixed parts first — separators, the optional digit(s), and any prefix/suffix — then fills the remaining character budget with words drawn only from the pool short enough to still leave room for the rest. The total always lands at or under your cap. If you ask for the impossible (e.g. 5 words in 12 characters), it shows the best short version and tells you why, rather than silently overflowing or truncating text you typed.

Storage & privacy

There is no server and no analytics. Settings and history live in your browser's localStorage, only on your device. Persisted data is treated as untrusted on load and clamped to valid ranges, so a corrupted or edited store can't break generation. (Note: browser storage requires a file:// or https:// origin — it won't persist inside sandboxed previews, only when you open the saved file or visit the hosted page.)

Built as one file

The whole app — markup, styles, the 7,776-word list, and logic — is a single .html document using vanilla JavaScript. No framework, no bundler, no build. That's what makes it trivial to audit, fork, and host.


Run it

Locally: download index.html and double-click it. It works fully offline. (Web fonts load from Google Fonts when you're online and gracefully fall back to system fonts when you're not.)

Hosted (GitHub Pages): see the publishing steps below — the result is a shareable URL.


Tech notes

  • Vanilla HTML/CSS/JavaScript (ES2020+). No dependencies, no build tooling.
  • Theming via CSS custom properties; light/dark by swapping a single data-theme attribute.
  • Accessibility: semantic controls, :focus-visible rings, an aria-live status region, a role="progressbar" strength meter, and a prefers-reduced-motion guard.

Credits

  • Wordlist: the EFF large wordlist (7,776 words) by the Electronic Frontier Foundation, released under CC BY 3.0 US. Thank you, EFF.
  • Inspired by the passphrase generator in Bitwarden.

License

Code is released under the MIT License. The EFF wordlist retains its own CC BY 3.0 US license; attribution to the EFF (above and in the file header) satisfies it — please keep that credit if you fork.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages