1Crypt::Checksum::Adler3U2s(e3r)Contributed Perl DocumentCartyipotn::Checksum::Adler32(3)
2
3
4

NAME

6       Crypt::Checksum::Adler32 - Compute Adler32 checksum
7

SYNOPSIS

9          ### Functional interface:
10          use Crypt::Checksum::Adler32 ':all';
11
12          # calculate Adler32 checksum from string/buffer
13          $checksum_raw  = adler32_data($data);
14          $checksum_hex  = adler32_data_hex($data);
15          $checksum_int  = adler32_data_int($data);
16          # calculate Adler32 checksum from file
17          $checksum_raw  = adler32_file('filename.dat');
18          $checksum_hex  = adler32_file_hex('filename.dat');
19          $checksum_int  = adler32_file_int('filename.dat');
20          # calculate Adler32 checksum from filehandle
21          $checksum_raw  = adler32_file(*FILEHANDLE);
22          $checksum_hex  = adler32_file_hex(*FILEHANDLE);
23          $checksum_int  = adler32_file_int(*FILEHANDLE);
24
25          ### OO interface:
26          use Crypt::Checksum::Adler32;
27
28          $d = Crypt::Checksum::Adler32->new;
29          $d->add('any data');
30          $d->add('another data');
31          $d->addfile('filename.dat');
32          $d->addfile(*FILEHANDLE);
33          $checksum_raw  = $d->digest;     # raw 4 bytes
34          $checksum_hex  = $d->hexdigest;  # hexadecimal form
35          $checksum_int  = $d->intdigest;  # 32bit unsigned integer
36

DESCRIPTION

38       Calculating Adler32 checksums.
39
40       Updated: v0.057
41

EXPORT

43       Nothing is exported by default.
44
45       You can export selected functions:
46
47        use Crypt::Checksum::Adler32 qw(adler32_data adler32_data_hex adler32_data_int adler32_file adler32_file_hex adler32_file_int);
48
49       Or all of them at once:
50
51        use Crypt::Checksum::Adler32 ':all';
52

FUNCTIONS

54   adler32_data
55       Returns checksum as raw octects.
56
57        $checksum_raw = adler32_data('data string');
58        #or
59        $checksum_raw = adler32_data('any data', 'more data', 'even more data');
60
61   adler32_data_hex
62       Returns checksum as a hexadecimal string.
63
64        $checksum_hex = adler32_data_hex('data string');
65        #or
66        $checksum_hex = adler32_data_hex('any data', 'more data', 'even more data');
67
68   adler32_data_int
69       Returns checksum as unsigned 32bit integer.
70
71        $checksum_int = adler32_data_int('data string');
72        #or
73        $checksum_int = adler32_data_int('any data', 'more data', 'even more data');
74
75   adler32_file
76       Returns checksum as raw octects.
77
78        $checksum_raw = adler32_file('filename.dat');
79        #or
80        $checksum_raw = adler32_file(*FILEHANDLE);
81
82   adler32_file_hex
83       Returns checksum as a hexadecimal string.
84
85        $checksum_hex = adler32_file_hex('filename.dat');
86        #or
87        $checksum_hex = adler32_file_hex(*FILEHANDLE);
88
89   adler32_file_int
90       Returns checksum as unsigned 32bit integer.
91
92        $checksum_int = adler32_file_int('filename.dat');
93        #or
94        $checksum_int = adler32_file_int(*FILEHANDLE);
95

METHODS

97   new
98       Constructor, returns a reference to the checksum object.
99
100        $d = Crypt::Checksum::Adler32->new;
101
102   clone
103       Creates a copy of the checksum object state and returns a reference to
104       the copy.
105
106        $d->clone();
107
108   reset
109       Reinitialize the checksum object state and returns a reference to the
110       checksum object.
111
112        $d->reset();
113
114   add
115       All arguments are appended to the message we calculate checksum for.
116       The return value is the checksum object itself.
117
118        $d->add('any data');
119        #or
120        $d->add('any data', 'more data', 'even more data');
121
122   addfile
123       The content of the file (or filehandle) is appended to the message we
124       calculate checksum for.  The return value is the checksum object
125       itself.
126
127        $d->addfile('filename.dat');
128        #or
129        $d->addfile(*FILEHANDLE);
130
131       BEWARE: You have to make sure that the filehandle is in binary mode
132       before you pass it as argument to the addfile() method.
133
134   digest
135       Returns the binary checksum (raw bytes).
136
137        $result_raw = $d->digest();
138
139   hexdigest
140       Returns the checksum encoded as a hexadecimal string.
141
142        $result_hex = $d->hexdigest();
143
144   intdigest
145       Returns the checksum encoded as unsigned 32bit integer.
146
147        $result_int = $d->intdigest();
148

SEE ALSO

150       •   CryptX
151
152       •   <https://en.wikipedia.org/wiki/Adler-32>
153
154
155
156perl v5.36.1                      2023-10-04       Crypt::Checksum::Adler32(3)
Impressum