NAME

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

SYNOPSIS

use Crypt::Checksum ':all';

# calculate Adler32 checksum from string/buffer
$checksum_raw  = adler32_data($data);
$checksum_hex  = adler32_data_hex($data);

# calculate Adler32 checksum from file
$checksum_raw  = adler32_file('filename.dat');
$checksum_hex  = adler32_file_hex('filename.dat');

# calculate Adler32 checksum from filehandle
$checksum_raw  = adler32_file(*FILEHANDLE);
$checksum_hex  = adler32_file_hex(*FILEHANDLE);

# calculate CRC32 checksum from string/buffer
$checksum_raw  = crc32_data($data);
$checksum_hex  = crc32_data_hex($data);

# calculate CRC32 checksum from file
$checksum_raw  = crc32_file('filename.dat');
$checksum_hex  = crc32_file_hex('filename.dat');

# calculate CRC32 checksum from filehandle
$checksum_raw  = crc32_file(*FILEHANDLE);
$checksum_hex  = crc32_file_hex(*FILEHANDLE);

DESCRIPTION

Calculating CRC32 and Adler32 checksums (functional interface);

Since: CryptX-0.032

EXPORT

Nothing is exported by default.

You can export selected functions:

use Crypt::Checksum qw( adler32_data adler32_data_hex adler32_file adler32_file_hex
                        crc32_data crc32_data_hex crc32_file crc32_file_hex );

Or all of them at once:

use Crypt::Checksum ':all';

FUNCTIONS

adler32_data

Returns checksum as raw octects.

$checksum_raw = adler32_data('data string');
#or
$checksum_raw = adler32_data('any data', 'more data', 'even more data');

adler32_data_hex

Returns checksum as a hexadecimal string.

$checksum_hex = adler32_data_hex('data string');
#or
$checksum_hex = adler32_data_hex('any data', 'more data', 'even more data');

adler32_data_int

Returns checksum as unsigned 32bit integer.

$checksum_hex = adler32_data_int('data string');
#or
$checksum_hex = adler32_data_int('any data', 'more data', 'even more data');

adler32_file

Returns checksum as raw octects.

$checksum_raw = adler32_file('filename.dat');
#or
$checksum_raw = adler32_file(*FILEHANDLE);

adler32_file_hex

Returns checksum as a hexadecimal string.

$checksum_hex = adler32_file_hex('filename.dat');
#or
$checksum_hex = adler32_file_hex(*FILEHANDLE);

adler32_file_int

Returns checksum as unsigned 32bit integer.

$checksum_hex = adler32_file_int('filename.dat');
#or
$checksum_hex = adler32_file_int(*FILEHANDLE);

crc32_data

Returns checksum as raw octects.

$checksum_raw = crc32_data('data string');
#or
$checksum_raw = crc32_data('any data', 'more data', 'even more data');

crc32_data_hex

Returns checksum as a hexadecimal string.

$checksum_hex = crc32_data_hex('data string');
#or
$checksum_hex = crc32_data_hex('any data', 'more data', 'even more data');

crc32_data_int

Returns checksum as unsigned 32bit integer.

$checksum_hex = crc32_data_int('data string');
#or
$checksum_hex = crc32_data_int('any data', 'more data', 'even more data');

crc32_file

Returns checksum as raw octects.

$checksum_raw = crc32_file('filename.dat');
#or
$checksum_raw = crc32_file(*FILEHANDLE);

crc32_file_hex

Returns checksum as a hexadecimal string.

$checksum_hex = crc32_file_hex('filename.dat');
#or
$checksum_hex = crc32_file_hex(*FILEHANDLE);

crc32_file_int

Returns checksum as unsigned 32bit integer.

$checksum_hex = crc32_file_int('filename.dat');
#or
$checksum_hex = crc32_file_int(*FILEHANDLE);

SEE ALSO