• v2.0.1 aefe74a482

    v2.0.1 Stable

    sezieru released this 2025-10-13 21:32:53 +00:00 | 66 commits to main since this release

    RexCrypt v2.0.1

    Teaching-focused release of a small, readable crypt(3) demo with a clean CLI, strong inline commentary, and a black-box TAP test harness.

    Highlights

    • Non-TTY handling: if stdin isn’t a TTY and -k isn’t provided, RexCrypt exits with a helpful hint instead of prompting.
    • -k - (stdin): read the secret from standard input for scripting; trailing newline is trimmed.
    • Length bound: passphrase input is capped by CRYPT_MAX_PASSPHRASE_SIZE (commonly 512 bytes) to match struct crypt_data.
    • Built-in help (-?): concise usage() with options, algorithm table, and examples (printed to stderr for easy piping).
    • TAP v14 tests: make test runs a small suite that treats RexCrypt as a black box (prefix checks, stdin path, non-TTY error path).
    • Safer memory handling: fix and use a standards-compliant copymem() demo.
    • Clean repo layout: src/ for the tool, tests/ for the TAP harness + comparators, bin/ for outputs.

    CLI

    rexcrypt [-c <cpu_tim>] [-r <resalt>] [-a <alg>] [-k <key>|-]
    
    • -c <cpu_tim>: library-defined cost/rounds/time knob (unsigned long).
    • -r <resalt>: respin the salt N extra times after the first generation (default 0).
    • -a <alg>: algorithm selector (0..9, a, b) – availability depends on your libxcrypt build.
    • -k <key>: provide the secret inline; omit to be prompted via getpass().
    • -k -: read the secret from stdin (for scripting; echo is not disabled).

    Build / Test

    make            # builds ./bin/rexcrypt
    make test       # runs TAP v14 tests
    

    Requires a C compiler (clang/gcc) and libxcrypt/libcrypt headers + library.

    Notable changes since 1.x

    • New non-TTY check & -k - code path.
    • Input buffer sized to CRYPT_MAX_PASSPHRASE_SIZE to match crypt_r limits.
    • Usage/help text expanded; README synced with CLI behavior.
    • TAP harness upgraded and modularized (tests/ with comparator modules).
    • Minor fixes and comment cleanups to keep the code strictly C-portable and student-friendly.

    Notes

    • The tool is educational, not a drop-in production password solution.
    • Algorithm availability and exact semantics of -c depend on your system’s libxcrypt build.
    Downloads