We gzip the data first, then encrypt it, finally base64 encode it.
We gzip the data first, then encrypt it, finally base64 encode it.
Schneier, in Applied Cryptography (which: avoid) recommended compressing before encrypting. That was bad advice. Compression and encryption interact in treacherous ways. Get of out the habit of combining them.
> compressed data should not be encrypted?
That's really tricky to answer simply. "No" might be taken to mean you should store compressed data unencrypted, which would be much worse. Nor do you have to decompress already compressed data before encrypting. But if somebody hands you data to encrypt and store, don't compress it as part of the encrypting phase.
> crypt encrypts, compresses, then encodes your value for storage