MySQL SHA1 and PHP don't give same result

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sharmilah
    New Member
    • Jun 2007
    • 20

    MySQL SHA1 and PHP don't give same result

    Hi all

    I am using the sha1() function to encrypt my password in mysql database. Also when entering the password in my php login script I am using the same function to verify the password against my database. But the two passwords are not matching. In fact the user password in the database is '8ed3a6b96bec29 00' but the password obtained after applying the sha1 function to the same password string is returning '8ed3a6b96bec29 0020f1eb145f51a 41d4a2e008e' . Could you please suggest what can be the problem and what can be done.

    Thanks
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Changed thread title to better describe the problem (did you know that using the word 'problem' in your thread title actually results in FEWER responses?).

    Check the length of your password field in the database. My guess is it's not long enough to hold 40 characters.

    Comment

    Working...