简体   繁体   English

如何使用加密字段搜索MySQL数据库

[英]How to search a MySQL database with encrypted fields

I have 4 columns in the table. 我在表中有4列。 I stored in encrypted values to encryptemployeesId . 我将加密值存储到cryptoemployeesId中 Thousands of records is available. 成千上万的记录可用。 I want to display particular record using only employeesId . 我只想使用employeeId显示特定记录。 Kindly help us. 请帮助我们。

  1. id int id int
  2. encryptemployeesId varchar cryptoemployeesId varchar
  3. secret_Key varchar secret_Key varchar
  4. salary varchar 工资 varchar

Note: The encrypteemployeesId is Dynamic . 注意:cryptoeemployeesId为Dynamic

If you have table which stores encrypted ID of the employee then you need the same encrypting algorithm for searching the database. 如果您具有存储员工的加密ID的表,则需要使用相同的加密算法来搜索数据库。 EX:: EX ::

1) Encrypting Algorithm encrypts your employee ID each time new entry is made in database. 1)每次在数据库中创建新条目时,加密算法都会对您的员工ID进行加密。

2) Use the Encrypting algorithm in search_employee_by_id() method as: 2)使用search_employee_by_id()方法中的加密算法为:

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 希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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