Codeigniter Encryption Code

Let's say I have this configured as my encryption key, and I already have an encryption library at startup:

$config['encryption_key'] = 'bjA{<ATCs1w5?,8N(bJvgO3CW_<]t?@o';

How to use it in encryption function?

function s()
{
    $something = $this->encrypt->encode('eoaighaeg',$key);
    echo $this->encrypt->decode($something, $key); 
}

^ Non-working example to give you an idea.

+5
source share
2 answers

According to this documentation, http://codeigniter.com/nightly_user_guide/libraries/encryption.html

If you have not specified any key parameter for the function $ this-> encrypt-> encode (), it automatically uses the configuration encryption key.

$this->encrypt->encode($msg);
+8
source

No. CI already does this, as you can read in the manual

, , , :

$msg = 'Message';
$key = 'bjA{<ATCs1w5?,8N(bJv';

$encrypted_string = $this->encrypt->encode($msg, $key);

,

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

CI .

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

+4

All Articles