Open phipolis opened 1 month ago
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
u8 crcBytes[FVAULT2_VOL_HEADER_SIZE - sizeof(crc32)] [[hidden]];
try using
char crcBytes[FVAULT2_VOL_HEADER_SIZE - sizeof(crc32)] [[hidden]];
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.
@paxcut As you say, it works as expected with type char
instead of u8
. Thank you for the suggestion!
Here is a 512B sample file with a CRC at the beginning that satisfies the pattern: ImHex-Patterns_Issue_312_Sample.zip
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: