Deflating a File

Discussion in 'Java' started by Chase Preuninger, Apr 17, 2008.

  1. One thing I just noticed was that when I deflated a file full or
    random bytes it actually increased its size. Just thought that was
    kind of neat.
     
    Chase Preuninger, Apr 17, 2008
    #1
    1. Advertising

  2. Chase Preuninger wrote:
    > One thing I just noticed was that when I deflated a file full or
    > random bytes it actually increased its size. Just thought that was
    > kind of neat.


    Compression works by collapsing redundant sequences of information into
    shorter bit strings, typically (though not always) through some sort of
    dictionary system or run-length encoding. True random data cannot be
    compressed most of the time; sufficiently pseudorandom data is also not
    likely to be compressed well either.

    Random data being compressed would be surprising.


    --
    Beware of bugs in the above code; I have only proved it correct, not
    tried it. -- Donald E. Knuth
     
    Joshua Cranmer, Apr 17, 2008
    #2
    1. Advertising

  3. Chase Preuninger wrote:
    > One thing I just noticed was that when I deflated a file full or
    > random bytes it actually increased its size. Just thought that was
    > kind of neat.


    The job of a compression algorithm is to map some class of files to
    shorter files. Since there is a fixed number of possible files of each
    length, to achieve that it also has to map other files to longer files.

    Patricia
     
    Patricia Shanahan, Apr 17, 2008
    #3
  4. Chase Preuninger

    Roedy Green Guest

    On Thu, 17 Apr 2008 13:09:21 -0700 (PDT), Chase Preuninger
    <> wrote, quoted or indirectly quoted someone
    who said :

    >One thing I just noticed was that when I deflated a file full or
    >random bytes it actually increased its size. Just thought that was
    >kind of neat.


    That's to be expected. You add the overhead without getting ANYTHING
    back. A random file by definition can't be compressed.

    Zipping a mess of zips buys you a little not because the zip parts
    compress, but because the filenames and other uncompressed parts
    compress.
    --

    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
     
    Roedy Green, Apr 18, 2008
    #4
  5. On Apr 17, 4:57 pm, Joshua Cranmer <> wrote:
    > Chase Preuninger wrote:
    > > One thing I just noticed was that when I deflated a file full or
    > > random bytes it actually increased its size.  Just thought that was
    > > kind of neat.

    >
    > Compression works by collapsing redundant sequences of information into
    > shorter bit strings, typically (though not always) through some sort of
    > dictionary system or run-length encoding. True random data cannot be
    > compressed most of the time; sufficiently pseudorandom data is also not
    > likely to be compressed well either.
    >
    > Random data being compressed would be surprising.


    *Pseudo*random data can, of course, be compressed to a description
    (goedel number? source code? whatever) of the algorithm plus the
    initial conditions used to generate the values. This suggests to me
    that there might be a fixed (or almost fixed) amount of entropy in
    PRNG output, regardless of how many digits of output you have.

    Hmm.

    -o
     
    Owen Jacobson, Apr 18, 2008
    #5
  6. Owen Jacobson <> wrote:
    > *Pseudo*random data can, of course, be compressed to a description
    > (goedel number? source code? whatever) of the algorithm plus the
    > initial conditions used to generate the values. This suggests to me
    > that there might be a fixed (or almost fixed) amount of entropy in
    > PRNG output, regardless of how many digits of output you have.


    If it's say 1e1000000000000000000 digits from the PRNG-Output, it's
    not all that "regardless", as you'll need some extra bytes to encode
    the actual length of the sequence :)
     
    Andreas Leitgeb, Apr 18, 2008
    #6
  7. Chase Preuninger

    Arne Vajhøj Guest

    Owen Jacobson wrote:
    > On Apr 17, 4:57 pm, Joshua Cranmer <> wrote:
    >> Chase Preuninger wrote:
    >>> One thing I just noticed was that when I deflated a file full or
    >>> random bytes it actually increased its size. Just thought that was
    >>> kind of neat.

    >> Compression works by collapsing redundant sequences of information into
    >> shorter bit strings, typically (though not always) through some sort of
    >> dictionary system or run-length encoding. True random data cannot be
    >> compressed most of the time; sufficiently pseudorandom data is also not
    >> likely to be compressed well either.
    >>
    >> Random data being compressed would be surprising.

    >
    > *Pseudo*random data can, of course, be compressed to a description
    > (goedel number? source code? whatever) of the algorithm plus the
    > initial conditions used to generate the values. This suggests to me
    > that there might be a fixed (or almost fixed) amount of entropy in
    > PRNG output, regardless of how many digits of output you have.


    True.

    But current available compression algorithms does not analyze
    data and detect the RNG algorithm. And I am pretty sure that
    they will not in the future either.

    So in practice the data does not compress.

    Arne
     
    Arne Vajhøj, Apr 19, 2008
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Luis Esteban Valencia Muñoz
    Replies:
    3
    Views:
    1,445
    Scott Allen
    Jun 4, 2005
  2. Dave
    Replies:
    1
    Views:
    1,035
    Juan T. Llibre
    Jun 8, 2007
  3. =?ISO-8859-2?Q?Miros=B3aw?= Makowiecki

    Reading of file by next of map file and by next of file descriptor.

    =?ISO-8859-2?Q?Miros=B3aw?= Makowiecki, Jul 10, 2007, in forum: C++
    Replies:
    1
    Views:
    826
    Alf P. Steinbach
    Jul 10, 2007
  4. scad
    Replies:
    4
    Views:
    980
    James Kanze
    May 28, 2009
  5. Ludwigi Beethoven
    Replies:
    5
    Views:
    343
    Mike Hall
    Jul 26, 2003
Loading...

Share This Page