I have a new user stored in my DB
Email (username) is encrypted using openssl_encrypt()
Password is hashed using password_hash()
The problem I have that I cannot easily look the user up since the email is encrypted using random IV and password hashed using a random salt.
The only option I see here is to add a new column "email_hashed"
Now I have to: fetch through all DB records :-(. When I find a match between email_hashed and hashed user email input using password_verify() I can check the password again with password_verify()
I understand the situation is simple when the "username" is stored as plain text but it is not my case. I want my customers data to be encrypted including the e-mail address
Is there a more efficient way than going through all DB records to authenticate the user when email is used as a login-name?
Hope the question is not too dumb :-)