Skip to content
Tcl Source Code View Ticket
Login

View Ticket

zlib crc32 returns negative integers

Closed / Fixed2662434fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 18 years ago
Descriptionplain2009-03-04 17:17:08
The now in-core [zlib crc32] command returns a signed integer. Most implementations, including tcllib's crc32 and the sample code of RFC 1952 (http://www.ietf.org/rfc/rfc1952.txt) returns unsigned values.
While I don't have access to the ISO 3309 standard in which the checksum is defined, the signed value is inconsistent with other tools in the wild (including tcl ones).

Example code:
% info patchlevel
8.6b1.1
% package require crc32
1.3
% set a "dabale arroz a la zorra el abad"
dabale arroz a la zorra el abad
% zlib crc32 $a
-452134725
% crc::crc32 $a
3842832571
% expr [zlib crc32 $a] & 0xffffffff
3842832571
dkfplain2009-03-05 00:26:34
allow_comments - 1
Log in (anonymous is fine) to add a comment.