Welcome Guest, Not a member yet? Register   Sign In
md5 to sha1
#1

[eluser]clintonbeattie[/eluser]
Hi,

I have a function to add an encrypted password to a database which is this...
Code:
function validate()
    {
        $this->db->where('username', $this->input->post('username'));
        $this->db->where('password', md5($this->input->post('password')));  
        $query = $this->db->get('membership');
        
        if($query->num_rows == 1)
        {
            return true;
        }
        
    }

What I would like to do is use SHA1. I have added an encryption key to my config file and added this function to my model...
Code:
function _prep_password($password)
{
     return sha1($password.$this->config->item('encryption_key'));
}

How would I go about using this in my current code? This maybe?

Code:
$this->db->where('password', md5($this->input->post(_prep_password($password))));

Thanks for any advice.

C


Messages In This Thread
md5 to sha1 - by El Forum - 10-19-2009, 11:24 AM
md5 to sha1 - by El Forum - 10-19-2009, 12:14 PM
md5 to sha1 - by El Forum - 10-19-2009, 12:17 PM
md5 to sha1 - by El Forum - 10-19-2009, 12:28 PM
md5 to sha1 - by El Forum - 10-19-2009, 12:42 PM
md5 to sha1 - by El Forum - 10-19-2009, 12:47 PM
md5 to sha1 - by El Forum - 10-19-2009, 03:07 PM
md5 to sha1 - by El Forum - 10-20-2009, 12:13 PM
md5 to sha1 - by El Forum - 10-21-2009, 01:07 AM
md5 to sha1 - by El Forum - 10-21-2009, 02:24 AM
md5 to sha1 - by El Forum - 10-21-2009, 11:11 AM
md5 to sha1 - by El Forum - 10-21-2009, 12:13 PM
md5 to sha1 - by El Forum - 10-22-2009, 11:36 AM
md5 to sha1 - by El Forum - 10-22-2009, 04:02 PM



Theme © iAndrew 2016 - Forum software by © MyBB