Archived
1
1
Fork
You've already forked passphrase
0
I don't feel like keeping up with zig, so this is archived. Check out pp instead. https://codeberg.org/owl/pp
This repository has been archived on 2025年07月07日. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
  • Zig 96.9%
  • Roff 2.7%
  • Shell 0.4%
Find a file
2024年11月29日 23:32:19 +01:00
contrib shuffle words after selection 2024年08月31日 19:31:15 +02:00
share use reservoir sampling 2024年08月17日 18:25:15 +02:00
src remove unused zg module 2024年10月09日 18:10:38 +02:00
.build.yml Updates for Zig master 2023年02月21日 21:44:48 +01:00
.gitignore Handle empty/malformed files 2020年06月21日 13:26:46 +02:00
build.zig remove unused zg module 2024年10月09日 18:10:38 +02:00
build.zig.zon update dependencies 2024年11月29日 23:32:19 +01:00
CHANGELOG.md add unicode option 2024年08月29日 15:10:45 +02:00
LICENSE Update name 2023年07月21日 20:53:31 +02:00
passphrase.1 add unicode option 2024年08月29日 15:10:45 +02:00
README.md shuffle words after selection 2024年08月31日 19:31:15 +02:00

About

Passphrase is a small, simple passphrase generator.

builds.sr.ht status

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.