++ed by:

1 PAUSE user

Author image Guntram Blohm
and 1 contributors

NAME Mail::Exchange::CRC - implement the CRC algorithm used in RTF compression and the named property to index PPS streams


    use Mail::Exchange::CRC;

    my $crc=Mail::Exchange::CRC::new();
    while (<FILE>) {
    print $crc->value;

    print Mail::Exchange::CRC::crc($string);


Mail::Exchange::CRC can be used in function mode or in object oriented mode. In function mode, you pass a string and get back the crc immediately, while in object mode, you initialize an object via new, then append data to the object as needed, and fetch the resulting value at the end.

The crc algorithm is documented in [MS-OXRTFCP], and happens to be the CRC-32 algorithm that is used in a lot of different places as well, for example in the the IEEE 802.3 Ethernet CRC specification.


$crc=Mail::Exchange::CRC::new([string]) - initialize a new CRC value

Initialize a new CRC calculator, and calculate the CRC of string if provided.



Appends another string to a CRC, calculating the CRC of the two strings concatenated to each other

The following are supposed to be equal:

        $crc1=Mail::Exchange::CRC::new("hello world");

        $crc2->append(" world");



Returns the calculated value of the CRC.



Calculates the CRC of a string in an easy-to-use, non-object-oriented way.