Gzip Questions

80 views
Skip to first unread message

Hal Vaughan

unread,
Mar 12, 2013, 2:13:39 AM3/12/13
to cryptop...@googlegroups.com
I'm reading in binary files that I want to compress with Gzip in Crypto++.  I found this example (http://www.codeproject.com/Articles/835/Compression-and-decompression-using-the-Crypto-lib), which is for an earlier version of Crypto++.

I've noticed there is no longer a Gzip.Close() function for zipping or unzipping.  Is there another way to signal that I'm done providing data to be compressed (or uncompressed)?

And my other question relates to the byte* array used to read in data.  I know I can cast char* to byte* without any problem, but other than iterating through every byte in an array, I don't see any way to create a const byte* array from data I've loaded in from a file.  The read statements all produce output in char* arrays.

I tried casting my char* to byte* and using Gzip.PutModifiable() to pass my data on for compression, but apparently I'm not getting actual compression that way.  (Unless it's somehow possible to DEFLATE a 16MB file to 10 bytes!)


Do I need to do something to indicate I'm done providing data to DEFLATE or INFLATE?

And does PutModifiable() work differently than Put()?  (I know it's not a Gzip issue, but I can't find a way to convert a char* array to a const byte* array and I have been searching.)

Jeffrey Walton

unread,
Mar 13, 2013, 2:35:05 AM3/13/13
to Crypto++ Users


On Mar 12, 2:13 am, Hal Vaughan <tangoovers...@gmail.com> wrote:
> I'm reading in binary files that I want to compress with Gzip in Crypto++.
>  I found this example
> (http://www.codeproject.com/Articles/835/Compression-and-decompression...),
> which is for an earlier version of Crypto++.
>
> I've noticed there is no longer a Gzip.Close() function for zipping or
> unzipping.  Is there another way to signal that I'm done providing data to
> be compressed (or uncompressed)?
http://www.cryptopp.com/docs/ref/class_gzip.html

> I tried casting my char* to byte* and using Gzip.PutModifiable() to pass my
> data on for compression, but apparently I'm not getting actual compression
> that way.  (Unless it's somehow possible to DEFLATE a 16MB file to 10
> bytes!)
Call MessageEnd() when yo are finished putting data.

Jeff

Hal Vaughan

unread,
Mar 14, 2013, 5:20:32 PM3/14/13
to Jeffrey Walton, Crypto++ Users

Okay.  Working fine now.  Thank you!

--
--
You received this message because you are subscribed to the "Crypto++ Users" Google Group.
To unsubscribe, send an email to cryptopp-user...@googlegroups.com.
More information about Crypto++ and this group is available at http://www.cryptopp.com.
---
You received this message because you are subscribed to a topic in the Google Groups "Crypto++ Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cryptopp-users/cj_Lrv4vdGE/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to cryptopp-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply all
Reply to author
Forward
0 new messages