b2sum - Linux


b2sum is a cryptographic utility that generates and verifies checksums for files using the BLAKE2b hashing algorithm. BLAKE2b is a secure and efficient hashing function designed to be fast and resistant to collision attacks.


b2sum [options] [file1] [file2] ...


-a, –algorithm algorithm
Specify the BLAKE2b variant to use. Valid values are: b2b, b2b-128, b2b-160, b2b-184, b2b-208, b2b-224, b2b-240, b2b-256, b2b-384, b2b-512.
Default: b2b-512

-b, –bytes num
Generate checksums for the first num bytes of the file(s).

-c, –check file
Verify checksums for the file(s), using the provided checksum file.

-d, –dir
Generate checksums recursively for all files in the specified directory(ies) and their subdirectories.

-f, –file file
Read checksums from the specified file and verify them against the file(s).

-h, –help
Display help and exit.

-s, –size
Display the file size and modification time along with the checksum.

-v, –version
Display version information and exit.

-w, –wide
Display checksums in hexadecimal format instead of the default base64.


Generate a checksum for a file:

b2sum myfile.txt

Generate checksums for all files in a directory:

b2sum -d my_directory

Verify checksums using a checksum file:

b2sum -c checksums.txt myfile.txt

Generate checksums using a specific BLAKE2b variant:

b2sum -a b2b-256 myfile.txt

Display checksums in hexadecimal format:

b2sum -w myfile.txt

Common Issues

Error: Cannot find file:
Ensure that the specified file exists and is accessible.

Error: Checksum verification failed:
The file has been modified since the checksum was generated.


b2sum can be integrated with scripts, cron jobs, or other tools for automated checksum verification and file integrity checks. For example:


# Generate checksums for all files in a directory
b2sum -d /my_directory > checksums.txt

# Check checksums once a week
crontab -l | { cat; echo "0 0 * * 0 b2sum -c checksums.txt -d /my_directory >> verification.log"; } | crontab -

# Verify checksums and send email if any failures occur
b2sum -c checksums.txt -d /my_directory | awk '{print $2}' | grep -v OK | mail -s 'Checksum Verification Failure' admin@example.com

Related Commands

  • md5sum
  • sha1sum
  • sha256sum
  • sha512sum