Question

i am writing a login system for one of my android apps. I am working with mysql & php for the login system using a post request from the android app for the login. Please note that the account is also made from the device as well (Registering), now here is the problem.

The crypt function seems to be tacking on alot of extra stuff it contains the correct hashed password but its not the same as in the database, its best if i show you:

A password in my database: $6$WX6WbSQfm5iN$vx/B9TKLkcnVDxIPvKc9TUzpWLjD77mlCk

Using correct password for sure and using this function like such

crypt($userPasswordFromPost, $encryptedPasswordFromDB)

returns a value like this: $6$WX6WbSQfm5iN$vx/B9TKLkcnVDxIPvKc9TUzpWLjD77mlCk kOj43jHRW25ecYfbhgGtm27tVG9oSGHqaKrOugYrBpjwzZ//gel0

please note that i had to place a space to bold the above string, but there is no space that is the full string returned by that function, as you can see the correct hashed password is there just has alot of crap after it.

System info
 running on: Ubuntu Linux 12.10 (64 bit)
 php version: PHP 5.4.6-1ubuntu1.1 (cli)

more info is available upon request. Any help is greatly accepted!

Was it helpful?

Solution

Ok I feel pretty dumb at this point in time. My mysql database password field was limited to varchar(50), So it was cutting off the password and there was no way they could ever be equal. I increased the database field to 200 a bit over the top but i rather not take anymore chances with this. Thank you all for your time and thank you Charles for discovering the problem

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top