Compression of random binary data

Chris Angelico rosuav at gmail.com
Mon Oct 23 05:46:30 EDT 2017


On Mon, Oct 23, 2017 at 8:32 PM,  <danceswithnumbers at gmail.com> wrote:
> According to this website. This is an uncompressable stream.
>
> https://en.m.wikipedia.org/wiki/Incompressible_string
>
> 1234999988884321
>
> It only takes seven 8 bit bytes to represent this

That page says nothing about using a byte to represent each digit. So
if you're going to compress the data into bytes, you then have to
represent your compressed data in some comparable way. The simplest
representation is to treat this as a single number; in hexadecimal, it
would be 46339d7a29361, and if you want a byte representation of a
number, the most trivial way is to take each pair of hex digits and
store the corresponding byte: b"\x4\x63\x39\xd7\xa2\x93\x61" is seven
bytes (six and a half, rounded up). This is not data compression; this
is the more general question of how you store information at the
concrete level.

ChrisA



More information about the Python-list mailing list