Hi Jeff.
Thank you for your reply. I'm not sure whether RFC 1951 will provide good
compression for these packets or not. Honestly I haven't studied compression
that much. I know the philosophy behind Huffman encoding and RLE and thats
it.
Since I'm plugging in the compression at network level I'm faced with
compressing stream of different packets that can range in size from 12b to
10kb. I have to pass the packets immediately to the network so I might not
have that much information on the data in the beginning. What I was hoping
for was to have some kind of dynamic compressor/uncompressor that would be
able to compress well and adapt without the need of inspecting big chunks of
data for analyzing. I know I will not be able to compress small packets
well, the packets might even expand in size because of the overhead. Do you
know what kind of a compression techniques are used for networks or streams
of data? How would you recommend that I would use the Deflator? Should I
call MessageEnd() after each packet or only Flush() so I will not reset the
Deflator? Or am I missing something here?
Unfortunately I'm writing this is C++ and this has to be portable to other
platforms than Windows so ThreadPool is not a in the picture.
Thanks.
Regards,
Indridi
-----Original Message-----
From: Jeffrey Walton [mailto:[EMAIL PROTECTED]
Sent: 3. janúar 2007 20:16
To: Indridi Bjornsson
Cc: [EMAIL PROTECTED]
Subject: Re: compression
Hi Indridi,
> CryptoPP::Inflator and CryptoPP::Deflator...
RFC 1951
> The size of the packets that are being read and written can
differ in
> size from 12 bytes and up to 10kb...
Is this a good application of RFC1951?
> Should I create a new Inflator / Deflator every time a new packet
> needs to be written?
You seem pretty comfortable with I/O. Do you feel comfortable
with a ThreadPool (pass the buck - let Windows handle thread
management)?
Create one per Thread. After MessageEnd(), the object resets (IIRC).
Also, Compress before you Encrypt - it develops entropy.
Jeff
On 1/3/07, Indridi Bjornsson <[EMAIL PROTECTED]> wrote:
>
>
> Hi all.
>
> I have been using Crypto 4.2 in a project I'm working on for
> encryption of network data. The implementation is rather simple:
>
>
> init()
> {
> itsCipher = new CryptoPP::AESEncryption(itsPassphrase, 16);
> itsCFBEncoder = new
> CryptoPP::CFBEncryption(*(itsCryptor->itsCipher),
> itsIV);
> itsCFBDecoder = new
> CryptoPP::CFBDecryption(*(itsCryptor->itsCipher),
> itsIV);
> }
>
>
> netWrite(const void* inDataBuffer, mmUn32 inDataSize) {
>
> byte *tmpBuf= ...;
> itsCFBEncoder->ProcessString(tmpBuf, (const byte *)inDataBuffer,
> inDataSize);
> // write tmpBuf of size inDataSize to network
> ...
> }
>
> netRead(void* outDataBuffer, mmUn32& ioDataSize) {
> // read to outDataBuffer of max ioDataSize from network.
After reading
> // ioDataSize will contain the number of bytes read
> ...
>
> if (ioDataSize == 0) {
> return;
> }
>
> itsCFBDecoder->ProcessString((byte *)outDataBuffer, ioDataSize); }
>
>
> This is all working well but what I want to do now is to
add compression and
> I was planning of using CryptoPP::Inflator and
CryptoPP::Deflator but I'm
> not sure what would be the best way to do that. The size of
the packets that
> are being read and written can differ in size from 12 bytes
and up to 10kb
> Should I create a new Inflator / Deflator every time a new
packet needs to
> be written? Should I use static compression or dynamic? Anyone?
>
> Thanks in advance,
> Indridi
>
>
>
> > >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Crypto++
Users" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cryptopp-users?hl=en
-~----------~----~----~----~------~----~------~--~---