Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

And if you need an explicit binary, it is very easy to make one. Prepare a large enough file filled with the same byte (or generate them on the fly), let gzip to compress it, then observe where the zero byte start to repeat. Cut everything after that point and repeat the zero byte from there on. In my system:

    $ head -c 10000000 /dev/zero | gzip -c -9 | hexdump
    0000000 8b1f 0008 530a 659e 0302 c1ec 0101 0000
    0000010 8000 fe90 eeaf 0a08 0000 0000 0000 0000
    0000020 0000 0000 0000 0000 0000 0000 0000 0000
    *
    0002010 0000 0000 0000 db80 0383 0012 0000 4100
    0002020 5fff 23b7 0150 0000 0000 0000 0000 0000
    0002030 0000 0000 0000 0000 0000 0000 0000 0000
    *
    00025f0 0000 0000 0000 0000 0000 0000 0000 e000
    0002600 cb26 3ba5 803e 9896 0000
    0002609
So you can keep the first 0x18 bytes and repeat zero bytes after that, preferably very slowly. (The middle bit is an arbitrary block boundary, while the last bit is CRC-32 and the uncompressed size which the client will never see.) I have also used `-c` option to avoid the original file name in the result, which precedes the compressed data.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: