简体   繁体   中英

How to search a MySQL database with encrypted fields

I have 4 columns in the table. I stored in encrypted values to encryptemployeesId . Thousands of records is available. I want to display particular record using only employeesId . Kindly help us.

  1. id int
  2. encryptemployeesId varchar
  3. secret_Key varchar
  4. salary varchar

Note: The encrypteemployeesId is Dynamic .

If you have table which stores encrypted ID of the employee then you need the same encrypting algorithm for searching the database. EX::

1) Encrypting Algorithm encrypts your employee ID each time new entry is made in database.

2) Use the Encrypting algorithm in search_employee_by_id() method as:

function search_employee_by_id(int id) {
response = encrypt_algorithm(id); //encrypts emplyoeeid you want to search say 5
query.execute("SELECT * FROM EMPLOYEE where encrypted_id =:encryptemployeesId"); //employee id 5(encrypted) matches any employee with id 5.
    }

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM