# Using compression tools

Are you allowed to use compression tools (e.g. gzip, xz) in your code?

For example, a shell script with:

cat script.sh.gz|gzcat|sh


(25 bytes)

where the content of script.sh.gz is:

ãö}mbhello.sh=é¡¬0CÔ˚


(166 bytes)

which decompresses to:

echo Hello world!
echo This is a test program.
echo The idea is that it is compressed.
echo But now the programmer doesn't have to worry about program length that much.
echo It's just left to the compression tool.


(214 bytes, which is more than 25+166=191 bytes)

I've seen this (like in an answer to this question, gzip-ing a shell script), but I'm not sure if it is cheating or not.

• @allxy I have read the standard loopholes. When I say this, I mean where script.sh.gz and the other file are both files in the same directory. gzcat is a program that is found in the computer on which the program is run. Apr 30 at 22:41
• Oops, read that as a URL. Apr 30 at 22:41

Say you compressed "abcd" using some compression tool to get "Z" and you can use the code decompress "abcd" to decompress it. The decompress  bit must count in the byte count.
• So, would the above example count as 191 bytes, or would the code size of the gzip executable be counted as well? Apr 30 at 18:46