Skip to content

topaz1008/SentenceToPassword

Repository files navigation

Sentence to Password — KeePass 2.x Plugin

Registers a custom algorithm in the KeePass password generator that turns a memorable sentence into a password (the Bruce Schneier method).

"I bought my first car in 1995 for five thousand dollars and it was blue!"
                              ↓
                      Ibm1ci1995f51k$&iwB!

Security notes

  • Strength comes entirely from the sentence being unpredictable. Avoid quotes, lyrics, and anything guessable. The strength meter flags short sentences.
  • This implementation avoids C# managed strings and uses only char[] which are zeroed out when no longer needed.
  • The generated password is held in a KeePass ProtectedString (XOR-obfuscated in memory). The sentence is cleared from the input fields on dialog close.
  • For passwords that don't need to be memorable, KeePass's built-in random generator is stronger.

The sentence is never stored. Only the (non-secret) transformation settings are saved in the KeePass profile.


Install

  1. Download SentenceToPassword.plgx or SentenceToPassword.dll from Releases into KeePass's Plugins folder.
  2. Restart KeePass.
  3. Confirm under Tools → Plugins that SentenceToPassword appears.

Use

  1. In an entry, open Password → Open Password Generator…
  2. Select Generate using custom algorithm → Sentence to Password.
  3. Click OK, type your sentence, click OK.

Transformation rules (per word, in priority order)

# Rule Example
1 Pure number → kept whole 19951995
2 Number word / ordinal → digit(s) five5, thousand1k, first1
3 Substitution map → symbol and&, plus+, not!
4 Otherwise → first N letter(s) boughtb

Symbol substitutions

Word Symbol Word Symbol
and & or |
at @ not !
plus + minus -
times * equals =
percent % dollar / dollars $
number # question ?

Number words covered

Single digits (zeronine), teens (tennineteen), tens (twentyninety), hundred100, thousand1k, million1m, billion1b, and all ordinal forms (firstnineteenth, twentiethninetieth, hundredth, thousandth).


Settings

Accessible via the Settings… button in the sentence prompt or the settings icon next to the algorithm in the KeePass generator:

Setting Effect
Capitalize initials None / First & last word / Every word
Letters per word 1–5
Word separator None / preset single char (- _ . @ # ! / |)
Custom pattern — type up to 8 characters and they cycle between words (e.g. @&% gives I@a&i%o)
Minimum word length Skip words shorter than N letters (1–5)
Keep numbers as-is 1995 stays 1995
Convert number words five5, thousand1k
Symbol substitutions and&, plus+, not!, …
Preserve punctuation blue! keeps its !
Leetspeak a@ e3 i1 o0 s$
Reverse letter order Take letters from the end of each word instead
Include tail letter Append the last letter of each word after the initial(s) (boughtbt)
Skip stop words Drop common function words (the, is, was, with, …)

To extend the built-in word maps, edit NumberWords, Substitutions and StopWords in SentenceTransformer.cs.


Sentence input

The sentence box grows automatically as you type, up to five lines, then scrolls. Check Hide what I type to switch to a masked single-line field.


Build

Requires KeePass 2.x and .NET Framework 4.x tooling. The project targets C# 5 — do not use C# 6+ syntax.

For IntelliSense in your IDE, set the KeePass reference's HintPath in the .csproj to your local KeePass.exe.

Automated Build (.plgx)

A PowerShell script is provided to compile the plugin into plgx and move it into the Plugins folder.

It assumes the project folder lives inside your KeePass installation directory alongside KeePass.exe.

.\build-plgx.ps1

Manual build:

KeePass.exe --plgx-create "PATH_TO_THIS_PROJECT_ROOT"

Screenshots

settings.png main.png

About

A custom KeePass 2.x password generator plugin that turns a memorable sentence into a password (the Bruce Schneier method)

Topics

Resources

License

Stars

Watchers

Forks

Contributors