Crypto++
5.6.4
Free C++ class library of cryptographic schemes
|
Go to the documentation of this file.
6 #ifndef CRYPTOPP_ZDEFLATE_H
7 #define CRYPTOPP_ZDEFLATE_H
23 void PutBits(
unsigned long value,
unsigned int length);
24 void FlushBitBuffer();
25 void ClearBitBuffer();
28 unsigned long FinishCounting();
32 unsigned long m_bitCount;
33 unsigned long m_buffer;
34 unsigned int m_bitsBuffered, m_bytesBuffered;
42 typedef unsigned int code_t;
43 typedef unsigned int value_t;
56 void Initialize(
const unsigned int *codeBits,
unsigned int nCodes);
58 static void GenerateCodeLengths(
unsigned int *codeBits,
unsigned int maxCodeBits,
const unsigned int *codeCounts,
size_t nCodes);
123 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking);
127 virtual void WritePrestreamHeader() {}
128 virtual void ProcessUncompressedData(
const byte *
string,
size_t length)
129 {CRYPTOPP_UNUSED(
string), CRYPTOPP_UNUSED(length);}
130 virtual void WritePoststreamTail() {}
132 enum {STORED = 0, STATIC = 1, DYNAMIC = 2};
133 enum {MIN_MATCH = 3, MAX_MATCH = 258};
135 void InitializeStaticEncoders();
136 void Reset(
bool forceReset =
false);
137 unsigned int FillWindow(
const byte *str,
size_t length);
138 unsigned int ComputeHash(
const byte *str)
const;
139 unsigned int LongestMatch(
unsigned int &bestMatch)
const;
140 void InsertString(
unsigned int start);
141 void ProcessBuffer();
143 void LiteralByte(
byte b);
144 void MatchFound(
unsigned int distance,
unsigned int length);
145 void EncodeBlock(
bool eof,
unsigned int blockType);
146 void EndBlock(
bool eof);
150 unsigned literalCode : 9;
151 unsigned literalExtra : 5;
152 unsigned distanceCode : 5;
153 unsigned distanceExtra : 13;
156 int m_deflateLevel, m_log2WindowSize, m_compressibleDeflateLevel;
157 unsigned int m_detectSkip, m_detectCount;
158 unsigned int DSIZE, DMASK, HSIZE, HMASK, GOOD_MATCH, MAX_LAZYLENGTH, MAX_CHAIN_LENGTH;
159 bool m_headerWritten, m_matchAvailable;
160 unsigned int m_dictionaryEnd, m_stringStart, m_lookahead, m_minLookahead, m_previousMatch, m_previousLength;
161 HuffmanEncoder m_staticLiteralEncoder, m_staticDistanceEncoder, m_dynamicLiteralEncoder, m_dynamicDistanceEncoder;
167 unsigned int m_matchBufferEnd, m_blockStart, m_blockLength;
@ MAX_LOG2_WINDOW_SIZE
Maximum window size, largest table (15)
HuffmanEncoder()
Construct a HuffmanEncoder.
@ MIN_LOG2_WINDOW_SIZE
Minimum window size, smallest table (9)
DEFLATE compressor (RFC 1951)
@ DEFAULT_DEFLATE_LEVEL
Default deflation level, compromise between speed (6)
void Initialize(const unsigned int *codeBits, unsigned int nCodes)
Initialize or reinitialize this object.
Implementation of BufferedTransformation's attachment interface.
Utility functions for the Crypto++ library.
Implementation of BufferedTransformation's attachment interface.
@ MAX_DEFLATE_LEVEL
Minimum deflation level, slowest speed (9)
void IsolatedInitialize(const NameValuePairs ¶meters)
Initialize or reinitialize this object, without signal propagation.
int GetDeflateLevel() const
Retrieves the deflation level.
@ DEFAULT_LOG2_WINDOW_SIZE
Default window size (15)
@ MIN_DEFLATE_LEVEL
Minimum deflation level, fastest speed (0)
void SetDeflateLevel(int deflateLevel)
Sets the deflation level.
int GetLog2WindowSize() const
Retrieves the window size.
Crypto++ library namespace.
Secure memory block with allocator and cleanup.
Deflator(BufferedTransformation *attachment=NULL, int deflateLevel=DEFAULT_DEFLATE_LEVEL, int log2WindowSize=DEFAULT_LOG2_WINDOW_SIZE, bool detectUncompressible=true)
Construct a Deflator compressor.
size_t Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
Input multiple bytes for processing.
Interface for retrieving values given their names.
Abstract base classes that provide a uniform interface to this library.
bool IsolatedFlush(bool hardFlush, bool blocking)
Flushes data buffered by this object, without signal propagation.