CN-122027242-A - Data encryption method, device, equipment and computer readable storage medium
Abstract
The application discloses a data encryption method, a device, equipment and a computer readable storage medium, and belongs to the technical field of data processing. The method comprises the steps of obtaining first data to be encrypted, wherein the first data comprises a plurality of first fields and original values corresponding to the first fields, determining a plurality of second fields to be encrypted in the first fields, determining encryption algorithms corresponding to the second fields, wherein the encryption algorithms corresponding to the second fields are not completely identical, encrypting the original values corresponding to the second fields according to the encryption algorithms corresponding to the second fields to obtain encrypted values of the second fields, and obtaining second data according to the encrypted values of the second fields, wherein the second data is the data obtained after the first data is encrypted. The method has the advantages that the data encryption effect is better, and the data transmission safety is higher.
Inventors
- WU HEHE
Assignees
- 安徽开阳科技有限公司
- 奇瑞汽车股份有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260122
Claims (14)
- 1. A method of encrypting data, the method comprising: acquiring first data to be encrypted, wherein the first data comprises a plurality of first fields and original values corresponding to the first fields; determining a plurality of second fields to be encrypted from the plurality of first fields; determining encryption algorithms corresponding to the second fields, wherein the encryption algorithms corresponding to the second fields are not completely identical; encrypting the original value corresponding to each second field according to the encryption algorithm corresponding to each second field to obtain the encrypted value of each second field; And acquiring second data according to the encryption values of the second fields, wherein the second data is the data obtained by encrypting the first data.
- 2. The method of claim 1, wherein the determining a plurality of second fields to be encrypted from among the plurality of first fields comprises: For any one of the plurality of first fields, determining that any one of the plurality of first fields is the second field if the any one of the plurality of first fields exists in the plurality of reference fields; Determining the similarity of any first field and each reference field, and determining any first field as the second field when a reference field with the similarity larger than a similarity threshold exists in the plurality of reference fields; The plurality of reference fields are fields to be encrypted.
- 3. The method of claim 2, wherein determining the similarity of the arbitrary first field and each reference field comprises: For any one of the respective reference fields, determining a first feature vector for characterizing the any one of the reference fields; Determining a second feature vector for characterizing the any one of the first fields; and determining the similarity of any one of the first fields and any one of the reference fields according to the first feature vector and the second feature vector.
- 4. The method of claim 1, wherein the encryption algorithm corresponding to any one of the second fields is matched with a key; The encrypting the original value corresponding to each second field according to the encrypting algorithm corresponding to each second field to obtain the encrypted value of each second field, including: and encrypting the original value corresponding to any second field according to the encryption algorithm corresponding to any second field and the key matched with the encryption algorithm corresponding to any second field to obtain the encryption value of any second field.
- 5. The method according to claim 4, wherein encrypting the original value corresponding to the arbitrary second field according to the encryption algorithm corresponding to the arbitrary second field and the key matched with the encryption algorithm corresponding to the arbitrary second field to obtain the encrypted value of the arbitrary second field includes: Splicing a reference salt value at a reference position of an original value corresponding to any second field to obtain a first value; And encrypting the first numerical value according to the encryption algorithm corresponding to any second field and the key matched with the encryption algorithm corresponding to any second field to obtain the encryption value of any second field.
- 6. The method of claim 5, wherein after the splicing the reference salt values at the reference positions of the original values corresponding to the arbitrary second fields to obtain the first values, the method further comprises: Encoding the first numerical value according to a reference encoding format to obtain a second numerical value; the encrypting the first value according to the encryption algorithm corresponding to any second field and the key matched with the encryption algorithm corresponding to any second field to obtain the encryption value of any second field comprises the following steps: And encrypting the second numerical value according to the encryption algorithm corresponding to any second field and the key matched with the encryption algorithm corresponding to any second field to obtain the encryption value of any second field.
- 7. The method according to any one of claims 1 to 6, wherein said obtaining second data based on the encrypted values of the respective second fields comprises: and replacing the original values corresponding to the second fields in the first data with the encrypted values of the second fields to obtain the second data.
- 8. The method according to any one of claims 1 to 6, further comprising: The encryption log of each second field is obtained, and the encryption log of any second field comprises at least one of a data identifier of the first data, an identifier of any second field, an encryption algorithm corresponding to any second field, an original value corresponding to any second field, an encryption value of any second field, encryption time of any second field, encryption state of any second field or identifier of a task machine executing encryption operation on any second field, wherein the encryption state of any second field is used for indicating whether encryption of any second field is successful.
- 9. The method of claim 8, wherein the method further comprises: and sending the encrypted logs of the second fields to the first device, and storing the encrypted logs of the second fields by the first device.
- 10. The method according to any one of claims 1 to 6, wherein after obtaining the second data from the encrypted values of the respective second fields, the method further comprises: and sending the second data to a second device, wherein the second device is the device for acquiring the second data, decrypting the second data by the second device to obtain the first data, and processing the first data.
- 11. A data encryption device, the device comprising: The system comprises an acquisition module, a storage module and a storage module, wherein the acquisition module is used for acquiring first data to be encrypted, and the first data comprises a plurality of first fields and original values corresponding to the first fields; a determining module, configured to determine a plurality of second fields to be encrypted from the plurality of first fields; The determining module is further configured to determine an encryption algorithm corresponding to each second field, where the encryption algorithms corresponding to each second field are not completely the same; the encryption module is used for encrypting the original values corresponding to the second fields according to the encryption algorithm corresponding to the second fields to obtain the encrypted values of the second fields; The acquisition module is further configured to acquire second data according to the encrypted values of the second fields, where the second data is data obtained by encrypting the first data.
- 12. An electronic device comprising a processor and a memory, wherein the memory has stored therein at least one program code that is loaded and executed by the processor to cause the electronic device to implement the data encryption method of any one of claims 1 to 10.
- 13. A computer readable storage medium having stored therein at least one program code, the at least one program code being loaded and executed by a processor to cause an electronic device to implement the data encryption method of any one of claims 1 to 10.
- 14. A computer program product, characterized in that it has stored therein at least one computer instruction that is loaded and executed by a processor to cause an electronic device to implement the data encryption method according to any one of claims 1 to 10.
Description
Data encryption method, device, equipment and computer readable storage medium Technical Field The embodiment of the application relates to the technical field of data processing, in particular to a data encryption method, a device, equipment and a computer readable storage medium. Background With the rapid development of big data and real-time computing technology, the processing demands of enterprises on data streams are increasing, especially in industries such as finance, telecom, medical treatment, vehicles and the like, and a large amount of data is transmitted in real time through message middleware. In order to ensure the security of data in the transmission process, encryption processing is generally required to be performed on the data. In the related art, after acquiring data to be transmitted, a data acquisition end encrypts the data to be transmitted based on a preset encryption algorithm to obtain encrypted data, and then transmits the encrypted data. However, the above data encryption method encrypts the whole data to be transmitted through an encryption algorithm, so that the effect of data encryption is poor, and further the security of data transmission is poor. Disclosure of Invention The embodiment of the application provides a data encryption method, a device, equipment and a computer readable storage medium, which can be used for solving the problem that the security of data transmission is poor due to the fact that the effect of data confidentiality in the related technology is poor. The technical scheme is as follows: in one aspect, an embodiment of the present application provides a data encryption method, where the method includes: acquiring first data to be encrypted, wherein the first data comprises a plurality of first fields and original values corresponding to the first fields; determining a plurality of second fields to be encrypted from the plurality of first fields; determining encryption algorithms corresponding to the second fields, wherein the encryption algorithms corresponding to the second fields are not completely identical; encrypting the original value corresponding to each second field according to the encryption algorithm corresponding to each second field to obtain the encrypted value of each second field; And acquiring second data according to the encryption values of the second fields, wherein the second data is the data obtained by encrypting the first data. In one possible implementation manner, the determining, among the plurality of first fields, a plurality of second fields to be encrypted includes: For any one of the plurality of first fields, determining that any one of the plurality of first fields is the second field if the any one of the plurality of first fields exists in the plurality of reference fields; Determining the similarity of any first field and each reference field, and determining any first field as the second field when a reference field with the similarity larger than a similarity threshold exists in the plurality of reference fields; The plurality of reference fields are fields to be encrypted. In one possible implementation manner, the determining the similarity between the arbitrary first field and each reference field includes: For any one of the respective reference fields, determining a first feature vector for characterizing the any one of the reference fields; Determining a second feature vector for characterizing the any one of the first fields; and determining the similarity of any one of the first fields and any one of the reference fields according to the first feature vector and the second feature vector. In one possible implementation manner, the encryption algorithm corresponding to any second field is matched with a secret key; The encrypting the original value corresponding to each second field according to the encrypting algorithm corresponding to each second field to obtain the encrypted value of each second field, including: and encrypting the original value corresponding to any second field according to the encryption algorithm corresponding to any second field and the key matched with the encryption algorithm corresponding to any second field to obtain the encryption value of any second field. In one possible implementation manner, the encrypting the original value corresponding to the any second field according to the encryption algorithm corresponding to the any second field and the key matched with the encryption algorithm corresponding to the any second field to obtain the encrypted value of the any second field includes: Splicing a reference salt value at a reference position of an original value corresponding to any second field to obtain a first value; And encrypting the first numerical value according to the encryption algorithm corresponding to any second field and the key matched with the encryption algorithm corresponding to any second field to obtain the encryption value of any second field. In one pos