I want to save profile data encrypted in a database. However, some details must be unique, and since the encryption algorithm randomizes the seed for each encryption, it is exhaustive in order to find out if this value is already stored in the database.
- I could scroll through each row and decrypt the required column, but it will take too long if the number of rows is large.
- I could store the hashes of these (unencrypted) details
, but this would, first of all, destroy the encryption point .
So, how do I compare an encrypted string (with a random seed) with others stored in the database?
Any help is greatly appreciated. Encryption is performed using php ( MCRYPT_RIJNDAEL_256 / NOFB ), the database is MySQL.
Edit / Decide: Keeping data hashing in addition to the encrypted value seems to be the best solution. This makes checking unique columns easy enough for me. Thanks to everyone who left their comments / answers.
source share