{
    "mode": "perldoc",
    "parameter": "Crypt::Checksum::CRC32",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Crypt%3A%3AChecksum%3A%3ACRC32/json",
    "generated": "2026-06-10T16:27:42Z",
    "synopsis": "### Functional interface:\nuse Crypt::Checksum::CRC32 ':all';\n# calculate CRC32 checksum from string/buffer\n$checksumraw  = crc32data($data);\n$checksumhex  = crc32datahex($data);\n$checksumint  = crc32dataint($data);\n# calculate CRC32 checksum from file\n$checksumraw  = crc32file('filename.dat');\n$checksumhex  = crc32filehex('filename.dat');\n$checksumint  = crc32fileint('filename.dat');\n# calculate CRC32 checksum from filehandle\n$checksumraw  = crc32file(*FILEHANDLE);\n$checksumhex  = crc32filehex(*FILEHANDLE);\n$checksumint  = crc32fileint(*FILEHANDLE);\n### OO interface:\nuse Crypt::Checksum::CRC32;\n$d = Crypt::Checksum::CRC32->new;\n$d->add('any data');\n$d->add('another data');\n$d->addfile('filename.dat');\n$d->addfile(*FILEHANDLE);\n$checksumraw = $d->digest;     # raw 4 bytes\n$checksumhex = $d->hexdigest;  # hexadecimal form\n$checksumint = $d->intdigest;  # 32bit unsigned integer",
    "sections": {
        "NAME": {
            "content": "Crypt::Checksum::CRC32 - Compute CRC32 checksum\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "### Functional interface:\nuse Crypt::Checksum::CRC32 ':all';\n\n# calculate CRC32 checksum from string/buffer\n$checksumraw  = crc32data($data);\n$checksumhex  = crc32datahex($data);\n$checksumint  = crc32dataint($data);\n# calculate CRC32 checksum from file\n$checksumraw  = crc32file('filename.dat');\n$checksumhex  = crc32filehex('filename.dat');\n$checksumint  = crc32fileint('filename.dat');\n# calculate CRC32 checksum from filehandle\n$checksumraw  = crc32file(*FILEHANDLE);\n$checksumhex  = crc32filehex(*FILEHANDLE);\n$checksumint  = crc32fileint(*FILEHANDLE);\n\n### OO interface:\nuse Crypt::Checksum::CRC32;\n\n$d = Crypt::Checksum::CRC32->new;\n$d->add('any data');\n$d->add('another data');\n$d->addfile('filename.dat');\n$d->addfile(*FILEHANDLE);\n$checksumraw = $d->digest;     # raw 4 bytes\n$checksumhex = $d->hexdigest;  # hexadecimal form\n$checksumint = $d->intdigest;  # 32bit unsigned integer\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Calculating CRC32 checksums.\n\n*Updated: v0.057*\n",
            "subsections": []
        },
        "EXPORT": {
            "content": "Nothing is exported by default.\n\nYou can export selected functions:\n\nuse Crypt::Checksum::CRC32 qw(crc32data crc32datahex crc32dataint crc32file crc32filehex crc32fileint);\n\nOr all of them at once:\n\nuse Crypt::Checksum::CRC32 ':all';\n",
            "subsections": []
        },
        "FUNCTIONS": {
            "content": "crc32data\nReturns checksum as raw octects.\n\n$checksumraw = crc32data('data string');\n#or\n$checksumraw = crc32data('any data', 'more data', 'even more data');\n\ncrc32datahex\nReturns checksum as a hexadecimal string.\n\n$checksumhex = crc32datahex('data string');\n#or\n$checksumhex = crc32datahex('any data', 'more data', 'even more data');\n\ncrc32dataint\nReturns checksum as unsigned 32bit integer.\n\n$checksumint = crc32dataint('data string');\n#or\n$checksumint = crc32dataint('any data', 'more data', 'even more data');\n\ncrc32file\nReturns checksum as raw octects.\n\n$checksumraw = crc32file('filename.dat');\n#or\n$checksumraw = crc32file(*FILEHANDLE);\n\ncrc32filehex\nReturns checksum as a hexadecimal string.\n\n$checksumhex = crc32filehex('filename.dat');\n#or\n$checksumhex = crc32filehex(*FILEHANDLE);\n\ncrc32fileint\nReturns checksum as unsigned 32bit integer.\n\n$checksumint = crc32fileint('filename.dat');\n#or\n$checksumint = crc32fileint(*FILEHANDLE);\n",
            "subsections": []
        },
        "METHODS": {
            "content": "new\nConstructor, returns a reference to the checksum object.\n\n$d = Crypt::Checksum::CRC32->new;\n\nclone\nCreates a copy of the checksum object state and returns a reference to the copy.\n\n$d->clone();\n\nreset\nReinitialize the checksum object state and returns a reference to the checksum object.\n\n$d->reset();\n\nadd\nAll arguments are appended to the message we calculate checksum for. The return value is the\nchecksum object itself.\n\n$d->add('any data');\n#or\n$d->add('any data', 'more data', 'even more data');\n\naddfile\nThe content of the file (or filehandle) is appended to the message we calculate checksum for.\nThe return value is the checksum object itself.\n\n$d->addfile('filename.dat');\n#or\n$d->addfile(*FILEHANDLE);\n\nBEWARE: You have to make sure that the filehandle is in binary mode before you pass it as\nargument to the addfile() method.\n\ndigest\nReturns the binary checksum (raw bytes).\n\n$resultraw = $d->digest();\n\nhexdigest\nReturns the checksum encoded as a hexadecimal string.\n\n$resulthex = $d->hexdigest();\n\nintdigest\nReturns the checksum encoded as unsigned 32bit integer.\n\n$resultint = $d->intdigest();\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "*   CryptX\n\n*   <https://en.wikipedia.org/wiki/Cyclicredundancycheck>\n",
            "subsections": []
        }
    },
    "summary": "Crypt::Checksum::CRC32 - Compute CRC32 checksum",
    "flags": [],
    "examples": [],
    "see_also": []
}