- Zig 96.9%
- Roff 2.7%
- Shell 0.4%
| contrib | shuffle words after selection | |
| share | use reservoir sampling | |
| src | remove unused zg module | |
| .build.yml | Updates for Zig master | |
| .gitignore | Handle empty/malformed files | |
| build.zig | remove unused zg module | |
| build.zig.zon | update dependencies | |
| CHANGELOG.md | add unicode option | |
| LICENSE | Update name | |
| passphrase.1 | add unicode option | |
| README.md | shuffle words after selection | |
About
Passphrase is a small, simple passphrase generator.
Background
I was using Bitwarden's passphrase generator, which is good, except it only uses English words, and is also very slow. So I made this one. It's pretty fast and you can use any wordlist, or standard input. An English wordlist is included, and is the default.
Implementation
Passphrase uses a reservoir sampling algorithm, so memory usage is proportional to the requested number of words, rather than the size of the wordlist.
Building
The program is written in Zig,
so you will need the Zig compiler,
which is called zig in most package managers.
You can also download a static build if it's not packaged for you.
To build and install the program:
zig build -Doptimize=ReleaseSafe --prefix ~/.local
It installs an executable file in $PREFIX/bin,
so that should be in your $PATH.
To run the tests:
zig build test
To build the manpage:
zig build doc
If you don't need full Unicode support, you can disable it, to save some space:
zig build -Dunicode=false
Usage
Use passphrase -h to see the available options.
Use passphrase < path/to/one-word-per-line.txt or command-that-outputs-one-word-per-line | passphrase
for a custom wordlist. A single word longer than 31 bytes will result in an error.
If the output is piped into another command,
for example passphrase | wl-copy to put the passphrase in the clipboard,
the ending newline is omitted, so that it can be safely pasted.