Luna/libluna/include/luna/CRC32.h

37 lines
642 B
C
Raw Permalink Normal View History

/**
* @file CRC32.h
* @author apio (cloudapio.eu)
* @brief CRC32 checksum calculation.
*
* @copyright Copyright (c) 2023, the Luna authors.
*
*/
#pragma once
#include <luna/Types.h>
/**
* @brief A class to calculate a CRC32 checksum.
*/
2023-08-15 17:27:09 +00:00
class CRC32
{
2023-08-15 17:27:09 +00:00
public:
/**
* @brief Add data to the checksum.
*
* @param data The data to add.
* @param size The amount of bytes to add.
*/
2023-08-15 17:27:09 +00:00
void append(const u8* data, usize size);
/**
* @brief Calculate the final checksum.
*
* @return u32 The calculated checksum.
*/
2023-08-15 17:27:09 +00:00
u32 digest();
private:
u32 m_checksum = 0xffffffffu;
};