16 static const byte DEFLATE_METHOD = 8;
17 static const byte FDICT_FLAG = (1 << 5);
21 void ZlibCompressor::WritePrestreamHeader()
27 byte flags = byte(GetCompressionLevel() << 6);
31 void ZlibCompressor::ProcessUncompressedData(
const byte *inString,
size_t length)
33 m_adler32.
Update(inString, length);
36 void ZlibCompressor::WritePoststreamTail()
39 m_adler32.
Final(adler32);
43 unsigned int ZlibCompressor::GetCompressionLevel()
const 45 static const unsigned int deflateToCompressionLevel[] = {0, 1, 1, 1, 2, 2, 2, 2, 2, 3};
52 :
Inflator(attachment, repeat, propagation), m_log2WindowSize(0)
56 void ZlibDecompressor::ProcessPrestreamHeader()
63 if (!m_inQueue.Get(cmf) || !m_inQueue.Get(flags))
66 if ((cmf*256+flags) % 31 != 0)
69 if ((cmf & 0xf) != DEFLATE_METHOD)
72 if (flags & FDICT_FLAG)
75 m_log2WindowSize = 8 + (cmf >> 4);
78 void ZlibDecompressor::ProcessDecompressedData(
const byte *inString,
size_t length)
81 m_adler32.
Update(inString, length);
84 void ZlibDecompressor::ProcessPoststreamTail()
87 if (m_inQueue.Get(adler32, 4) != 4)
89 if (!m_adler32.
Verify(adler32))
ZlibDecompressor(BufferedTransformation *attachment=NULL, bool repeat=false, int autoSignalPropagation=-1)
Construct a ZlibDecompressor.
DEFLATE compression and decompression (RFC 1951)
Classes and functions for secure memory allocations.
ZLIB compression and decompression (RFC 1950)
BufferedTransformation * AttachedTransformation()
Retrieve attached transformation.
void Update(const byte *input, size_t length)
Updates a hash with additional input.
Fixed size stack-based SecBlock.
#define CRYPTOPP_ASSERT(exp)
Debugging and diagnostic assertion.
DEFLATE compression and decompression (RFC 1951)
int GetLog2WindowSize() const
Retrieves the window size.
DEFLATE decompressor (RFC 1951)
int GetDeflateLevel() const
Retrieves the deflation level.
T1 RoundUpToMultipleOf(const T1 &n, const T2 &m)
Rounds a value up to a multiple of a second value.
Crypto++ library namespace.