Skip to content

rfreebern/CorrectHorseBatteryStaple.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Correct Horse Battery Staple

Yet another simple passphrase generator. See this XKCD for an explanation.

Installation

$ npm install correcthorsebatterystaple

Usage

Module

var chbs = require('correcthorsebatterystaple');
new chbs();

Options

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.

Callback

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);
});

Command-line script

$ ./chbs
pick flip mad forget

Included word lists

  • 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.

Thanks

About

Yet another XKCD-inspired passphrase generator.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published