java - Different hashCode for the same string? -
i have made log-in screen , want check password client enters passwords in server's database. if hashcodes match, password accepted. however, hashcode when write password on client screen different hashcode of received string (password) on server side.
does know why? in advance insight.
you've misunderstood.
- you should using secure hash, not the
hashcode()
method. - you must not store plaintext password in database. must store hash.
you should getting database hashing , comparison:
select count(*) users username = ? , password = md5(?)
if query returns 1, user , password exist. if returns zero, don't. note don't want distinguish between wrong username , wrong password, information leak attacker. test them both above.
Comments
Post a Comment