eurushibata
eurushibata

Reputation: 11

is there a way to search encrypted data using LIKE?

In a fulltextsearch where the field is encrypted, is there a way to search for its content?

E.g.: value on the database is name = "John Stewart" (encrypted) I want to search for either records that contains "John" or "Stewart".

Upvotes: 0

Views: 280

Answers (1)

user764357
user764357

Reputation:

If encrypted properly this would be nearly impossible. I'm not aware of any options in MySQL that you could use to encrypt a column like you are suggesting. So you'd need to get all results, decrypt in your application, and check against the decrypted value.

If the value has instead been hashed it would be literally impossible, as the shorter string and the longer string would have completely independent hashes, and you wouldn't be able to turn the hash of the longer string back into the string itself to check.

Upvotes: 1

Related Questions