Home » Community » Forums » » Cyclic Redundancy Checking
  Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic


 Last Thread Next Thread 
 Cyclic Redundancy Checking
Post Reply 
just wondering why you store your functions/data in a class with since they are all static... it would make more sense to use a namespace.

 User Rating: 1015    Report this Post to a Moderator | Link

CRC, MD5, SHA, etc. are all hashing algorithms, whether you use them for security purposes or not.

I think MD5 is probably a better solution for maintaining file integrity. A lot of sites offer MD5 hashes to compare against downloaded files.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Hi,

I think there is a little mistake by "Calculating for a file".

for( dwLoop = 0; dwLoop < dwBytesInOut; dwLoop++ );
GetCRC32( cBuffer[ dwLoop ], dwCRC32 );

The ";" after the for-Loop is wrong or ?

MfG Unwissender

 User Rating: 1015    Report this Post to a Moderator | Link

I was just wondering:

Say you've got a large block of contiguous data. You already know the CRC32 values for several small sections of that data (of unequal size, but you know the size covered by each). Together, the CRC32 values you have covers the entire block of data with no overlaps, and you know what order they appear in.

Can you derive a valid CRC32 value for the entire block of data using only the precalculated CRCs? (possibly also referring to the order and size of each) -- *without* using the raw data itself?

 User Rating: 1015    Report this Post to a Moderator | Link

There is a subtle problem in the code, which could cause it to give completely wrong CRCs in situations where BYTE has to be used as a signed datatype (and therefore the processor movsx instruction would be used instead of movzx). This would cause negative indexed elements of CRC32Table (because of the extension 0xFFFFFFXX), and obviously that won't work (it didn't crash for me it just gave the wrong value).

The fix is simple...

inline void ECRC32::GetCRC32(const BYTE byte, DWORD &dwCRC32){
dwCRC32 = (( dwCRC32 ) >> 8 )^ CRC32Table[( byte )^(( dwCrc32 ) & 0x000000FF )];
}

to...

inline void ECRC32::GetCRC32(const BYTE byte, DWORD &dwCRC32){
dwCRC32 = (( dwCRC32 ) >> 8 )^ CRC32Table[(( byte )^( dwCrc32 )) & 0x000000FF ];
}

By doing the operations in this order the bitmask will be applied to the whole expression and negative indices would be impossible.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: