1Crypt::Checksum(3)    User Contributed Perl Documentation   Crypt::Checksum(3)
2
3
4

NAME

6       Crypt::Checksum - functional interface to CRC32 and Adler32 checksums
7

SYNOPSIS

9          use Crypt::Checksum ':all';
10
11          # calculate Adler32 checksum from string/buffer
12          $checksum_raw  = adler32_data($data);
13          $checksum_hex  = adler32_data_hex($data);
14
15          # calculate Adler32 checksum from file
16          $checksum_raw  = adler32_file('filename.dat');
17          $checksum_hex  = adler32_file_hex('filename.dat');
18
19          # calculate Adler32 checksum from filehandle
20          $checksum_raw  = adler32_file(*FILEHANDLE);
21          $checksum_hex  = adler32_file_hex(*FILEHANDLE);
22
23          # calculate CRC32 checksum from string/buffer
24          $checksum_raw  = crc32_data($data);
25          $checksum_hex  = crc32_data_hex($data);
26
27          # calculate CRC32 checksum from file
28          $checksum_raw  = crc32_file('filename.dat');
29          $checksum_hex  = crc32_file_hex('filename.dat');
30
31          # calculate CRC32 checksum from filehandle
32          $checksum_raw  = crc32_file(*FILEHANDLE);
33          $checksum_hex  = crc32_file_hex(*FILEHANDLE);
34

DESCRIPTION

36       Calculating CRC32 and Adler32 checksums (functional interface);
37
38       Since: CryptX-0.032
39

EXPORT

41       Nothing is exported by default.
42
43       You can export selected functions:
44
45         use Crypt::Checksum qw( adler32_data adler32_data_hex adler32_file adler32_file_hex
46                                 crc32_data crc32_data_hex crc32_file crc32_file_hex );
47
48       Or all of them at once:
49
50         use Crypt::Checksum ':all';
51

FUNCTIONS

53   adler32_data
54       Returns checksum as raw octects.
55
56        $checksum_raw = adler32_data('data string');
57        #or
58        $checksum_raw = adler32_data('any data', 'more data', 'even more data');
59
60   adler32_data_hex
61       Returns checksum as a hexadecimal string.
62
63        $checksum_hex = adler32_data_hex('data string');
64        #or
65        $checksum_hex = adler32_data_hex('any data', 'more data', 'even more data');
66
67   adler32_data_int
68       Returns checksum as unsingned 32bit integer.
69
70        $checksum_hex = adler32_data_int('data string');
71        #or
72        $checksum_hex = adler32_data_int('any data', 'more data', 'even more data');
73
74   adler32_file
75       Returns checksum as raw octects.
76
77        $checksum_raw = adler32_file('filename.dat');
78        #or
79        $checksum_raw = adler32_file(*FILEHANDLE);
80
81   adler32_file_hex
82       Returns checksum as a hexadecimal string.
83
84        $checksum_hex = adler32_file_hex('filename.dat');
85        #or
86        $checksum_hex = adler32_file_hex(*FILEHANDLE);
87
88   adler32_file_int
89       Returns checksum as unsingned 32bit integer.
90
91        $checksum_hex = adler32_file_int('data string');
92        #or
93        $checksum_hex = adler32_file_int('any data', 'more data', 'even more data');
94
95   crc32_data
96       Returns checksum as raw octects.
97
98        $checksum_raw = crc32_data('data string');
99        #or
100        $checksum_raw = crc32_data('any data', 'more data', 'even more data');
101
102   crc32_data_hex
103       Returns checksum as a hexadecimal string.
104
105        $checksum_hex = crc32_data_hex('data string');
106        #or
107        $checksum_hex = crc32_data_hex('any data', 'more data', 'even more data');
108
109   crc32_data_int
110       Returns checksum as unsingned 32bit integer.
111
112        $checksum_hex = crc32_data_int('data string');
113        #or
114        $checksum_hex = crc32_data_int('any data', 'more data', 'even more data');
115
116   crc32_file
117       Returns checksum as raw octects.
118
119        $checksum_raw = crc32_file('filename.dat');
120        #or
121        $checksum_raw = crc32_file(*FILEHANDLE);
122
123   crc32_file_hex
124       Returns checksum as a hexadecimal string.
125
126        $checksum_hex = crc32_file_hex('filename.dat');
127        #or
128        $checksum_hex = crc32_file_hex(*FILEHANDLE);
129
130   crc32_file_int
131       Returns checksum as unsingned 32bit integer.
132
133        $checksum_hex = crc32_file_int('data string');
134        #or
135        $checksum_hex = crc32_file_int('any data', 'more data', 'even more data');
136

SEE ALSO

138       •   CryptX, Crypt::Checksum::Adler32, Crypt::Checksum::CRC32
139
140       •   <https://en.wikipedia.org/wiki/Adler-32>
141
142       •   <https://en.wikipedia.org/wiki/Cyclic_redundancy_check>
143
144
145
146perl v5.34.0                      2021-07-22                Crypt::Checksum(3)
Impressum