passmake is a tiny, Linux-first command-line password generator written in C.
It prints a cryptographically secure alphanumeric password using uppercase
letters, lowercase letters, and numbers. The same source also builds natively on
macOS.
The normal generation path writes only the password to stdout. Warnings and errors go to stderr. Help, version, and security text are printed only when explicitly requested.
There are no third-party runtime or cryptography dependencies. In particular,
passmake does not use libbsd or require packages from FreeBSD.
- A C11 compiler (
cc, GCC, or Clang) make- Standard POSIX build tools (
install,mkdir, and a POSIX shell)
On Linux, secure randomness comes from getrandom(2), with /dev/urandom as a
compatibility fallback. On macOS, it comes from getentropy(2), with the same
fallback.
makeThat creates ./passmake.
Run the full built-in test suite:
make checkRemove the executable and build products:
make cleanInstall the binary:
sudo make installInstall somewhere else:
make PREFIX="$HOME/.local" installGenerate the default 24-character password:
./passmakeGenerate a specific length:
./passmake 24
./passmake 32Use named length options if desired:
./passmake --length 24
./passmake --length=24--count is accepted as a compatibility alias:
./passmake --count 24
./passmake --count=24Suppress the default trailing newline:
./passmake 24 --no-newlineThis is useful when piping into clipboard tools:
./passmake 24 --no-newline | your-clipboard-commandShow help, version, or the security explanation:
./passmake --help
./passmake --version
./passmake --securityArguments after -- are treated as positional values:
./passmake -- 24- Default length: 24 characters.
- Recommended website password length: 24 or more characters.
- Valid range: 3 to 4096 characters.
- Lengths below 12 are allowed but warn to stderr unless
--quietis used. - The minimum length is mechanical, not recommended. It exists only because the program enforces at least one uppercase letter, one lowercase letter, and one digit.
- Linux uses the kernel CSPRNG through
getrandom(2). - macOS uses the operating-system CSPRNG through
getentropy(2). /dev/urandomis used only as a compatibility fallback.- The alphabet is intentionally alphanumeric:
A-Z,a-z, and0-9. - Rejection sampling avoids modulo bias when mapping random bytes to characters.
- Whole-password rejection keeps output uniform over the subset of alphanumeric strings that satisfy the uppercase, lowercase, and digit requirement.
- Password output uses unbuffered descriptor writes so the password is not copied into a libc-managed stdout buffer.
- Random-byte and password buffers are cleared before exit.
- Core dumps are disabled during password generation where supported.
- Password memory is locked against swapping when the operating system permits it. Failure to lock memory does not prevent generation.
Printing to a terminal can leave the password visible in terminal scrollback.
passmake does not put generated passwords in shell history by itself, but
command substitution, environment variables, clipboards, or manual handling can
expose them. Avoid storing generated passwords in environment variables, and
store generated passwords in a password manager.
0: success2: usage or argument error3: randomness or generation failure4: memory allocation failure5: stdout write failure
The implementation is intentionally small but no longer monolithic:
src/cli.cparses the stable command-line interface and prints diagnostics.src/entropy.ccontains the native Linux/macOS entropy backends and fallback.src/generator.cperforms unbiased character and whole-password sampling.src/platform.cowns memory wiping, process hardening, and descriptor output.src/main.ccoordinates the lifecycle and guarantees cleanup.tests/covers the documented CLI, error codes, output separation, generator internals, output failures, and staged installation.