Naprawiony błąd z deszyfracją, strumieniowe wypakowywanie danych skończone
This commit is contained in:
parent
6b0fbed103
commit
aea66dbfd9
8 changed files with 5 additions and 286 deletions
|
|
@ -110,51 +110,6 @@ bool ExtractCargo::CheckCargoFile()
|
|||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Sprawdzanie sumy kontrolnej
|
||||
//-----------------------------------------------------------------------------
|
||||
bool ExtractCargo::HashValid(const std::vector<char>& data, const uint64_t& crc)
|
||||
{
|
||||
uint64_t actualCrc = XXH64(data.data(), data.size(), 0);
|
||||
|
||||
if (actualCrc != crc)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Magiczna funkcja do dekompresji i deszyfracji danych
|
||||
//-----------------------------------------------------------------------------
|
||||
void ExtractCargo::computingBytes(const std::vector<char>& input, std::vector<char>& output, const uint8_t& flag)
|
||||
{
|
||||
ChunkManager cm(eman);
|
||||
|
||||
std::cout << static_cast<int>(flag) << std::endl;
|
||||
|
||||
switch (flag)
|
||||
{
|
||||
case FILE_FLAG_COMPRESS:
|
||||
output = cm.dechunked(input, true, false);
|
||||
break;
|
||||
|
||||
case FILE_FLAG_ENCRYPT:
|
||||
output = cm.dechunked(input, false, true);
|
||||
break;
|
||||
|
||||
case FILE_FLAG_ZIPENC:
|
||||
output = cm.dechunked(input, true, true);
|
||||
std::cout << "DENC" << std::endl;
|
||||
break;
|
||||
|
||||
default:
|
||||
output = input;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Pobieranie nagłówków plików
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -175,9 +130,6 @@ void ExtractCargo::LoadFilesTable()
|
|||
cargoFile.read(reinterpret_cast<char*>(&fhTmp.crc), sizeof(fhTmp.crc));
|
||||
cargoFile.read(reinterpret_cast<char*>(&fhTmp.flag), sizeof(fhTmp.flag));
|
||||
|
||||
std::cout << tablePosition << std::endl;
|
||||
std::cout << "Size: " << fhTmp.size << std::endl;
|
||||
|
||||
filesHeads.push_back(fhTmp);
|
||||
}
|
||||
}
|
||||
|
|
@ -191,9 +143,11 @@ void ExtractCargo::ExtractingFilesFromCargo()
|
|||
{
|
||||
std::filesystem::path dir = cargoFileName.stem() / fh.nameFile;
|
||||
CreateDirections(dir);
|
||||
|
||||
std::cout << dir.string() << std::endl;
|
||||
|
||||
std::ofstream file(dir, std::ios::binary);
|
||||
|
||||
std::cout << fh.size << std::endl;
|
||||
cargoFile.seekg(fh.offset);
|
||||
|
||||
// Strumień wycišgajšcy
|
||||
|
|
@ -237,7 +191,7 @@ void ExtractCargo::ExtractingFilesFromCargo()
|
|||
if ((fh.flag & flag::zip) == flag::zip)
|
||||
{
|
||||
rawBuffer = (fh.flag & flag::enc) == flag::enc ?
|
||||
eman.decrypt(cman.decompress(buffer, chunkSize)) :
|
||||
cman.decompress(eman.decrypt(buffer), chunkSize) :
|
||||
cman.decompress(buffer, chunkSize);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue