You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm observing unexpected behavior in ImHex 1.35.4 where std::hash::crc32() returns a different result on every evaluation in the pattern editor console.
Context: I am writing a pattern to parse a 512-byte structure. The first 8 bytes describe a checksum and seed checking the 504 bytes that follow. (It's a CRC32-C variant - no xorout)
I can produce the expected result by selecting the 504 bytes in the 'Hashes' view (screenshot). However I'm unable to achieve the same result in the pattern editor. Instead I am seeing constantly shifting values.
The sketch below illustrates what I'm seeing. Am I misusing something or does it seem like an issue with std::hash::crc32()?
I tested using the standard crc32 and I also get results that change on every run and that obviously differ from any other crc32 implementation I tried. The only way I can get it to behave consistently and give the expected result is to use an array of chars instead of using u8 or s8.
I couldn't test your code because no input file is provided, but you can try and see if this is related to what you are seeing.
To test this in your code, instead of using
and the same for the other tests.
Why does it need to use chars? I am not sure. Somebody who knows more about crc32 may know why this is happening. There is also the possibility of this being a bug but I can't imagine what the bug would be or how to fix it.
I'm observing unexpected behavior in ImHex 1.35.4 where
std::hash::crc32()
returns a different result on every evaluation in the pattern editor console.Context: I am writing a pattern to parse a 512-byte structure. The first 8 bytes describe a checksum and seed checking the 504 bytes that follow. (It's a CRC32-C variant - no xorout)
I can produce the expected result by selecting the 504 bytes in the 'Hashes' view (screenshot). However I'm unable to achieve the same result in the pattern editor. Instead I am seeing constantly shifting values.
The sketch below illustrates what I'm seeing. Am I misusing something or does it seem like an issue with
std::hash::crc32()
?Evaluation:
Next evaluation:
The text was updated successfully, but these errors were encountered: