CodeIgniter Forums
Encrypt Library and get_key - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Encrypt Library and get_key (/showthread.php?tid=45493)



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);
}