AuroraRuntime/Include/Aurora/Compression/CompressionInfo.hpp
Reece Wilson 8844e8fe64 [+] AuCrypto::BCrypt
> GetForcedMinRounds
> GenSalt
> HashPW
> HashPWEx
> CheckPassword
> CheckPasswordEx
[*] Refactor AuCompression APIs
[*] Clean up AuTryConstructs
[+] Internal compression API for compression based interceptors
[+] Root-level input stream arg check for all compression apis (harden)
[*] Clean up AuCompression code
[+] Solar Designer / OpenWall blowfish crypt
[*] BlowCrypt: accept length input parameter
[*] Split locale into 2 source files
[-] Ugly comment from Open.Win32.cpp. TODO: Readd later. Might warn on empty string bc it makes sense given, "." and "/" normalizes to nothing, and memory pre-idc-if-drops are dropped siliently.
2022-09-15 20:48:50 +01:00

123 lines
2.8 KiB
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: CompressInfo.hpp
Date: 2021-7-14
Author: Reece
***/
#pragma once
namespace Aurora::Compression
{
struct CompressInfo
{
AU_COPY_MOVE_DEF(CompressInfo);
ECompressionType type;
/**
* @brief
*
* ZSTD: -5 <= level <= 22
* recommended: ZSTD_CLEVEL_DEFAULT
* LZMA: 0 <= level <= 9
* LZ4 : N/A
* Deflate: 0 <= x >= 9,
* recommended: 6
* Zip: 0 <= x >= 9,
* recommended: 6
* GZip: 0 <= x >= 9,
* recommended: 6
* BZIP: 0 <= x >= 9
*
*/
AuInt8 uCompressionLevel {6};
/**
* @brief LZMA: 5 <= fb <= 273, default = 32
*/
AuUInt32 uFbWordSize {32};
/**
* LZMA only
* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version
* (1 << 12) <= dictSize <= (3 << 29) for 64-bit version
* default = (1 << 24)
*/
AuUInt32 uDictSize{};
/**
* @brief 64KiB is a recommended "small" block size
*/
AuUInt16 uLz4BlockSize {};
bool bHasWindowbits {true};
/**
* @brief DEFLATE related variabl
*
* Deflate: 0 <= x >= 15,
* recommended: 15
* Zip: 0 <= x >= 15,
* recommended: 15
* GZip: 0 <= x >= 15,
* recommended: 15
*/
AuUInt8 uWindowBits {15};
/**
* @brief Internal output buffer size.
* Internal swap page is undefined.
*/
AuUInt32 uInternalStreamSize { 10 * 4096 };
AuUInt8 uThreads {1};
bool bLZ4AutoFlush {false};
inline CompressInfo(ECompressionType alg) : type(alg)
{
}
inline CompressInfo(ECompressionType alg, AuUInt32 bufferSize) : type(alg), uInternalStreamSize(bufferSize)
{
}
};
struct DecompressInfo
{
AU_COPY_MOVE(DecompressInfo);
/**
* @brief algorithm
*/
ECompressionType alg { ECompressionType::eDeflate };
/**
* @brief Internal output buffer size. Internal swap page is undefined.
*/
AuUInt32 uInternalStreamSize { 10 * 4096 };
/**
* @brief Flag for headerless decompression streams
*/
bool bHasWindowbits {true};
/**
* @brief Flag for headerless decompression streams
*/
AuInt8 uWindowBits {15};
inline DecompressInfo(ECompressionType alg) : alg(alg)
{
}
inline DecompressInfo(ECompressionType alg, AuUInt32 bufferSize) : alg(alg), uInternalStreamSize(bufferSize)
{
}
};
}