Generate a cryptographically random password from EFF's improved Diceware word list
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
eff_large_wordlist.txt
example.js
index.js
package.json
wordlist.json

README.md

eff-diceware-passphrase

Generate a cryptographically random password from EFF's improved Diceware word list

In July 2016, EFF release a more user friendly Diceware list in the article Deep Dive: EFF's New Wordlists for Random Passphrases.

A Diceware list is a dictionary of 6^5 == 7776 words, making it possible to use 5 normal dice as a source of entropy. Since the dictionary is fixed, it is possible to reason about how much entropy each new word (token) contributes to the passphrase; lg(6^5) ≈ 12.9 bits.

However in this module we use the CSRNG builtin to sample n words from the dictionary, and securely shuffle them. The sampling is without replacement as to not confuse the user in case of repeated words. This lowers the entropy by a negligible amount.

Usage

var generatePassphrase = require('eff-diceware-passphrase')

generatePassphrase(8) // List of 8 words
generatePassphrase.entropy(100) // List of words with at least 100 bits of entropy

You can also get the JSON encoded dictionary directly:

var dictionary = require('eff-diceware-passphrase/wordlist.json')

Bundle size considerations

Be aware that the JSON encoded Diceware list is just over 25kb gzipped. Making a minimal Browserify bundle with optimisations will yield a bundle of 34.6kb.

$ browserify -g uglifyify -g unassertify example.js | uglifyjs -cm | gzip - | wc -c
34593

API

generatePassphrase(count)

Generate a list of count words, randomly shuffled and without replacement.

generatePassphrase.words(count)

Alias of above

generatePassphrase.entropy(minimum)

Convenience function for generating a password with at least mimimum bits of entropy.

Install

npm install eff-diceware-passphrase

License

ISC