1. A method comprises: obtaining data to store; determining whether similar data to the data is stored; and when the similar data is stored: encrypting the data using an encryption key of the similar data in accordance with an encryption function to produce encrypted data; compressing the encrypted data in accordance with a compression function to produce compressed data; and storing the compressed data; and when the similar data is not stored: generating a first encryption key based on the data; encrypting the data using the first encryption key in accordance with the encryption function to produce first encrypted data; compressing the first encrypted data in accordance with the compression function to produce first compressed data; and storing the first compressed data.