Digest::BLAKE3 - Perl extension for the BLAKE3 hash function
use Digest::BLAKE3; my $hasher = Digest::BLAKE3::->new(); $hasher->add($data); $hasher->addfile($filehandle); $hash = $hasher->digest();
The Digest::BLAKE3 module is a Perl wrapper for the libblake3 library providing the BLAKE3 hash function, as found at https://blake3.io/.
Digest::BLAKE3
libblake3
Because building libblake3 can get finicky (especially if you don't have the latest and greatest compiler versions), it is not included with this module. You have to build and install it yourself first.
The module provides the usual Digest::* family object-oriented interface.
Digest::*
An alias for the new_hash method;
As a class method, creates a new hasher in hash mode. As an object method, reinitialises an existing hasher to use hash mode.
As a class method, creates a new hasher in keyed hash mode. As an object method, reinitialises an existing hasher to use keyed hash mode.
The key must be a 32-byte string.
As a class method, creates a new hasher in key derivation mode. As an object method, reinitialises an existing hasher to use key derivation mode.
The context is a byte string of any length.
Returns a new hasher with the same state, mode, and output size as the original.
Resets an existing hasher without changing its mode.
Updates the hasher state with each of the given byte strings.
Updates the hasher with all the bytes read from the given file handle until end-of-file.
Opens the named file in binary mode and updates the hasher with the contents.
Returns the final hash value as a byte string and resets the hasher.
Returns the final hash value as a hexadecimal text string and resets the hasher.
Returns the final hash value as a base-64 text string and resets the hasher.
Returns the current output hash size and optionally sets a new output hash size. The value is given in bits and must be a positive multiple of 8. The default is 256 bits.
Returns the current mode as a string; one of "hash", "keyed_hash", or "derive_key".
Bo Lindbergh <blgl@stacken.kth.se>
To install Digest::BLAKE3, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Digest::BLAKE3
CPAN shell
perl -MCPAN -e shell install Digest::BLAKE3
For more information on module installation, please visit the detailed CPAN module installation guide.