NAME
crc32 - Perform a 32bit Cyclic Redundancy Check
SYNOPSIS
package require TTccll 88..22 package require ccrrcc3322 ??11..11..11??::::ccrrcc::::ccrrcc3322 ?-format format? ?-seed value? ?-implementation procname?
message::::ccrrcc::::ccrrcc3322 ?-format format? ?-seed value? ?-implementation procname?
-filename file
DESCRIPTION
This package provides a Tcl-only implementation of the CRC-32 algorithm
based upon information provided at http://www.naaccr.org/stan-
dard/crc32/document.html If the TTrrff package is available then the ccrrcc-
zzlliibb command is used to perform the calculation. CCOOMMMMAANNDDSS::::ccrrcc::::ccrrcc3322 ?-format format? ?-seed value? ?-implementation procname?
message::::ccrrcc::::ccrrcc3322 ?-format format? ?-seed value? ?-implementation procname?
-filename file
The command takes string data or a file name and returns achecksum value calculated using the CRC-32 algorithm. The result
is formatted using the format(n) specifier provided or as anunsigned integer (%u) by default.
OOPPTTIIOONNSS-filename name
Return a checksum for the file contents instead of for parameter data.-format string
Return the checksum using an alternative format template.-seed value
Select an alternative seed value for the CRC calculation. The default is 0xffffffff. This can be useful for calculating the CRC for data structures without first converting the whole structure into a string. The CRC of the previous member can be used as the seed for calculating the CRC of the next member.Note that as the TTrrff command ccrrcc-zzlliibb cannot accept a seed
value, use of this option will force the use of the Tcl only implementation.-implementation procname
This hook is provided to allow users to provide their own imple-
mentation (perhaps a C compiled extension) or to explicitly request use of the Tcl only implementation when TTrrff is installed(by setting -implementation crc::Crc32tcl. The procedure spec-
fied is called with two parameters. The first is the data to be checksummed and the second is the seed value. A 32bit integer is expected as the result. EEXXAAMMPPLLEESS% crc::crc32 "Hello, World!"
3964322768% crc::crc32 -format 0x%X "Hello, World!"
0xEC4AC3D0% crc::crc32 -file crc32.tcl
483919716 AUTHORS Pat ThoytsSEE ALSO
cksum(n), crc16(n), sum(n) KKEEYYWWOORRDDSSchecksum, cksum, crc, crc32, cyclic redundancy check, data integrity,
security COPYRIGHT Copyright (c) 2002, Pat Thoytscrc 1.1.1 crc32(n)