Digest::CRC - Generic CRC functions |
Digest::CRC - Generic CRC functions
# Functional style
use Digest::CRC qw(crc32 crc16 crcccitt crc crc8); $crc = crc32("123456789"); $crc = crc16("123456789"); $crc = crcccitt("123456789"); $crc = crc8("123456789");
$crc = crc($input,$width,$init,$xorout,$refout,$poly,$refin);
# OO style use Digest::CRC;
$ctx = Digest::CRC->new(type=>"crc16"); $ctx = Digest::CRC->new(width=>16, init=>0x2345, xorout=>0x0000, poly=>0x8005, refin=>1, refout=>1, cont=>1);
$ctx->add($data); $ctx->addfile(*FILE);
$digest = $ctx->digest; $digest = $ctx->hexdigest; $digest = $ctx->b64digest;
The Digest::CRC module calculates CRC sums of all sorts. It contains wrapper functions with the correct parameters for CRC-CCITT, CRC-16 and CRC-32.
Oliver Maul, oli@42.nu
CRC algorithm code taken from ``A PAINLESS GUIDE TO CRC ERROR DETECTION ALGORITHMS''.
The author of this package disclaims all copyrights and releases it into the public domain.
Digest::CRC - Generic CRC functions |