Skip to content

norskeld/diceware

Repository files navigation

diceware

Checks

Rust crate and CLI for generating strong Diceware passphrases.

Installation

macOS Intel (Homebrew)

brew tap norskeld/tap
brew install norskeld/tap/diceware

macOS / Linux / Windows (Cargo)

Make sure to install Rust toolchain first. After that you can install Diceware via Cargo:

cargo install --locked --git https://github.com/norskeld/diceware

CLI usage

Just invoke diceware --help. It's really simple.

Generates strong Diceware passphrases.

Usage: diceware [OPTIONS]

Options:
  -l, --length <LENGTH>        How much words to generate [default: 6]
  -w, --wordlist <WORDLIST>    Path to a custom wordlist
  -e, --entropy                Show entropy of the passphrase
  -c, --capitalize             Capitalize words
  -d, --delimiter <DELIMITER>  Delimiter to use for joining words
  -p, --preset <PRESET>        Formatting preset to use [possible values: pascal, kebab, snake]
  -h, --help                   Print help
  -V, --version                Print version

Example of output

$ diceware --entropy

probation overdraft debtor ground nintendo sculptor

Possibilities: 7776
Entropy: 77.55 bits

More about entropy at https://theworld.com/~reinhold/dicewarefaq.html#entropy

Crate usage

You can use this crate as a git dependency:

[dependencies]
diceware = { git = "https://github.com/norskeld/diceware" }

Simple example:

use diceware::{Passphraser, Preset};

fn main() {
  let passphrase = Passphraser::new(6)
    .preset(Preset::KebabCase)
    .generate();

  println!("{}", passphrase.format())
}

Notes

By default CLI uses the EFF long wordlist, which is a little bit better than the one original one.

Diceware

In short, passphrases are generated by "throwing" a dice five times, joining the numbers into one, and then looking up for the word with the corresponding number in the wordlist. This process repeats N times (default is 6) until all words are found. You can find more information about that technique on the official Diceware page or on the Diceware FAQ page.

License

MIT.