niceware-eff v1.0.0
niceware-eff
This package is a fork of niceware that uses a wordlist based on the EFF's New Wordlists for Random Passphrases. Because this wordlist is much smaller, it is only useful in scenarios such where brute force attacks are minimized by some other mechanism, such as only giving attackers one chance to guess the password.
Usage in Node
To install:
npm install nicewareTo generate an 8-byte passphrase:
const niceware = require('niceware')
// The number of bytes must be even
const passphrase = niceware.generatePassphrase(8)
// Result: [ 'deathtrap', 'stegosaur', 'nilled', 'nonscheduled' ]Usage in browser
To use Niceware in modern browsers, include
browser/niceware.js in a script
tag. Niceware is then available in the window.niceware object.
<script src='niceware.js'></script>
<script>
const passphrase = window.niceware.generatePassphrase(8)
</script>Niceware uses window.{crypto, msCrypto}.getRandomValues for entropy in the browser.
Docs
NOTE: When used in the browser, Buffer is replaced with window.Uint8Array.
- niceware ⏏
- .bytesToPassphrase(bytes) ⇒ Array.<string>
- .passphraseToBytes(words) ⇒ Buffer
- .generatePassphrase(size) ⇒ Array.<string>
niceware ⏏
Kind: Exported constant
niceware.bytesToPassphrase(bytes) ⇒ Array.<string>
Converts a byte array into a passphrase.
Kind: static method of niceware
| Param | Type | Description |
|---|---|---|
| bytes | Buffer | The bytes to convert |
niceware.passphraseToBytes(words) ⇒ Buffer
Converts a phrase back into the original byte array.
Kind: static method of niceware
| Param | Type | Description |
|---|---|---|
| words | Array.<string> | The words to convert |
niceware.generatePassphrase(size) ⇒ Array.<string>
Generates a random passphrase with the specified number of bytes.
NOTE: size must be an even number.
Kind: static method of niceware
| Param | Type | Description |
|---|---|---|
| size | number | The number of random bytes to use |
Niceware ports
- Chrome extension, thanks to Noah Feder: https://chrome.google.com/webstore/detail/niceware-password/dhnichgmciickpnnnhfcljljnfomadag
- pip package, thanks to Alex Willmer: https://pypi.python.org/pypi/niceware
- CLI, thanks to Alex Cross: https://www.npmjs.com/package/nicepass
Credits
Niceware was inspired by Diceware. Its wordlist is derived from the SIL English word list. This project is based on my work on OpenPGP key backup for the Yahoo End-to-End project.
4 years ago