LinuxCommandLibrary

b2sum

Calculate or verify BLAKE2 checksums

TLDR

Calculate the BLAKE2 checksum for one or more files

$ b2sum [path/to/file1 path/to/file2 ...]
copy

Calculate and save the list of BLAKE2 checksums to a file
$ b2sum [path/to/file1 path/to/file2 ...] > [path/to/file].b2
copy

Calculate a BLAKE2 checksum from stdin
$ [command] | b2sum
copy

Read a file of BLAKE2 checksums and filenames and verify all files have matching checksums
$ b2sum [[-c|--check]] [path/to/file].b2
copy

Only show a message for missing files or when verification fails
$ b2sum [[-c|--check]] --quiet [path/to/file].b2
copy

Only show a message when verification fails, ignoring missing files
$ b2sum --ignore-missing [[-c|--check]] --quiet [path/to/file].b2
copy

Check a known BLAKE2 checksum of a file
$ echo [known_blake2_checksum_of_the_file] [path/to/file] | b2sum [[-c|--check]]
copy

SYNOPSIS

b2sum [OPTION]... [FILE]...

PARAMETERS

-a, --algorithm=TYPE
    select algorithm (blake2b or blake2s)

-b, --binary
    use binary output format

-c, --check
    read checksums from FILEs and verify them

--debug
    output debug information

-l, --length=BYTES
    digest length in bytes (blake2b:1-64, blake2s:1-32; default 64)

--tag
    use BSD-style checksum format

-w, --warn
    warn about unrecognized lines in check files

-z, --zero
    end lines with NUL, disable filename escaping

--help
    display help and exit

--version
    output version information and exit

DESCRIPTION

b2sum is a command-line tool from GNU coreutils for calculating and verifying BLAKE2 checksums. BLAKE2 is a fast, secure cryptographic hash function family, with b2sum primarily handling BLAKE2b (512-bit digest, default 64 bytes) and optionally BLAKE2s (256-bit). It mirrors tools like sha256sum or md5sum, producing checksums for files or stdin. Default output is hexadecimal checksum, two spaces, filename (e.g., ba6a6e762a7eb73a...
file.txt
). Supports verification via --check, reading checksum files and reporting matches/mismatches. Key features include adjustable digest lengths, binary output, NUL termination for scripting, and BSD-style tags. BLAKE2 offers high security against collisions/preimages, high speed on modern CPUs, and no known weaknesses, making it ideal for file integrity, digital signatures, and key derivation. Introduced for replacing slower SHA variants in many uses.

CAVEATS

Digest length truncates full hash; verify with exact length used. Blake2s limited to 32 bytes max.

DEFAULT CHECKSUM LINE

<hexdigest> <filename>
(two spaces separate)

VERIFICATION EXIT CODES

0: OK
1: errors, readahead issues
2: general error

HISTORY

Added to GNU coreutils in version 8.26 (January 2017) by Padraig Brady.

SEE ALSO

sha256sum(1), sha1sum(1), md5sum(1), cksum(1)

Copied to clipboard