CRC32 implementations

Started by
6 comments, last by davidko 22 years, 2 months ago
I''m looking for an equivalent implementation of the CRC32 as that which is found in java.util.zip.CRC32. I wanted to implemented this in C++ so that both algorithms come out with the same numbers. Unfortunately, all the implementations I''ve tested come out with inconsistent results. Does anyone know where I can find the same implementation that java uses? A temporary solution I''m using is to just LoadLibrary the zip.dll library that java uses for its implementation. But I''d prefer to have my own implementation in C++. Thanks
Advertisement

Hmm... if you used the same CRC-32 algorithm, the calculated
result should be the same. All CRC-32 is, is a polynomial in
modulo mathematics. Maybe you made a mistake in your C++
function?

Different implementation may be using different coefficients,
so the answers are different. Why don''t you just get the
source code to zlib and use zlib''s CRC-32?

I''d recommend against writing your own "zlib". Your time is better spent on writing your application. Really. Do you
think you can write a better "zlib"?


Premature optimizations can only slow down your project even more.
神はサイコロを振らない!
he may just need the crc32 portion and not the entire compression package. which in that case its silly to include the entire zlib library.

question, why do you need the same numbers as java.util.zip.CRC32?

btw the magic number for zip files is 0xdebb20e3 which is probably the same thing java.util.zip.CRC32 uses.

Err, that''s what I meant. Get the source code to zlib''s CRC-32
function and use it. I didn''t mean to use the whole zlib
library.


Premature optimizations can only slow down your project even more.
神はサイコロを振らない!
tangentz, i am not familar with the liscense of zlib, but wouldn''t copy the code require you to GPL your code as well or is it BSD? cause you dont want him breaking the liscence, which would further bring down the open source community. if they dont want the code used in closed source productions, and you dont want your code open, then its best not to use open source libraries.
quote:Original post by a person
tangentz, i am not familar with the liscense of zlib, but wouldn''t copy the code require you to GPL your code as well or is it BSD?

ZLib is under the ZLib license (go figure). It''s probably the most open license I''ve seen (basically self protection for the author''s and nothing more).


Whoa, hold on, when did I say anything about breaking licenses?

Please don''t put words into my mouth.

So what if you have to GPL your code? The original poster
didn''t say anything about that.

You sound like you support the open source community, no?
So what''s better than to get more code open source? I
don''t understand what you''re ranting about.

To answer the relevant question, if you read zlib''s license,
it''s pretty much "use at your own risk" type. No GPL or
nothing. You just need to give credits to zlib''s authors,
that''s all.


Premature optimizations can only slow down your project even more.
神はサイコロを振らない!
sorry if i sounded harsh. i just was trying to make him aware about using other ppls code, so he dont become one of those bad coders that steal from the open source community disreagarding the liscense. now that i re read it , the words are probally put together wrong and sound more directed at you then i had intended.

This topic is closed to new replies.

Advertisement