b2sumx
Print or check BLAKE2b (512-bit) checksums.
Mirrors GNU b2sum. Run it as b2sumx, or as gnux b2sumx.
Synopsis
b2sumx [OPTION]... [FILE]...GNU reference
Description
b2sumx prints or checks BLAKE2b message digests (RFC 7693, 512 bits). For each FILE it prints one line: the digest in hexadecimal, a space, a mode mark (a space for text mode, '*' with -b), and the file name. With no FILE, or when FILE is -, it reads standard input. Files are always read as bytes, so -b and -t change only the mark; when both are given, -t wins. --tag prints BSD-style lines instead ('ALGORITHM (FILE) = DIGEST'). A file name containing a backslash, newline or carriage return is escaped and its line starts with a backslash, unless -z ends lines with NUL instead. -c reads such lines (in either style) from the FILEs and checks each listed file, printing 'FILE: OK' or 'FILE: FAILED' and a summary warning of mismatches, unreadable files and improperly formatted lines; --quiet drops the OK lines, --status prints nothing, --ignore-missing skips listed files that do not exist, -w warns about each improperly formatted line and --strict fails because of them. The exit status is 0 when everything was read (and, with -c, matched), 1 otherwise. -l BITS shortens the digest to BITS bits, a multiple of 8 up to 512; tagged lines then name the length ('BLAKE2b-256'). On Windows a backslash in a file name is the path separator, so it is not escaped as GNU escapes it on Unix; a name with a newline is still escaped.
Permissions
Needs read permission on each FILE (and, with -c, on the checksum lists and every file they name) and search permission on the directories leading to them. Nothing is ever modified. On a terminal, gnux's terminal view colors OK and FAILED in -c output and ends each list with a count ('3 OK, 1 FAILED'); piped or redirected output is exactly GNU's, and --pretty=never or GNUX_PRETTY=never turns it off.
Use cases
- Verifying a download against the checksum its publisher lists.
- Recording digests of release artifacts so users can check them.
- Detecting whether files changed between two points in time.
- Finding duplicate files by comparing their digests.
- Checking a backup or a copy against the original.
Flags
-b, --binary read in binary mode
-c, --check read checksums from the FILEs and check them
--help display this help and exit
--ignore-missing don't fail or report status for missing files
-l, --length bits digest length in bits; must not exceed the maximum for the blake2 algorithm and must be a multiple of 8
--pretty WHEN[="always"] the gnux terminal view WHEN: 'always' (the default when WHEN is omitted), 'auto' (the default: on a terminal only), or 'never'; GNUX_PRETTY sets the default
--quiet don't print OK for each successfully verified file
--status don't output anything, status code shows success
--strict exit non-zero for improperly formatted checksum lines
--tag create a BSD-style checksum
-t, --text read in text mode (default)
--theme NAME color the view with the built-in theme NAME (gnux theme picks and saves one); GNUX_THEME sets the default
--version output version information and exit
-w, --warn warn about improperly formatted checksum lines
-z, --zero end each output line with NUL, not newline, and disable file name escapingExamples
You downloaded an installer: print its digest to compare with the one on the website
b2sumx ubuntu-24.04-desktop-amd64.isoVerify the download against the publisher's checksum file, which lists other files too
b2sumx -c --ignore-missing b2.sumsubuntu-24.04-desktop-amd64.iso: OKPublish checksums next to your release archives
b2sumx dist/*.tar.gz > dist/b2.sumsCheck that a backup copied to a USB drive still matches the original
b2sumx photos.tar /media/usb/photos.tarFind duplicate photos in a folder: files with the same digest have the same content
b2sumx *.jpg | sortx | uniqx -w 128 -DIn CI, fail the build when a vendored file was changed by hand
b2sumx -c --status vendor.b2sums || { echox 'vendored files changed' >&2; exit 1; }Re-check a large archive set and show only what no longer matches
b2sumx -c --quiet b2.sumsnotes.txt: FAILED
b2sumx: WARNING: 1 computed checksum did NOT matchHash a token from a variable, without the newline echo would add
printfx '%s' "$TOKEN" | b2sumxWrite lines that name the algorithm, so a mixed list can be checked with cksumx -c
b2sumx --tag release.tar.gz >> CHECKSUMSRefuse a checksum list with malformed lines instead of skipping them
b2sumx -c --strict -w b2.sumsMatch the '*' binary-mode lines produced by tools on Windows
b2sumx -b setup.exeUse a shorter, 256-bit digest as a compact content ID for cache keys
b2sumx -l 256 package-lock.jsonRecord a digest next to the file in the portable gnux shell, the same on every OS
gnux shell -c 'b2sumx file.iso > file.iso.b2sum'Options
Each option has a page of its own, with its usage and examples.
- -b, --binary: Read in binary mode.
- -c, --check: Read checksums from the FILEs and check them.
- --ignore-missing: Don't fail or report status for missing files.
- -l, --length: Digest length in bits; must not exceed the maximum for the blake2 algorithm and must be a multiple of 8.
- --pretty: The
gnuxterminal view WHEN: 'always' (the default when WHEN is omitted), 'auto' (the default: on a terminal only), or 'never'; GNUX_PRETTY sets the default. - --quiet: Don't print OK for each successfully verified file.
- --status: Don't output anything, status code shows success.
- --strict: Exit non-zero for improperly formatted checksum lines.
- --tag: Create a BSD-style checksum.
- -t, --text: Read in text mode (default).
- --theme: Color the view with the built-in theme NAME (
gnuxtheme picks and saves one); GNUX_THEME sets the default. - -w, --warn: Warn about improperly formatted checksum lines.
- -z, --zero: End each output line with NUL, not newline, and disable file name escaping.
Exit status
| Status | Meaning |
|---|---|
| 0 | success: every operand was processed |
| 1 | failure: an operand could not be processed (diagnosed on standard error), or a command-line mistake |
Help in the terminal
b2sumx --help # options, first examples, exit status
gnux help b2sumx # this page: the full manual
gnux help b2sumx --OPTION # one option in depth, with its examples