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: 12 months ago
JSON representation
Rust crate and CLI for generating Diceware passphrases.
- Host: GitHub
- URL: https://github.com/norskeld/diceware
- Owner: norskeld
- License: mit
- Created: 2022-01-11T10:08:03.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-16T11:29:18.000Z (about 2 years ago)
- Last Synced: 2024-04-16T14:37:25.676Z (about 2 years ago)
- Topics: cli, diceware, hacktoberfest, passphrase-generator, rust
- Language: Rust
- Homepage:
- Size: 92.8 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `⁙` diceware
[](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