Hi,
I would like to add username and password from my user interface to my database table.
There was already a old password in the data table.
Here is the encrypted password: FC64474D0994379EA2FC8E8E320770EA58C3554B
I would like to save my new password in the same encryption.
How can i solve this issue?
Thanks,
Darma
Loading
VulpesPosted Nov 7, 2013, 3:11 PM
The output is:
9E8806971A97BDCDF87F5731DA938A9E18A68B54
Ken HPosted Nov 8, 2013, 8:36 PM
VulpesPosted Nov 8, 2013, 9:50 AM
When a user attempts to sign in, you first look for his/her user name in the database.
If it's not there, you inform the user that it's an invalid user name and/or password.
If it is there, you hash the password entered using SHA-1 and compare it with the hashed password in the user's record in the database.
If they're the same, then the user has successfully logged in.
Otherwise, you inform the user that it's an invalid user name and/or password.
Simple but effective :)
darma tejaPosted Nov 8, 2013, 3:19 AM
Wonderful, it works.
Thanks
Darma
Ken HPosted Nov 7, 2013, 8:05 PM
VulpesPosted Nov 7, 2013, 7:36 PM
SHA-1 is basically a hashing algorithm which provides 'one way' encryption. It's therefore often used for passwords - you just compare the hash of the password entered with the one stored in the database - and you never actually know what the password is.
However, nowadays a 20 byte hash isn't considered 100% secure and, if more security is needed, you'd be better using SHA-256 (32 bytes) or stronger.
Ken HPosted Nov 7, 2013, 7:29 PM
How to restore the original look encrypted characters.
for example:9E8806971A97BDCDF87F5731DA938A9E18A68B54 ==>New73Ok18
Thank you.
VulpesPosted Nov 7, 2013, 10:49 AM
If you don't, then my guess is that it was SHA-1 because the encrypted password is 20 bytes long.