CodeIgniter Forums
Encrypt Library and get_key - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Encrypt Library and get_key (/thread-45493.html)



Encrypt Library and get_key - El Forum - 09-23-2011

[eluser]Unknown[/eluser]
In looking at the get_key function within the Encrypt.php Library it looks it should be returning the md5 in 32-character hexadecimal format. However when echoing out the key it appears to be in the raw binary format.

What causes this behavior and how can I change it?

Code:
function get_key($key = '')
{
  if ($key == '')
  {
   if ($this->encryption_key != '')
   {
    return $this->encryption_key;
   }

   $CI =& get_instance();
   $key = $CI->config->item('encryption_key');

   if ($key == FALSE)
   {
    show_error('In order to use the encryption class requires that you set an encryption key in your config file.');
   }
  }

  return md5($key);
}