I store userNames, passwords and security-tokens using CodeIgniter's encode method like -
$this->load->library('encrypt');
//...
$password = $this->encrypt->encode($rows["password"]);
//Then save it in password column of user_credentials table.
Now, In python, I want to decode this encoded password. I have been trying to decode it with python's hashlib, but I am not able to.
I think it is because CI's encrypt library does more than md5 on the password-
function encode($string, $key = '')
{
$key = $this->get_key($key);
if ($this->_mcrypt_exists === TRUE)
{
$enc = $this->mcrypt_encode($string, $key);
}
else
{
$enc = $this->_xor_encode($string, $key);
}
return base64_encode($enc);
}
function decode($string, $key = '')
{
$key = $this->get_key($key);
if (preg_match('/[^a-zA-Z0-9\/\+=]/', $string))
{
return FALSE;
}
$dec = base64_decode($string);
if ($this->_mcrypt_exists === TRUE)
{
if (($dec = $this->mcrypt_decode($dec, $key)) === FALSE)
{
return FALSE;
}
}
else
{
$dec = $this->_xor_decode($dec, $key);
}
return $dec;
}
How should I decode it? I need to write above decode function in python. Please help.