Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
yanczi
07f25198da Przywrócono xxHash 2025-11-01 23:53:25 +01:00
6 changed files with 7 additions and 55 deletions

View file

@ -224,7 +224,7 @@ std::vector<FilesTable> CreateCargo::ComputingHeadFiles()
f.close(); f.close();
//Tworzenie hashu CRC //Tworzenie hashu CRC
uint32_t crc = crc32(buffor); uint64_t crc = XXH64(buffor.data(), buffor.size(), VERSION);
//Kompresjia //Kompresjia
std::vector<char> zip; std::vector<char> zip;
@ -331,16 +331,6 @@ uint64_t CreateCargo::fnv64(const std::string& data)
return hash; 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 // Sprawdzanie czy plik znajduje się na liście
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -30,11 +30,10 @@
#include <utility> #include <utility>
#include <memory> #include <memory>
#include <string> #include <string>
#include <boost/crc.hpp> #include <xxhash.h>
#include "DataStruct.h" #include "DataStruct.h"
#include "Txtpp.h" #include "Txtpp.h"
#include "xxhash.h"
#include "CompressingManager.h" #include "CompressingManager.h"

View file

@ -62,6 +62,6 @@ struct FilesTable
uint64_t hashName; uint64_t hashName;
uint64_t offset; uint64_t offset;
uint32_t size; uint32_t size;
uint32_t crc; uint64_t crc;
uint8_t isZip; uint8_t isZip;
}; };

View file

@ -114,9 +114,9 @@ bool ExtractCargo::CheckCargoFile()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Sprawdzanie sumy kontrolnej // 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) if (actualCrc != crc)
{ {
@ -126,16 +126,6 @@ bool ExtractCargo::HashValid(const std::vector<char>& data, const uint32_t& crc)
return true; 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 // Pobieranie nagłówków plików
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -28,10 +28,9 @@
#include <sstream> #include <sstream>
#include <cstdint> #include <cstdint>
#include <string> #include <string>
#include <boost/crc.hpp> #include <xxhash.h>
#include "DataStruct.h" #include "DataStruct.h"
#include "xxhash.h"
#include "CompressingManager.h" #include "CompressingManager.h"
class ExtractCargo { class ExtractCargo {
@ -69,10 +68,7 @@ private:
void LoadFilesTable(); void LoadFilesTable();
// Sprawdzanie sumy kontrolnej // Sprawdzanie sumy kontrolnej
bool HashValid(const std::vector<char>&, const uint32_t&); bool HashValid(const std::vector<char>&, const uint64_t&);
// CRC
uint32_t crc32(const std::vector<char>&);
// Utwórz katalog // Utwórz katalog
void CreateDirections(std::filesystem::path); void CreateDirections(std::filesystem::path);

View file

@ -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.