Rework hashes (also fix Fletcher16 and CRC64)

This commit is contained in:
Jérôme Leclercq
2022-02-10 01:46:58 +01:00
parent 52100e3b3b
commit 97ee89afb7
29 changed files with 1262 additions and 1330 deletions

View File

@@ -13,13 +13,11 @@
namespace Nz
{
struct HashCRC32_state;
class NAZARA_CORE_API HashCRC32 : public AbstractHash
class NAZARA_CORE_API CRC32Hash final : public AbstractHash
{
public:
HashCRC32(UInt32 polynomial = 0x04c11db7);
virtual ~HashCRC32();
CRC32Hash(UInt32 polynomial = DefaultPolynomial);
virtual ~CRC32Hash();
void Append(const UInt8* data, std::size_t len) override;
void Begin() override;
@@ -28,8 +26,11 @@ namespace Nz
std::size_t GetDigestLength() const override;
const char* GetHashName() const override;
static constexpr UInt32 DefaultPolynomial = 0x04C11DB7;
private:
HashCRC32_state* m_state;
UInt32 m_crc;
const UInt32* m_table;
};
}