PKG-CHECKSUM(8)

NAME
pkg checksum - compute or validate file checksums

SYNOPSIS
pkg checksum [-q] [-t type] file ...
pkg checksum [-q] -c hash file ...

DESCRIPTION
pkg checksum computes or validates checksums of files using the same algorithms as the pkg(8) package manager.

In generation mode (without -c), a checksum is computed for each file and printed to standard output in the format “type$hash”.

In validation mode (with -c), the checksum type is extracted from the provided hash and each file is verified against it.

OPTIONS

-c hash, --check hash
    Validate file against the given hash. The hash must be in pkg(8) format “type$hash” or a bare SHA-256 hex string for backward compatibility. Reports “OK” or “FAILED” for each file. Returns 0 only if all files match.

-q, --quiet
    Quiet mode. In generation mode, print only the checksum (no filename). In validation mode, suppress output; only the exit status indicates success or failure.

-t type, --type type
    Select the checksum algorithm and encoding. The default is blake2_base32. Supported types:

    sha256_hex
        SHA-256, hexadecimal encoding (64 characters).
    sha256_base32
        SHA-256, z-base-32 encoding.
    blake2_base32
        BLAKE2b-512, z-base-32 encoding (default).
    blake2s_base32
        BLAKE2s-256, z-base-32 encoding.

EXIT STATUS
In validation mode, a non-zero exit status indicates that at least one file did not match the expected checksum.

EXAMPLES
Compute a BLAKE2b checksum:

    $ pkg checksum /usr/local/bin/curl
    2$ybndr... (/usr/local/bin/curl)

Compute a SHA-256 checksum:

    $ pkg checksum -t sha256_hex /usr/local/bin/curl
    1$a1b2c3... (/usr/local/bin/curl)

Validate a file:

    $ pkg checksum -c '2$ybndr...' /usr/local/bin/curl
    /usr/local/bin/curl: OK

SEE ALSO
pkg_checksum(3), pkg_create(3), pkg_printf(3), pkg_repo_create(3), pkg_repos(3), pkg-keywords(5), pkg-lua-script(5), pkg-repository(5), pkg-script(5), pkg-triggers(5), pkg.conf(5), pkg(8), pkg-add(8), pkg-alias(8), pkg-annotate(8), pkg-audit(8), pkg-autoremove(8), pkg-check(8), pkg-clean(8), pkg-config(8), pkg-create(8), pkg-delete(8), pkg-fetch(8), pkg-help(8), pkg-info(8), pkg-install(8), pkg-key(8), pkg-lock(8), pkg-plugins(8), pkg-query(8), pkg-register(8), pkg-repo(8), pkg-repositories(8), pkg-rquery(8), pkg-rwhich(8), pkg-search(8), pkg-set(8), pkg-shell(8), pkg-shlib(8), pkg-ssh(8), pkg-stats(8), pkg-triggers(8), pkg-unregister(8), pkg-update(8), pkg-updating(8), pkg-upgrade(8), pkg-version(8), pkg-which(8)