Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/norskeld/diceware

Rust crate and CLI for generating Diceware passphrases.
https://github.com/norskeld/diceware

cli diceware hacktoberfest passphrase-generator rust

Last synced: about 2 months ago
JSON representation

Rust crate and CLI for generating Diceware passphrases.

Awesome Lists containing this project

README

        

# `⁙` diceware

[![Checks](https://img.shields.io/github/actions/workflow/status/norskeld/diceware/check.yml?style=flat-square&colorA=22272d&colorB=22272d&label=checks)](https://github.com/norskeld/diceware/actions)

Rust crate and CLI for generating strong [Diceware] passphrases.

## Installation

### macOS Intel (Homebrew)

```shell
brew tap norskeld/tap
brew install norskeld/tap/diceware
```

### macOS / Linux / Windows (Cargo)

Make sure to [install Rust toolchain][rust-toolchain] first. After that you can install Diceware via **Cargo**:

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

## CLI usage

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

```shell
Generates strong Diceware passphrases.

Usage: diceware [OPTIONS]

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

## Example of output

```shell
$ 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:

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

Simple example:

```rust
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][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][diceware-official] or on [the Diceware FAQ page][diceware-faq].

## License

[MIT](LICENSE).

[diceware]: https://en.wikipedia.org/wiki/Diceware
[eff-long-wordlist]: https://eff.org/deeplinks/2016/07/new-wordlists-random-passphrases
[formula]: https://docs.brew.sh/Formula-Cookbook
[eff-wordlist]: https://eff.org/deeplinks/2016/07/new-wordlists-random-passphrases
[diceware-official]: https://theworld.com/~reinhold/diceware.html
[diceware-faq]: https://theworld.com/~reinhold/dicewarefaq.html
[rust-toolchain]: https://www.rust-lang.org/tools/install