david
answered Aug 19 '21 00:00
md5() is a function that can be used to hash the string, it can be used to store some sensitive information like password
md5() function is one-way encryption because it can't be recovered from hash to original text
for example :
select md5('123456')
it will output :
e10adc3949ba59abbe56e057f20f883e which is md5 hash of "123456" so now there is no function that can convert md5 hash to original text means we cant e10adc3949ba59abbe56e057f20f883e convert into 123456
so suppose you are using md5() for hashing password, then how to check the password in future
1. store the hash to the database at registration time
2. now at login time, convert the given password to hash to check with the stored hash
select * from user where md5(123456)=user.password
if given password is correct than it return user