mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-01 21:17:44 -05:00
Fix CRC and hash calculations (#321)
* Fix CRC calculation, add more CRC parameters Use the Boost CRC module to calculate the CRC values. Add options for final xor value, reflectIn and reflectOut. Fixes #320 * Cleanup Hash view combo box, add CRC8 * Use offset/size consistently * Cleanup: unify processing data by chunks * Change CRC algorithm back, drop boost dependency This is mostly the original algorithm, with a few fixes and small additions (support for reflect In / Out, final XOR value). * Use size_t for file read size consistently
This commit is contained in:
@@ -14,8 +14,9 @@ namespace hex::crypt {
|
||||
void initialize();
|
||||
void exit();
|
||||
|
||||
u16 crc16(prv::Provider* &data, u64 offset, size_t size, u16 polynomial, u16 init);
|
||||
u32 crc32(prv::Provider* &data, u64 offset, size_t size, u32 polynomial, u32 init);
|
||||
u16 crc8(prv::Provider* &data, u64 offset, size_t size, u32 polynomial, u32 init, u32 xorout, bool reflectIn, bool reflectOut);
|
||||
u16 crc16(prv::Provider* &data, u64 offset, size_t size, u32 polynomial, u32 init, u32 xorout, bool reflectIn, bool reflectOut);
|
||||
u32 crc32(prv::Provider* &data, u64 offset, size_t size, u32 polynomial, u32 init, u32 xorout, bool reflectIn, bool reflectOut);
|
||||
|
||||
std::array<u8, 16> md5(prv::Provider* &data, u64 offset, size_t size);
|
||||
std::array<u8, 20> sha1(prv::Provider* &data, u64 offset, size_t size);
|
||||
@@ -54,4 +55,4 @@ namespace hex::crypt {
|
||||
};
|
||||
|
||||
std::vector<u8> aesDecrypt(AESMode mode, KeyLength keyLength, const std::vector<u8> &key, std::array<u8, 8> nonce, std::array<u8, 8> iv, const std::vector<u8> &input);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user