13 AttachedTransformation()->
Put(MAGIC1);
14 AttachedTransformation()->Put(MAGIC2);
15 AttachedTransformation()->Put(DEFLATED);
16 AttachedTransformation()->Put(0);
17 AttachedTransformation()->PutWord32(0);
18 byte extra = byte((GetDeflateLevel() == 1) ? FAST : ((GetDeflateLevel() == 9) ? SLOW : 0));
19 AttachedTransformation()->Put(extra);
20 AttachedTransformation()->Put(GZIP_OS_CODE);
23 void Gzip::ProcessUncompressedData(
const byte *inString,
size_t length)
25 m_crc.
Update(inString, length);
26 m_totalLen += (word32)length;
29 void Gzip::WritePoststreamTail()
40 :
Inflator(attachment, repeat, propagation), m_length(0)
44 void Gunzip::ProcessPrestreamHeader()
52 if (m_inQueue.Get(buf, 2)!=2)
throw HeaderErr();
53 if (buf[0] != MAGIC1 || buf[1] != MAGIC2)
throw HeaderErr();
54 if (!m_inQueue.Skip(1))
throw HeaderErr();
55 if (!m_inQueue.Get(flags))
throw HeaderErr();
56 if (flags & (ENCRYPTED | CONTINUED))
throw HeaderErr();
57 if (m_inQueue.Skip(6)!=6)
throw HeaderErr();
59 if (flags & EXTRA_FIELDS)
62 if (m_inQueue.GetWord16(length, LITTLE_ENDIAN_ORDER) != 2)
throw HeaderErr();
63 if (m_inQueue.Skip(length)!=length)
throw HeaderErr();
77 void Gunzip::ProcessDecompressedData(
const byte *inString,
size_t length)
80 m_crc.
Update(inString, length);
81 m_length += (word32)length;
84 void Gunzip::ProcessPoststreamTail()
87 if (m_inQueue.Get(crc, 4) != 4)
93 if (m_inQueue.GetWord32(lengthCheck, LITTLE_ENDIAN_ORDER) != 4)
95 if (lengthCheck != m_length)
SecByteBlock is a SecBlock<byte> typedef.
Gunzip(BufferedTransformation *attachment=NULL, bool repeat=false, int autoSignalPropagation=-1)
Construct a Gunzip.
BufferedTransformation * AttachedTransformation()
Retrieve attached transformation.
void Update(const byte *input, size_t length)
Updates a hash with additional input.
DEFLATE (RFC 1951) decompressor.
Crypto++ library namespace.
GZIP Compression (RFC 1952)