Yet another simple passphrase generator. See this XKCD for an explanation.
$ npm install correcthorsebatterystaple
var chbs = require('correcthorsebatterystaple');
new chbs();
You can configure the behavior by passing an options object:
new chbs({
min: 15, // Mininum number of characters in returned passphrase. Default 20.
max: 25, // Maximum number of characters in returned passphrase. Default 30.
words: "enable.txt" // Use a different word list. Default "up-goer-five.txt".
});
When specifying a wordlist, if the file isn't found at the path specified, the code will fall back to checking the built-in wordlist
directory for a file with the given name.
By default, the generated passphrase is sent to console.log
. You can change this by passing a callback:
new chbs(function (pwd) {
doSomethingWith(pwd);
});
new chbs({
min: 16,
max: 24
}, function (pwd) {
doSomethingElseWith(pwd);
});
$ ./chbs
pick flip mad forget
up-goer-five.txt
: The 1000 most common words in the English language.enable.txt
: The ENABLE word list (Enhanced North American Benchmark Lexicon).top1000fr.txt
: The 1000 most common words in the French language.top1000de.txt
: The 1000 most common words in the German language.top1000nl.txt
: The 1000 most common words in the Dutch language.
- Randall Munroe for the inspiration and package name.
- Theo Sanderson for the Up Goer Five Word List.
- Peter Norvig for the ENABLE word list.
- University of Leipzig for the French, Dutch, and German word lists.