1
I am creating a program in which the user will put the login and password before entering the system,and after he put his input,the passwords will be saved in the database,and then I will check if the encrypted passwords match the user inputs.
Example :
The user has typed :
username : 123456
password : 123456
And after this, :
username : E10ADC3949BA59ABBE56E057F20F883E
password : E10ADC3949BA59ABBE56E057F20F883E
After this will be saved in the database,but there I want to check when the user re-enter the same password,check if it is equal and matches the generated hash.
I am making this program that generates the hash in Java and will be used in html,.
How can I do this ?
But this input you compare you do manually or do by database ?
– Falion
In the system I made, who generates the hash and my application, then I Gero to record and Gero to compare with what is recorded, Voce is generating this hash by BD ?
– Jeterson Miranda Gomes
To populate the database, you can create a login validation function that receives the input that the user has already typed with the hash applied and compare with what is saved
– Jeterson Miranda Gomes
So I’m using Java to generate the hash and then I’m recording the hash in the BD,now I’m wondering how to do the check,I’ll try to do it here the way you said it. But as soon as the user type the input is already generated the hash, so there is no way I can compare.
– Falion
If you don’t succeed I’ll try to set an example here to see if it gives you an idea
– Jeterson Miranda Gomes
I tried this, since the user input was already being generated right after he put the information,I created two variables that would take user input before being hashed and saved them in the database as well and then compared the password without being hashed with the generated password with the hash. Does this way work ?
– Falion
more if you compare the password without hash with the password with the hash will always turn out false. I’ll make an example here you see if and what you want...
– Jeterson Miranda Gomes
Okay, I thank you in advance for your help.
– Falion
Hello friend, thanks for trying to help,but I’m doing even in Mysql and this code I thought will not help much.
– Falion
ok, but try to see if logic helps you... and apply in the bank you are using.
– Jeterson Miranda Gomes
Do you compare the password saved in the database already hashed with the user input ? Because I did something similar but I don’t know if it will work.
– Falion
Yes, in this example there is exactly this.
– Jeterson Miranda Gomes
I created a trial and posted, ?
– Falion
Apparently yes, but I think there has to be a
count
in your select– Jeterson Miranda Gomes
Okay, I’ve changed the code.
– Falion
I have no Mysql base here to test your code, I made some corrections there and posted, run and check if it will work...
– Jeterson Miranda Gomes
Hello friend, I will test here this modified trial that you showed,but it seems to work,so I already gave +1 and also as a response that helped me.
– Falion