Welcome Guest, Not a member yet? Register   Sign In
md5 encryption

hi i have a registration module and i save user password using md5 encryption.
then on login i use md5 to encrypt the password and match it with database.
but it does not match
$this->db->where('password', md5($pw));
echo md5($pw);

against a particular username and password with the echo statement i m getting pw as "7fa8282ad93047a4d6fe6111c93b308a "
while in the db the password is "7fa8282ad930"

the password in the db is just a part of password produced on login so i m unable to login why?

Check your maximal fieldsize for the password column in the database. Then try to register a new account, and check again.

p.s. There are several pre-made codeigniter authentication librarys, check out this article.

An md5 will always be 32 characters long, regardless of the input side


[eluser]Thorpe Obazee[/eluser]
@OP. You shouldn't probably use md5 alone since there's a growing number of md5 hashes nowadays. You should probably work on 'salting' passwords.

md5 rainbow tables are abundant. Use either sha1, a salt, or both for better security. Also use prepared statements. There are a number of articles floating around on this forum about proper authentication conventions, maybe they're some use to you.

Good luck.

I personally would use SHA1. MD5 hashing doesn't seem to be as secure.

Theme © iAndrew 2016 - Forum software by © MyBB