.\" -*- mode: troff; coding: utf-8 -*-
.\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
.ie n \{\
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds C`
.    ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
.    if \nF \{\
.        de IX
.        tm Index:\\$1\t\\n%\t"\\$2"
..
.        if !\nF==2 \{\
.            nr % 0
.            nr F 2
.        \}
.    \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "Crypt::Checksum::Adler32 3"
.TH Crypt::Checksum::Adler32 3 2023-09-25 "perl v5.38.0" "User Contributed Perl Documentation"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH NAME
Crypt::Checksum::Adler32 \- Compute Adler32 checksum
.SH SYNOPSIS
.IX Header "SYNOPSIS"
.Vb 2
\&   ### Functional interface:
\&   use Crypt::Checksum::Adler32 \*(Aq:all\*(Aq;
\&
\&   # calculate Adler32 checksum from string/buffer
\&   $checksum_raw  = adler32_data($data);
\&   $checksum_hex  = adler32_data_hex($data);
\&   $checksum_int  = adler32_data_int($data);
\&   # calculate Adler32 checksum from file
\&   $checksum_raw  = adler32_file(\*(Aqfilename.dat\*(Aq);
\&   $checksum_hex  = adler32_file_hex(\*(Aqfilename.dat\*(Aq);
\&   $checksum_int  = adler32_file_int(\*(Aqfilename.dat\*(Aq);
\&   # calculate Adler32 checksum from filehandle
\&   $checksum_raw  = adler32_file(*FILEHANDLE);
\&   $checksum_hex  = adler32_file_hex(*FILEHANDLE);
\&   $checksum_int  = adler32_file_int(*FILEHANDLE);
\&
\&   ### OO interface:
\&   use Crypt::Checksum::Adler32;
\&
\&   $d = Crypt::Checksum::Adler32\->new;
\&   $d\->add(\*(Aqany data\*(Aq);
\&   $d\->add(\*(Aqanother data\*(Aq);
\&   $d\->addfile(\*(Aqfilename.dat\*(Aq);
\&   $d\->addfile(*FILEHANDLE);
\&   $checksum_raw  = $d\->digest;     # raw 4 bytes
\&   $checksum_hex  = $d\->hexdigest;  # hexadecimal form
\&   $checksum_int  = $d\->intdigest;  # 32bit unsigned integer
.Ve
.SH DESCRIPTION
.IX Header "DESCRIPTION"
Calculating Adler32 checksums.
.PP
\&\fIUpdated: v0.057\fR
.SH EXPORT
.IX Header "EXPORT"
Nothing is exported by default.
.PP
You can export selected functions:
.PP
.Vb 1
\& use Crypt::Checksum::Adler32 qw(adler32_data adler32_data_hex adler32_data_int adler32_file adler32_file_hex adler32_file_int);
.Ve
.PP
Or all of them at once:
.PP
.Vb 1
\& use Crypt::Checksum::Adler32 \*(Aq:all\*(Aq;
.Ve
.SH FUNCTIONS
.IX Header "FUNCTIONS"
.SS adler32_data
.IX Subsection "adler32_data"
Returns checksum as raw octects.
.PP
.Vb 3
\& $checksum_raw = adler32_data(\*(Aqdata string\*(Aq);
\& #or
\& $checksum_raw = adler32_data(\*(Aqany data\*(Aq, \*(Aqmore data\*(Aq, \*(Aqeven more data\*(Aq);
.Ve
.SS adler32_data_hex
.IX Subsection "adler32_data_hex"
Returns checksum as a hexadecimal string.
.PP
.Vb 3
\& $checksum_hex = adler32_data_hex(\*(Aqdata string\*(Aq);
\& #or
\& $checksum_hex = adler32_data_hex(\*(Aqany data\*(Aq, \*(Aqmore data\*(Aq, \*(Aqeven more data\*(Aq);
.Ve
.SS adler32_data_int
.IX Subsection "adler32_data_int"
Returns checksum as unsigned 32bit integer.
.PP
.Vb 3
\& $checksum_int = adler32_data_int(\*(Aqdata string\*(Aq);
\& #or
\& $checksum_int = adler32_data_int(\*(Aqany data\*(Aq, \*(Aqmore data\*(Aq, \*(Aqeven more data\*(Aq);
.Ve
.SS adler32_file
.IX Subsection "adler32_file"
Returns checksum as raw octects.
.PP
.Vb 3
\& $checksum_raw = adler32_file(\*(Aqfilename.dat\*(Aq);
\& #or
\& $checksum_raw = adler32_file(*FILEHANDLE);
.Ve
.SS adler32_file_hex
.IX Subsection "adler32_file_hex"
Returns checksum as a hexadecimal string.
.PP
.Vb 3
\& $checksum_hex = adler32_file_hex(\*(Aqfilename.dat\*(Aq);
\& #or
\& $checksum_hex = adler32_file_hex(*FILEHANDLE);
.Ve
.SS adler32_file_int
.IX Subsection "adler32_file_int"
Returns checksum as unsigned 32bit integer.
.PP
.Vb 3
\& $checksum_int = adler32_file_int(\*(Aqfilename.dat\*(Aq);
\& #or
\& $checksum_int = adler32_file_int(*FILEHANDLE);
.Ve
.SH METHODS
.IX Header "METHODS"
.SS new
.IX Subsection "new"
Constructor, returns a reference to the checksum object.
.PP
.Vb 1
\& $d = Crypt::Checksum::Adler32\->new;
.Ve
.SS clone
.IX Subsection "clone"
Creates a copy of the checksum object state and returns a reference to the copy.
.PP
.Vb 1
\& $d\->clone();
.Ve
.SS reset
.IX Subsection "reset"
Reinitialize the checksum object state and returns a reference to the checksum object.
.PP
.Vb 1
\& $d\->reset();
.Ve
.SS add
.IX Subsection "add"
All arguments are appended to the message we calculate checksum for.
The return value is the checksum object itself.
.PP
.Vb 3
\& $d\->add(\*(Aqany data\*(Aq);
\& #or
\& $d\->add(\*(Aqany data\*(Aq, \*(Aqmore data\*(Aq, \*(Aqeven more data\*(Aq);
.Ve
.SS addfile
.IX Subsection "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.
.PP
.Vb 3
\& $d\->addfile(\*(Aqfilename.dat\*(Aq);
\& #or
\& $d\->addfile(*FILEHANDLE);
.Ve
.PP
\&\fBBEWARE:\fR You have to make sure that the filehandle is in binary mode before you pass it as argument to the \fBaddfile()\fR method.
.SS digest
.IX Subsection "digest"
Returns the binary checksum (raw bytes).
.PP
.Vb 1
\& $result_raw = $d\->digest();
.Ve
.SS hexdigest
.IX Subsection "hexdigest"
Returns the checksum encoded as a hexadecimal string.
.PP
.Vb 1
\& $result_hex = $d\->hexdigest();
.Ve
.SS intdigest
.IX Subsection "intdigest"
Returns the checksum encoded as unsigned 32bit integer.
.PP
.Vb 1
\& $result_int = $d\->intdigest();
.Ve
.SH "SEE ALSO"
.IX Header "SEE ALSO"
.IP \(bu 4
CryptX
.IP \(bu 4
<https://en.wikipedia.org/wiki/Adler\-32>
