Deflate
It's compression algorithm
window size (32K sliding window): 32KB bytes
The maximum compression ratio of the deflate format is 1032:1. This is because the longest run that can be encoded is 258 bytes. At least two bits are required for each such run (one bit for the length code and one bit for the distance code), hence 4*258 = 1032 uncompressed bytes can be encoded per one compressed byte.
You can get more compression by gzipping the result of gzip. Normally that doesn't improve compression, but for very long runs it can.
Ther is no official extension, but .z
(or .zz
) is usually used. See List of archive formats — Wikipedia and java - Is there an official (or common) file extention or suffix for deflated files? - Stack Overflow
zlib header
Valid zlib header must be divisible by 31
Examples:
78 01
- No Compression/low78 9C
- Default Compression78 DA
- Best Compression
Resources
printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" | cat - zlib.bin | gzip -dc
zlib inflateprintf "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x00" | cat - zlib-raw.bin | gzip -dc
zlib raw inflateopenssl zlib -d < zlib.bin
https://github.com/dankogai/js-deflate and https://github.com/beatgammit/deflate-js
https://github.com/imaya/zlib.js
https://github.com/chrisdickinson/inflate
https://github.com/oyvindln/deflate-rs
https://github.com/PistonDevelopers/inflate
https://github.com/mozilla/pdf.js FlateStream
madler/infgen: Deflate disassember to convert a deflate, zlib, or gzip stream into a readable form. -
gcc infgen.c -o infgen && ./infgen -h
Decompression Bomb
Last updated
Was this helpful?