how to encrypt emails in mysql database but still be able to query them?

后端 未结 3 1061
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-04 16:37

I want to store the email addresses of users in a MySQL database using encryption to ensure that they won\'t be made public if the database gets compromised. I believe if I encr

3条回答
  •  醉酒成梦
    2021-02-04 17:23

    If you hash the addresses with SHA-256 or something similar, you can still index your tables, you can still do fast address lookups (when a user searches for example@example.com, you'll just hash the input and select matching hashes in the tables).

    ssh uses a very similar hashing trick. (Look for the -H option in that manpage for details.)

提交回复
热议问题