6 #ifndef CRYPTOPP_ZDEFLATE_H 7 #define CRYPTOPP_ZDEFLATE_H 25 void PutBits(
unsigned long value,
unsigned int length);
26 void FlushBitBuffer();
27 void ClearBitBuffer();
30 unsigned long FinishCounting();
60 void Initialize(
const unsigned int *codeBits,
unsigned int nCodes);
62 static void GenerateCodeLengths(
unsigned int *codeBits,
unsigned int maxCodeBits,
const unsigned int *codeCounts,
size_t nCodes);
84 MIN_DEFLATE_LEVEL = 0,
86 DEFAULT_DEFLATE_LEVEL = 6,
88 MAX_DEFLATE_LEVEL = 9};
93 MIN_LOG2_WINDOW_SIZE = 9,
95 DEFAULT_LOG2_WINDOW_SIZE = 15,
97 MAX_LOG2_WINDOW_SIZE = 15};
107 Deflator(
BufferedTransformation *attachment=NULL,
int deflateLevel=DEFAULT_DEFLATE_LEVEL,
int log2WindowSize=DEFAULT_LOG2_WINDOW_SIZE,
bool detectUncompressible=
true);
117 void SetDeflateLevel(
int deflateLevel);
128 size_t Put2(
const byte *inString,
size_t length,
int messageEnd,
bool blocking);
129 bool IsolatedFlush(
bool hardFlush,
bool blocking);
137 enum {STORED = 0, STATIC = 1, DYNAMIC = 2};
138 enum {MIN_MATCH = 3, MAX_MATCH = 258};
140 void InitializeStaticEncoders();
141 void Reset(
bool forceReset =
false);
142 unsigned int FillWindow(
const byte *str,
size_t length);
143 unsigned int ComputeHash(
const byte *str)
const;
144 unsigned int LongestMatch(
unsigned int &bestMatch)
const;
145 void InsertString(
unsigned int start);
146 void ProcessBuffer();
148 void LiteralByte(
byte b);
149 void MatchFound(
unsigned int distance,
unsigned int length);
150 void EncodeBlock(
bool eof,
unsigned int blockType);
151 void EndBlock(
bool eof);
155 unsigned literalCode : 9;
156 unsigned literalExtra : 5;
157 unsigned distanceCode : 5;
158 unsigned distanceExtra : 13;
163 unsigned int DSIZE, DMASK, HSIZE, HMASK, GOOD_MATCH,
MAX_LAZYLENGTH, MAX_CHAIN_LENGTH;
165 unsigned int m_dictionaryEnd,
m_stringStart, m_lookahead, m_minLookahead, m_previousMatch, m_previousLength;
Utility functions for the Crypto++ library.
#define NAMESPACE_BEGIN(x)
SecByteBlock m_byteBuffer
int GetLog2WindowSize() const
Retrieves the window size.
Secure memory block with allocator and cleanup.
Abstract base classes that provide a uniform interface to this library.
SecBlock< EncodedMatch > m_matchBuffer
virtual void ProcessUncompressedData(const byte *string, size_t length)
DEFLATE compressor (RFC 1951)
SecBlock< Code > m_valueToCode
unsigned int m_matchBufferEnd
int GetDeflateLevel() const
Retrieves the deflation level.
void Encode(LowFirstBitWriter &writer, value_t value) const
FixedSizeSecBlock< unsigned int, 30 > m_distanceCounts
static void GenerateCodeLengths(unsigned int *codeBits, unsigned int maxCodeBits, const unsigned int *codeCounts, size_t nCodes)
unsigned int m_bytesBuffered
unsigned int m_detectSkip
HuffmanEncoder()
Construct a HuffmanEncoder.
unsigned int MAX_LAZYLENGTH
Implementation of BufferedTransformation's attachment interface.
virtual void WritePrestreamHeader()
FixedSizeSecBlock< unsigned int, 286 > m_literalCounts
#define CRYPTOPP_UNUSED(x)
void Initialize(const unsigned int *codeBits, unsigned int nCodes)
Initialize or reinitialize this object.
Implementation of BufferedTransformation's attachment interface.
SecBlock< word16 > m_prev
unsigned int m_stringStart
std::vector< char * > parameters
FixedSizeSecBlock< byte, 256 > m_outputBuffer
virtual void WritePoststreamTail()
HuffmanEncoder m_staticLiteralEncoder
Interface for retrieving values given their names.