Il 24/07/2016 01:18, wkitt...@windstream.net ha scritto:

this is driving me battier than i already am :(

i have a binary file that contains a record of data... the first field of the data is a crc32 value of a string of characters... the string of characters is lower cased before being fed to the crc32 function... i need to calculate the same crc32 value as what is stored in the file...

i've already checked the polynomial ($edb88320) is the same in both, the original implementation (converted to TP4 in 1988) and this implementation...

the original routine uses longint and speaks of initializing the variable to $ffffffff before feeding it to the crc32 routine... the existing routine in FPC says "Pre- and post-conditioning (one's complement) is performed within this function so it shouldn't be done by the application." but that doesn't give me the proper answer in this case... i've tried using cardinal types and longint types to no avail...

the following is so so so very close but now i'm bald headed, completely lost in the deep dark woods and can't find my breadcrumbs any more :(


What I'd do in your place would be to forget about strings, and use just an array of bytes. This way you're sure that you don't have in the way the string length value and some automatic encoding conversion, which messes up things.

Giuliano

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to