Code Comments
Programming Forum and web based access to our favorite programming groups.Sorry, I'm not a mathematician and need the answer to a fairly simple question: is it possible for the CRC32 of a file to be 0 when the file is of nonzero length? It's fairly obvious that it's 0 when there is no data but I'd like to be able to infer the reverse, that a CRC of 0 means there was no data in the file. I expect the answer is "No, 0 is as likely as any other value for a given sequence of bytes" but am hoping to be proved wrong. Thanks, RM
Post Follow-up to this messageRex Mottram <rexm@not.here> writes: > Sorry, I'm not a mathematician and need the answer to a fairly simple > question: is it possible for the CRC32 of a file to be 0 when the file > is of nonzero length? It's fairly obvious that it's 0 when there is no > data but I'd like to be able to infer the reverse, that a CRC of 0 > means there was no data in the file. I expect the answer is "No, 0 is > as likely as any other value for a given sequence of bytes" but am > hoping to be proved wrong. No, 0 is as likely as anything. Calculate the CRC of some data, append the CRC to the end, and include this in the CRC calculation. You should get a final CRC of zero. Or something like that. -- Måns Rullgård mans@mansr.com
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.