#pragma once #include #include #include #include #include #include #define ZSTD_STATIC_LINKING_ONLY #include #if ZSTD_VERSION_NUMBER < 10400 #error "Wymagane zstd >= 1.4.0 dla ZSTD_c_format / ZSTD_f_zstd1_magicless" #endif #include "EncryptionManager.h" #define BLOCK_SIZE 131072 // 128KB #define COMPRESSION_LEVEL 3 struct BlockSize { uint32_t raw; uint32_t zip; }; class ChunkManager { public: ChunkManager(EncryptionManager& em); ~ChunkManager(); // Kompresja danych std::vector chunked(const std::vector&, const bool&, const bool&); // Dekompresja std::vector dechunked(const std::vector&, const bool&, const bool&); private: EncryptionManager eman; std::vector blockSizes; // Przekonwertuj zmienną na ciąg na vector template void addIntToVector(std::vector& vec, const T& val) { size_t tmpSize = vec.size(); vec.resize(tmpSize + sizeof(val)); std::memcpy(vec.data() + tmpSize, &val, sizeof(val)); } // Pobierz zmienną z vectora template T getIntFromVector(const std::vector& vec, size_t& offset) { T tmp{}; std::memcpy(&tmp, vec.data() + offset, sizeof(tmp)); offset += sizeof(tmp); return tmp; } // Kompresja std::vector compress_data(const std::vector&); // Dekompresja std::vector decompress_data(const std::vector&, const size_t&); };