1CRC32(3) User Contributed Perl Documentation CRC32(3)
2
3
4
6 String::CRC32 - Perl interface for cyclic redundancy check generation
7
9 use String::CRC32;
10
11 $crc = crc32("some string");
12 $crc = crc32("some string", initvalue);
13
14 $somestring = "some string";
15 $crc = crc32($somestring);
16 printf "%08x\n", $crc;
17
18 open my $fh, '<', 'location/of/some.file' or die $!;
19 binmode $fh;
20 $crc = crc32($fh);
21 close $fh;
22
24 The CRC32 module calculates CRC sums of 32 bit lengths as integers. It
25 generates the same CRC values as ZMODEM, PKZIP, PICCHECK and many
26 others.
27
28 Despite its name, this module is able to compute the checksum of files
29 as well as strings.
30
32 $crc = crc32("some string");
33
34 results in the same as
35
36 $crc = crc32(" string", crc32("some"));
37
38 This is useful for subsequent CRC checking of substrings.
39
40 You may even check files:
41
42 open my $fh, '<', 'location/of/some.file' or die $!;
43 binmode $fh;
44 $crc = crc32($fh);
45 close $fh;
46
47 A init value may also have been supplied in the above example.
48
50 Soenke J. Peters <peters__perl@opcenter.de>
51
52 Current maintainer: LEEJO
53
54 Address bug reports and comments to:
55 <https://github.com/leejo/string-crc32/issues>
56
58 CRC algorithm code taken from CRC-32 by Craig Bruce. The module stuff
59 is inspired by a similar perl module called String::CRC by David
60 Sharnoff & Matthew Dillon. Horst Fickenscher told me that it could be
61 useful to supply an init value to the crc checking function and so I
62 included this possibility.
63
64 The author of this package disclaims all copyrights and releases it
65 into the public domain.
66
67
68
69perl v5.30.1 2020-01-30 CRC32(3)