Przywrócono xxHash
This commit is contained in:
parent
de7ced2939
commit
07f25198da
6 changed files with 7 additions and 55 deletions
|
|
@ -224,7 +224,7 @@ std::vector<FilesTable> CreateCargo::ComputingHeadFiles()
|
|||
f.close();
|
||||
|
||||
//Tworzenie hashu CRC
|
||||
uint32_t crc = crc32(buffor);
|
||||
uint64_t crc = XXH64(buffor.data(), buffor.size(), VERSION);
|
||||
|
||||
//Kompresjia
|
||||
std::vector<char> zip;
|
||||
|
|
@ -331,16 +331,6 @@ uint64_t CreateCargo::fnv64(const std::string& data)
|
|||
return hash;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Wygenerój CRC32 HASH integralnoœci
|
||||
//-----------------------------------------------------------------------------
|
||||
uint32_t CreateCargo::crc32(const std::vector<char>& buffer)
|
||||
{
|
||||
boost::crc_32_type crc;
|
||||
crc.process_bytes(buffer.data(), buffer.size());
|
||||
return crc.checksum();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Sprawdzanie czy plik znajduje się na liście
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -30,11 +30,10 @@
|
|||
#include <utility>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <boost/crc.hpp>
|
||||
#include <xxhash.h>
|
||||
|
||||
#include "DataStruct.h"
|
||||
#include "Txtpp.h"
|
||||
#include "xxhash.h"
|
||||
#include "CompressingManager.h"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,6 @@ struct FilesTable
|
|||
uint64_t hashName;
|
||||
uint64_t offset;
|
||||
uint32_t size;
|
||||
uint32_t crc;
|
||||
uint64_t crc;
|
||||
uint8_t isZip;
|
||||
};
|
||||
|
|
@ -114,9 +114,9 @@ bool ExtractCargo::CheckCargoFile()
|
|||
//-----------------------------------------------------------------------------
|
||||
// Sprawdzanie sumy kontrolnej
|
||||
//-----------------------------------------------------------------------------
|
||||
bool ExtractCargo::HashValid(const std::vector<char>& data, const uint32_t& crc)
|
||||
bool ExtractCargo::HashValid(const std::vector<char>& data, const uint64_t& crc)
|
||||
{
|
||||
uint32_t actualCrc = crc32(data);
|
||||
uint64_t actualCrc = XXH64(data.data(), data.size(), VERSION);
|
||||
|
||||
if (actualCrc != crc)
|
||||
{
|
||||
|
|
@ -126,16 +126,6 @@ bool ExtractCargo::HashValid(const std::vector<char>& data, const uint32_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
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -28,10 +28,9 @@
|
|||
#include <sstream>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <boost/crc.hpp>
|
||||
#include <xxhash.h>
|
||||
|
||||
#include "DataStruct.h"
|
||||
#include "xxhash.h"
|
||||
#include "CompressingManager.h"
|
||||
|
||||
class ExtractCargo {
|
||||
|
|
@ -69,10 +68,7 @@ private:
|
|||
void LoadFilesTable();
|
||||
|
||||
// Sprawdzanie sumy kontrolnej
|
||||
bool HashValid(const std::vector<char>&, const uint32_t&);
|
||||
|
||||
// CRC
|
||||
uint32_t crc32(const std::vector<char>&);
|
||||
bool HashValid(const std::vector<char>&, const uint64_t&);
|
||||
|
||||
// Utwórz katalog
|
||||
void CreateDirections(std::filesystem::path);
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
Loading…
Add table
Add a link
Reference in a new issue