Zip and Rar are compression formats and don't really do anything with
encryption. You can just Google for the Zip File format and Rar file format
and get the file layouts.
Actually here is a good link, just search for zip, its in there
www.wotsit.org
great resource. both rar and zip are there, I just searched.
Now, for your encryption questoin.
There are two types of encryption, asymmetrical and symmetrical encryption.
Asymetrical is most known as public key encryption, where one key encrypts
the data and another one decrypts it. This is most notably seen in the RSA
encryption method (good reading).
Symmetrical uses the same key to decrypt as it does to encrypt (sometimes
using an Initializiation Vector (IV) to facilitate encryption further).
Each one has its own purpose, it just depends what /how you want to use it.
What do you want to know about it further?
-CJ