1Digest::CRC(3) User Contributed Perl Documentation Digest::CRC(3)
2
3
4
6 Digest::CRC - Generic CRC functions
7
9 # Functional style
10
11 use Digest::CRC qw(crc64 crc32 crc16 crcccitt crc crc8 crcopenpgparmor);
12 $crc = crc64("123456789");
13 $crc = crc32("123456789");
14 $crc = crc16("123456789");
15 $crc = crcccitt("123456789");
16 $crc = crc8("123456789");
17 $crc = crcopenpgparmor("123456789");
18
19 $crc = crc($input,$width,$init,$xorout,$refout,$poly,$refin,$cont);
20
21
22 # add data to existing
23
24 $crc = crc32("ABCD", $crc);
25
26
27 # OO style
28 use Digest::CRC;
29
30 $ctx = Digest::CRC->new(type=>"crc16");
31 $ctx = Digest::CRC->new(width=>16, init=>0x2345, xorout=>0x0000,
32 refout=>1, poly=>0x8005, refin=>1, cont=>1);
33
34 $ctx->add($data);
35 $ctx->addfile(*FILE);
36
37 $digest = $ctx->digest;
38 $digest = $ctx->hexdigest;
39 $digest = $ctx->b64digest;
40
42 The Digest::CRC module calculates CRC sums of all sorts. It contains
43 wrapper functions with the correct parameters for CRC-CCITT, CRC-16,
44 CRC-32 and CRC-64, as well as the CRC used in OpenPGP's ASCII-armored
45 checksum.
46
48 https://tools.ietf.org/html/rfc4880#section-6
49
51 Oliver Maul, oli@42.nu
52
54 CRC algorithm code taken from "A PAINLESS GUIDE TO CRC ERROR DETECTION
55 ALGORITHMS".
56
57 The author of this package disclaims all copyrights and releases it
58 into the public domain.
59
60
61
62perl v5.34.0 2021-07-22 Digest::CRC(3)