Skip to content

xsum v0.1.0

Latest
Compare
Choose a tag to compare
@sclevine sclevine released this 11 Mar 02:07
· 4 commits to main since this release
a78caab

Initial release.

xsum is a utility for calculating checksums that supports:

  • 18 cryptographic hash functions
  • 12 non-cryptographic hash functions

The xsum CLI can be used in place of shasum, md5sum, or similar utilities.

xsum differs from existing tools that calculate checksums in that it can:

  • Calculate a single checksum for an entire directory structure using Merkle trees.
    • Merkle trees allow for concurrency when calculating checksums of directories. (See Performance.)
    • Merkle trees are the same data structure used to reference layers in Docker images.
  • Calculate checksums that include file attributes such as type, UID, GID, permissions, etc. (See Format.)
  • Execute plugins, including:
    • xsum-pcm: calculate checksums of raw PCM inside audio files (e.g., AAC, MP3, FLAC, ALAC)
      • Checksums remain constant when audio file metadata/tags change, but still protect audio stream.
      • Install xsum-pcm to $PATH and use xsum -a pcm to invoke.
      • Requires ffmpeg.

Installation

Homebrew

The xsum CLI and plugins are available via Homebrew:

brew install sclevine/tap/xsum
brew install sclevine/tap/xsum-pcm # optional PCM plugin

Invoke xsum-pcm with xsum -a pcm.

Manual

Binaries for macOS, Linux, and Windows are attached to this release.

To install xsum-pcm, copy the binary to $PATH. Invoke it with xsum -a pcm.

Docker

xsum is also available as a Docker image (includes xsum-pcm in :full-0.1.0):

docker pull sclevine/xsum:0.1.0

Usage

Usage:
  xsum [OPTIONS] [paths...]

General Options:
  -a, --algorithm=  Use specified hash function (default: sha256)
  -w, --write=      Write a separate, adjacent file for each checksum
                    By default, filename will be [orig-name].[alg]
                    Use -w=ext or -wext to override extension (no space!)
  -c, --check       Validate checksums
  -s, --status      With --check, suppress all output
  -q, --quiet       With --check, suppress passing checksums
  -v, --version     Show version

Mask Options:
  -m, --mask=       Apply attribute mask as [777]7[+ugx...]:
                    +u	Include UID
                    +g	Include GID
                    +s	Include special file modes
                    +t	Include modified time
                    +c	Include created time
                    +x	Include extended attrs
                    +i	Include top-level metadata
                    +n	Exclude file names
                    +e	Exclude data
                    +l	Always follow symlinks
  -d, --dirs        Directory mode (implies: -m 0000)
  -p, --portable    Portable mode, exclude names (implies: -m 0000+p)
  -g, --git         Git mode (implies: -m 0100)
  -f, --full        Full mode (implies: -m 7777+ug)
  -x, --extended    Extended mode (implies: -m 7777+ugxs)
  -e, --everything  Everything mode (implies: -m 7777+ugxsct)
  -i, --inclusive   Include top-level metadata (enables mask, adds +i)
  -l, --follow      Follow symlinks (enables mask, adds +l)
  -o, --opaque      Encode attribute mask to opaque, fixed-length hex (enables mask)

Help Options:
  -h, --help        Show this help message