![]() | Name | Last modified | Size | Description |
---|---|---|---|---|
![]() | Parent Directory | - | ||
![]() | INSTALL.html | 2003-11-17 16:58 | 1.4K | |
![]() | chksum32.tar.gz | 2003-11-17 17:01 | 20K | |
![]() | chksum32.zip.OLD | 2003-11-05 12:33 | 28K | |
java.util.zip.CRC32
of the Java Runtime Environment.
To include a checksum in a parameter file:
PAF.CHCK.CHECKSUM ""
crc32()
, defined in
crc32.c. The function's return value is the needed
checksum value. See the following example:
#define ONEMEGA (1024*1024) int fd; uLong chksum; char buffer[ ONEMEGA ]; ssize_t len = 0; fd = open( "file.paf", O_RDONLY ); len = read( fd, buffer, ONEMEGA ); chksum = crc32( 0, buffer, len ); /* first arg is always zero */
PAF.CHCK.CHECKSUM "482575795"
PAF.CHCK.CHECKSUM
keyword in the parameter file, P2PP
will assume the file was corrupted and reject it.
Note: the CRC32 algorithm is
platform-independent, but is indeed sensitive to
whitespace. If a parameter file is transfered across platforms the
line termination characters may change; this will happen
for instance when transferring files between Linux and Windows via
FTP, using ASCII mode. In that case CRC recomputation may fail
although the user may think they didn't "edit" the file.