4 ms·
Trivially. Zip file headers specify where the data is. All other bytes are ignored. That's how self extraction archives and installers work and are also valid
by nwallin 10mo ago
Trivially. Zip file headers specify where the data is. All other bytes are ignored.
That's how self extraction archives and installers work and are also valid zip files. The extractor part is just a regular executable that is a zip decompresser that decompresses itself.
This is specific to zip files, not the deflate algorithm.
- ks2048 10mo agoThat would be a big zip file, but would not take a long time to unzip.
- Retr0id 10mo agoThere are also deflate-specific tricks you can use - just spam empty non-final blocks ad infinitum. import zlib zlib.decompress(b"\x00\x00\x00\xff\xff" * 1000 + b"\x03\x00", wbits=-15) If you want to spin more CPU, you'd probably want to define random huffman trees and then never use them.
- Retr0id 10mo agoI had claude implement the random-huffman-trees strategy and it works alright (~20MB/s decompression speed), but a minimal huffman tree that only encodes the end symbol works out even slower (~10MB/s), presumably because each tree is more compact. The minimal version boils down to: bytes.fromhex("04c001090000008020ffaf96") * 1000000 + b"\x03\x00"