-->

Using codeigniter encryption and decryption libraries with custom keys examples

encrypt and decrypt in codeigniter using encryption library with example key and custom library
encryption

yusri.irfani.blogspot.com - Using codeigniter encryption and decryption libraries with custom keys examples.

codeigniter encryption example

1. find and edit file : application/config/config.php
2. search this line :

$config['encryption_key'] = '';

Add the encryption key with whatever you want. Here just example:

$config['encryption_key'] = 'mykey';

3. create file MY_Encryption.php in application/libraries. Add with these code:

<?php defined('BASEPATH') OR exit('No direct script access allowed');

class MY_Encryption extends CI_Encryption {

    function encrypt($data, array $params = NULL) {
        $ret = parent::encrypt($data, $params =array());
        $ret = strtr($ret, array('+' => '.', '=' => '-', '/' => '~'));
        return $ret;
    }

    function decrypt($data, array $params = NULL) {
        $string = strtr($data, array('.' => '+', '-' => '=', '~' => '/'));
        return parent::decrypt($string, $params=array());
    }

}  ?>

0 Response to "Using codeigniter encryption and decryption libraries with custom keys examples"

Posting Komentar

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel