Just curious if out of the box does Tor use a Gzip or any other kind of compression? I have done some searches but find only discussions about the Hidden Service directory.
From the source code on GitHub I did a search for "gzip" and found the compression code:
After searching a bit more I was unable to find their compression routines called from anywhere but within the directory. It appears Tor is only using compression for the directory tables
Tor encrypts its connections from the client to relays or from relay to another. Encrypted data looks like random data to an outsider. This is a very bad case for compression, because the compression algorithm finds very few similarities to put together. So encrypted data can hardly be compressed. It is more the opposite. Usually encrypted and then compressed data are usually bigger than encrypted data alone. Thatswhy it makes no sense for Tor to compress its data during transport.
It was asked in the comments if Tor couldn't compress first and than encrypt. Tor operates on TCP packets. This is the transport level. Tor doesn't know about protocols at the application layer, like HTTP. But data compression is handled on the application level. For instance a browser could tell the server that it supports gzip compression and the server sends compressed data. If Tor should handle those things it must know every protocol at the application level (HTTP, SMTP, IMAP, DNS etc.), negotiate compression and so on. This would heavily enlarge the binary, probably introduce a large number of bugs and Tor has to do things what an application like a browser, mail client etc. could do better.