Crypt::...Adler32(3)
π NAME π
okay so bestie, welcome to the Crypt::...Adler32(3) page from the User Contributed Perl Documentation crew. This one is all about Crypt::Checksum::Adler32 β literally Compute Adler32 checksum. That's the name, that's the vibe, periodt. π
β¨ SYNOPSIS β¨
Two ways to serve this checksum realness: the functional interface and the OO interface. Both are iconic, no cap. π
### Functional interface:
use Crypt::Checksum::Adler32 ':all';
# calculate Adler32 checksum from string/buffer
my $data = 'data string';
my $checksum_raw = adler32_data($data);
my $checksum_hex = adler32_data_hex($data);
my $checksum_int = adler32_data_int($data);
# or from file
my $checksum_file_raw = adler32_file('filename.dat');
my $checksum_file_hex = adler32_file_hex('filename.dat');
my $checksum_file_int = adler32_file_int('filename.dat');
# or from filehandle
my $filehandle = ...; # existing binary-mode filehandle
my $checksum_fh_raw = adler32_file($filehandle);
my $checksum_fh_hex = adler32_file_hex($filehandle);
my $checksum_fh_int = adler32_file_int($filehandle);
### OO interface:
use Crypt::Checksum::Adler32;
my $d = Crypt::Checksum::Adler32->new;
$d->add('any data');
$d->add('another data');
my $checksum_raw = $d->digest; # raw 4 bytes
my $checksum_hex = $d->hexdigest; # hexadecimal form
my $checksum_int = $d->intdigest; # 32-bit unsigned integer
# or checksum a file instead
my $checksum_file_raw = Crypt::Checksum::Adler32->new->addfile('filename.dat')->digest;
π¦ DESCRIPTION π¦
It computes Adler-32 checksums. That's the whole assignment. π
Updated: v0.057 β noted, bestie. β¨
πΈ EXPORT πΈ
Nothing is exported by default. Zero, zilch, none. π
You can export selected functions if you're feeling picky:
use Crypt::Checksum::Adler32 qw(adler32_data adler32_data_hex adler32_data_int adler32_file adler32_file_hex adler32_file_int);
Or all of them at once, because why not:
use Crypt::Checksum::Adler32 ':all';
π§ FUNCTIONS π§
π adler32_data π
Returns the checksum as raw octets. Raw bytes, no filter. π«Ά
my $checksum_raw = adler32_data('data string');
#or
my $checksum_raw = adler32_data('any data', 'more data', 'even more data');
π adler32_data_hex π
Returns checksum as a hexadecimal string. Hex girl summer. π
my $checksum_hex = adler32_data_hex('data string');
#or
my $checksum_hex = adler32_data_hex('any data', 'more data', 'even more data');
β adler32_data_int β
Returns checksum as unsigned 32-bit integer. Number-coded but make it checksum. π₯
my $checksum_int = adler32_data_int('data string');
#or
my $checksum_int = adler32_data_int('any data', 'more data', 'even more data');
Each adler32_data* function converts its data arguments to bytes using Perl's usual scalar stringification. Defined scalars, including numbers and string-overloaded objects, are accepted. undef is treated as an empty string and may emit Perl's usual "uninitialized value" warning. π
π¦ adler32_file π¦
Returns the checksum as raw octets. File edition. π
my $checksum_raw = adler32_file('filename.dat');
#or
my $filehandle = ...; # existing binary-mode filehandle
my $checksum_raw = adler32_file($filehandle);
π adler32_file_hex π
Returns checksum as a hexadecimal string. Same file energy, hex-flavored. β¨
my $checksum_hex = adler32_file_hex('filename.dat');
#or
my $filehandle = ...; # existing binary-mode filehandle
my $checksum_hex = adler32_file_hex($filehandle);
π adler32_file_int π
Returns checksum as unsigned 32-bit integer. File checksum but make it an integer. π
my $checksum_int = adler32_file_int('filename.dat');
#or
my $filehandle = ...; # existing binary-mode filehandle
my $checksum_int = adler32_file_int($filehandle);
π METHODS π
π new π
Constructor, returns a reference to the checksum object. Brand-new object, fresh out the box. ποΈ
my $d = Crypt::Checksum::Adler32->new;
πΈ clone πΈ
Creates a copy of the checksum object state and returns a reference to the copy. Twin energy, but checksum-coded. π«Ά
$d->clone();
π¦ reset π¦
Reinitialize the checksum object state and returns a reference to the checksum object. Clean slate, bestie. π§Ό
$d->reset();
β add β
All arguments are appended to the message we calculate checksum for. The return value is the checksum object itself. Chainable and cunty, honestly. π
Each argument is converted to bytes using Perl's usual scalar stringification. Defined scalars, including numbers and string-overloaded objects, are accepted. undef is treated as an empty string and may emit Perl's usual "uninitialized value" warning. π
$d->add('any data');
#or
$d->add('any data', 'more data', 'even more data');
π addfile π
The content of the file (or filehandle) is appended to the message we calculate checksum for. The return value is the checksum object itself. File-handling realness incoming. ποΈ
$d->addfile('filename.dat');
#or
my $filehandle = ...; # existing binary-mode filehandle
$d->addfile($filehandle);
β οΈ Note: The filehandle must be in binary mode before you pass it to addfile(). Do not skip this step, bestie, fr fr. π«Ά
π₯ digest π₯
Returns the binary checksum (raw bytes). This method does not alter the object state, so you can call it repeatedly and continue with add() or addfile() afterwards. Reusable, iconic, no notes. β¨
my $result_raw = $d->digest();
π hexdigest π
Returns the checksum encoded as a hexadecimal string. Like digest(), this method does not alter the object state. Hex string serving looks. π
my $result_hex = $d->hexdigest();
π intdigest π
Returns the checksum encoded as unsigned 32-bit integer. Like digest(), this method does not alter the object state. Integer representation, main character energy. β
my $result_int = $d->intdigest();
π SEE ALSO π
mwah π β this lil manual moment is brought to you by perl v5.42.0, dated 2026-05-11, and it's the Crypt::...Adler32(3) footer, bestie. Slay safely. π«Άβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-CryptX 0.89.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- opensuse-leap 16.0: perl-CryptX 0.89.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- opensuse-leap 16.0: perl-CryptX 0.89.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- opensuse-leap 16.0: perl-CryptX 0.89.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms