November 1, 2012 learn_php

Encrypt – Decrypt Class

I have come across a few petitions from some of you readers, and I will try to accomplish all of your requests as soon as possible. The first here is a class that I have built based on some ecnryption and decryption functions that I have used in the past. These functions can be found here:

I took the liberty to create a class so that it can be downloaded by you guys. The use is simple and I can explain how to use it. Just include the class file and create a new object from it:


In order to encrypt or decrypt, we will need to send in the the string to process, and a passphrase called the key. This key is to make your encryption/decryption process unique to your website. The way to do it is as follows:

Before Using!!

Make sure you initialize the the variables within the class before you encrypt or decrypt. This is to prevent errors.

Below I have the full code for the class. I will soon put it up on github so that it will be available for downloaded.

Leave a Reply

Your email address will not be published. Required fields are marked *

The qTranslate Editor has disabled itself because it hasn't been tested with your Wordpress version yet. This is done to prevent Wordpress from malfunctioning. You can reenable it by clicking here (may cause data loss! Use at own risk!). To remove this message permanently, please update qTranslate to the corresponding version.