Tutorialsplane

Codeigniter encryption library example


Codeigniter encryption library example : $this->load->library(‘encrypt’); is used for encryption and decryption in codeigniter.

1. first Add encryption key in config.php file.

$config['encryption_key'] = "YOUR ENC KEY";

2. Load Library : $this->load->library(‘encrypt’);

3. Now you can encode/Decode Your message as Below

Encode :

$this->encrypt->encode($msg)

or 
$key = "Your more secure key";
$this->encrypt->encode($msg,$key)

Decode:

$this->encrypt->decode($msg)

or 
$key = "Your more secure key";
$this->encrypt->decode($msg,$key)