My users (researchers) will be storing where their website is on a mysql database on my server.
Ideally I want to hash the locations so that when the researchers' participants submit their data to my server, I can confirm whether the website they came from is registered on my MySQL database. If so, I want to save their data to a specific location that reflects which website they were participating at.
My problem is that when I use Php's password_hash, it returns different values during each hash. Thus, to verify the location I think I would need to loop through my whole mysql database to check if the website the participant is submitting from matches one of the rows of the list of websites.
So am I right in thinking there are 2 options:
- Keep using Php's password_hash, and loop as described above? I haven't found an elegant way to validate the participant's hashed version of the location to the original hash stored in the mysql database.
- Use an alternative Php hashing solution that produces a stable hash each time (is there a recommended way to do this? I've seen warnings about md5 and sha)
The reason I want to do the above is that I would like to reduce the chance that a malicious user could dump the database and then use it to systematically interfere with all the websites listed.