Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2007

Tip: Looking for answers? Try searching our database.

zip, gzip and Deflate

Thread view: 
Bhanu - 16 Apr 2007 10:37 GMT
Hello everyone,

   i have a little concern about which class to use for compression
of the data, The data is some binary encrypted data. java.util.zip
provides three options
   Zip
   Gzip
  Deflator class,

So which one i should use for compression to get better,
 1) Compression ?
 2) Time ?

Any suggestion will help me a lot. :)

Thanks,
Bhanu
usenetuser@hotmail.co.uk - 16 Apr 2007 10:45 GMT
> Hello everyone,
>
[quoted text clipped - 13 lines]
> Thanks,
> Bhanu

Why don't you perform some tests and see which is better *for your and
your data*.
Bhanu - 16 Apr 2007 10:56 GMT
On Apr 16, 2:45 pm, usenetu...@hotmail.co.uk wrote:

> > Hello everyone,
>
[quoted text clipped - 16 lines]
> Why don't you perform some tests and see which is better *for your and
> your data*.

Yes I am doing that but I am using dummy data as the whole application
is not ready yet and I dont have original inputs. I felt may be
someone has already faced this issue. :)
Ian Wilson - 16 Apr 2007 11:23 GMT
> On Apr 16, 2:45 pm, usenetu...@hotmail.co.uk wrote:
>>> i have a little concern about which class to use for compression
[quoted text clipped - 14 lines]
> application is not ready yet and I dont have original inputs. I felt
> may be someone has already faced this issue. :)

The point of encryption is that there should be no pattern in the
cyphertext, since you say "binary" this implied all possible values of
each byte can be used. These two features should make it incompressible.
Chris Uppal - 16 Apr 2007 12:03 GMT
> > > > The data is some binary encrypted data.

> The point of encryption is that there should be no pattern in the
> cyphertext, since you say "binary" this implied all possible values of
> each byte can be used. These two features should make it incompressible.

I missed that point in my own reply to this.  Ian is correct -- there is no
point in trying to compress stuff that has been encrypted[*].

If you need to reduce the sizes then it's best to compress the data before
encryption (which is also better for security, provided you remove the standard
header/trailer from the compressed data).

   -- chris

[*] Technically encrypted data /can/ be highly redundant, and thus highly
compressible -- e.g. just double-up every encrypted byte ;-)  But, of course,
no sensible encryption scheme does produce such trivially redundant output.
Chris Uppal - 16 Apr 2007 11:50 GMT
>     i have a little concern about which class to use for compression
> of the data, The data is some binary encrypted data. java.util.zip
[quoted text clipped - 6 lines]
>   1) Compression ?
>   2) Time ?

If you are just compressing a single stream of data, then there's nothing to be
gained by using ZIP format -- that is designed specifically for packing
/several/ files (compressed) into one larger archive file.

The other two formats are not essentially different.  All three formats use the
same compression algorithm with the same parameters.  The /only/ difference
between "deflate" and "gzip" is that the two formats have different
header/trailer information around the (identical) compressed data.  "deflate"
puts slightly less (I think it's 12 bytes less), but uses a weaker checksum.
Also the "gzip" format can easily be read by external applications such as the
"gzip" command-line utility, which is universal on Unix-alike platforms and
widely available for Windows.

   -- chris
rossum - 16 Apr 2007 15:13 GMT
>Hello everyone,
>
[quoted text clipped - 13 lines]
>Thanks,
>Bhanu
As has been pointed out, it is probably pointless to compress
encrypted data.  The whole point of encryption is to increase the
entropy of the cyphertext, which makes it less compressible.

If you wish to reduce the size of your encrypted files then you should
try compressing the plaintext first and then encrypting the compressed
file.

Two warnings:

1 Most compression formats have standard headers etc.  These may
increase the amount of structure in your file and hence make it easier
to decrypt.  Whether this is a problem depends on how much structure
there is in your uncompressed plaintext and who you are trying to
conceal it from.

2 Generaly avoid the encryption options built into compression
programs.  They are fine for stopping casual snooping but are not as
secure as a properly implemented strong encryption algorithm.

rossum
Bhanu - 16 Apr 2007 16:02 GMT
> >Hello everyone,
>
[quoted text clipped - 35 lines]
>
> rossum

Thanks all of you for helping me out. I was really doing an stupid
thing.
Yeah you should compress first and then encrypt seems logical and
correct.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.