Welcome Guest, Not a member yet? Register   Sign In
Encryption Class - How do I?
#1

[eluser]01010011[/eluser]
Hi,

I have created a registration page using CI that works fine. However, I encoded the password using sha1 (see code snippet below), and now that I plan to create a login page, I need to check whether the password the user enters in the login page is the same as that password encoded using sha1 stored in the database. However, I just realized that sha1 is non-decodable.

So how do I use the encryption class to both encrypt and then decrypt this password? Any assistance will be appreciated. Thanks in advance.
Code:
function register_user($username, $password, $name, $email, $activation_code)
{
  $sha1_password = sha1($password);
  $query_str = "INSERT INTO table_name (username, password, name, email, activation_code) VALUES (?,?,?,?,?)";

  $this->db-query($query_str, array($username, $sha1_password, $name, $email, $activation_code));
}


Messages In This Thread
Encryption Class - How do I? - by El Forum - 04-19-2010, 01:11 PM
Encryption Class - How do I? - by El Forum - 04-19-2010, 02:00 PM
Encryption Class - How do I? - by El Forum - 04-19-2010, 02:18 PM



Theme © iAndrew 2016 - Forum software by © MyBB