Decrypt data while indexing

Hello @yrodiere,
Thanks for your fast response.I will use an algorithm which will encrypt the database.
It is simple. just uses a key for encryption and decryption.
So i need to implement this algorithm while indexing data to do decryption function.