crc
This commit is contained in:
parent
8b9a1789ab
commit
729cb13ff8
8 changed files with 71 additions and 10 deletions
|
|
@ -114,9 +114,9 @@ bool ExtractCargo::CheckCargoFile()
|
|||
//-----------------------------------------------------------------------------
|
||||
// Sprawdzanie sumy kontrolnej
|
||||
//-----------------------------------------------------------------------------
|
||||
bool ExtractCargo::HashValid(const std::vector<char>& data, const uint64_t& crc)
|
||||
bool ExtractCargo::HashValid(const std::vector<char>& data, const uint32_t& crc)
|
||||
{
|
||||
uint64_t actualCrc = XXH64(data.data(), data.size(), VERSION);
|
||||
uint32_t actualCrc = crc32(data);
|
||||
|
||||
if (actualCrc != crc)
|
||||
{
|
||||
|
|
@ -126,6 +126,16 @@ bool ExtractCargo::HashValid(const std::vector<char>& data, const uint64_t& crc)
|
|||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Wygenerój CRC32 HASH integralnoœci
|
||||
//-----------------------------------------------------------------------------
|
||||
uint32_t ExtractCargo::crc32(const std::vector<char>& buffer)
|
||||
{
|
||||
boost::crc_32_type crc;
|
||||
crc.process_bytes(buffer.data(), buffer.size());
|
||||
return crc.checksum();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Pobieranie nagłówków plików
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue