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

[eluser]junaids[/eluser]
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
Code:
$this->db->from('user');
$this->db->where('username',$u);
$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?
#2

[eluser]Slowcheetah[/eluser]
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.
#3

[eluser]Dam1an[/eluser]
An md5 will always be 32 characters long, regardless of the input side
#4

[eluser]junaids[/eluser]
thanks
#5

[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.
#6

[eluser]n0xie[/eluser]
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.
#7

[eluser]the_namdeeW[/eluser]
I personally would use SHA1. MD5 hashing doesn't seem to be as secure.




Theme © iAndrew 2016 - Forum software by © MyBB