CN114553552A - Data encryption method and device, data decryption method and device and storage medium - Google Patents

Data encryption method and device, data decryption method and device and storage medium Download PDF

Info

Publication number
CN114553552A
CN114553552A CN202210173187.XA CN202210173187A CN114553552A CN 114553552 A CN114553552 A CN 114553552A CN 202210173187 A CN202210173187 A CN 202210173187A CN 114553552 A CN114553552 A CN 114553552A
Authority
CN
China
Prior art keywords
data
encrypted
encryption
target
factor
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210173187.XA
Other languages
Chinese (zh)
Inventor
黄助良
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Xiaomi Mobile Software Co Ltd
Beijing Xiaomi Pinecone Electronic Co Ltd
Original Assignee
Beijing Xiaomi Mobile Software Co Ltd
Beijing Xiaomi Pinecone Electronic Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Xiaomi Mobile Software Co Ltd, Beijing Xiaomi Pinecone Electronic Co Ltd filed Critical Beijing Xiaomi Mobile Software Co Ltd
Priority to CN202210173187.XA priority Critical patent/CN114553552A/en
Publication of CN114553552A publication Critical patent/CN114553552A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload

Abstract

The present disclosure relates to a data encryption method and apparatus, a data decryption method and apparatus, and a storage medium. The data encryption method comprises the following steps: responding to a data encryption request, and acquiring data to be encrypted, wherein the data to be encrypted comprises a plurality of data factors; selecting a data factor from the data to be encrypted as an encryption factor according to a preset first encryption rule; the first encryption rule is used for representing the target arrangement position of the encryption factor in the data to be encrypted; encrypting each data factor in the data to be encrypted according to a preset second encryption rule and the encryption factor to obtain target encrypted data; wherein the second encryption rule is used for representing a first variation of each data factor. So, treat that to encrypt the data and carry out the dual encryption, improve the degree of difficulty of carrying out the deciphering through seeking the rule to the data, and then promoted data transmission's security.

Description

Data encryption method and device, data decryption method and device and storage medium
Technical Field
The present disclosure relates to the field of data processing technologies, and in particular, to a data encryption method and apparatus, a data decryption method and apparatus, and a storage medium.
Background
With the continuous development of network technology, data privacy protection has become a security function of major concern for network operators and internet companies. In the data transmission process, a data sending end needs to perform data encryption processing so as to protect data from being stolen and read by an illegal person. When the data receiving end needs to present the data, the data receiving end can decrypt the data.
In the related art, there are many algorithms for encrypting data, and most algorithms are specific according to different requirements. For example: the hashing algorithm, MD5\ SHA-1\ SHA-2\ SHA-3, etc., is not applicable in many scenarios because the hashing algorithm is not reversible (i.e. cannot be decrypted). The symmetric encryption algorithm is used for negotiating and fixing a set of secret keys during sending and receiving, encrypting data according to the secret keys during sending, and decrypting the data according to the secret keys after a receiving end receives the data, so that data recovery is guaranteed.
Disclosure of Invention
To overcome the problems in the related art, the present disclosure provides a data encryption method and apparatus, a data decryption method and apparatus, and a storage medium.
According to a first aspect of embodiments of the present disclosure, there is provided a data encryption method, the method including:
responding to a data encryption request, and acquiring data to be encrypted, wherein the data to be encrypted comprises a plurality of data factors;
selecting a data factor from the data to be encrypted as an encryption factor according to a preset first encryption rule; the first encryption rule is used for representing the target arrangement position of the encryption factor in the data to be encrypted;
encrypting each data factor in the data to be encrypted according to a preset second encryption rule and the encryption factor to obtain target encrypted data; wherein the second encryption rule is used for representing a first variation of each data factor.
Optionally, the other data factors except the encryption factor in the plurality of data factors are common factors; the second encryption rule is used for representing that the first variation of each common factor is not zero and the first variation of the encryption factor is zero.
Optionally, the target arrangement position in the data to be encrypted is a first bit in the data to be encrypted or a last bit of the data to be encrypted.
Optionally, the method is applied to a first electronic device with a communication function, and the data to be encrypted is data sent by the first electronic device to a second electronic device with a communication function.
Optionally, the method further comprises:
and if the target encrypted data has the ending character, sending the length information of the data to be encrypted to the second electronic equipment.
According to a second aspect of embodiments of the present disclosure, there is provided a data decryption method, the method including:
in response to receiving target encrypted data, analyzing an encryption factor from the target encrypted data according to a preset first decryption rule and a preset second decryption rule; the target encrypted data is obtained by encrypting data to be encrypted according to the method of the first aspect of the present disclosure, the first decryption rule is used to represent a target arrangement position of an encryption factor in the target encrypted data, the encryption factor being used to encrypt the data to be encrypted, and the second decryption rule is used to represent a second variation of each data in the target encrypted data;
analyzing data at other sequencing positions except the target arrangement position in the target encrypted data according to the second decryption rule and the encryption factor to obtain data factors at the other sequencing positions;
and generating the data to be encrypted according to the encryption factors at the target arrangement positions and the data factors at the other arrangement positions.
Optionally, the parsing, in response to receiving target encrypted data, an encryption factor from the target encrypted data according to a preset first decryption rule and a preset second decryption rule includes:
in response to receiving target encrypted data, determining a target arrangement position of the encryption factor in the target encrypted data according to the first decryption rule;
and decrypting the data at the target arrangement position in the target encrypted data according to a second variable quantity of the data at the target arrangement position represented in the second decryption rule to obtain an encryption factor.
According to a third aspect of the embodiments of the present disclosure, there is provided a data encryption apparatus, the apparatus including:
the data encryption device comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is configured to respond to a received data encryption request and acquire data to be encrypted, and the data to be encrypted comprises a plurality of data factors;
the determining module is configured to select a data factor from the data to be encrypted as an encryption factor according to a preset first encryption rule; the first encryption rule is used for representing the target arrangement position of the encryption factor in the data to be encrypted;
the encryption module is configured to encrypt a plurality of data factors in the data to be encrypted according to a preset second encryption rule and the encryption factors to obtain target encrypted data; wherein the second encryption rule is used for representing a first variation of each data factor.
Optionally, the other data factors except the encryption factor in the plurality of data factors are common factors; the second encryption rule is used for representing that the first variation of each common factor is not zero and the first variation of the encryption factor is zero.
Optionally, the target arrangement position in the data to be encrypted is a first bit in the data to be encrypted or a last bit of the data to be encrypted.
Optionally, the method is applied to a first electronic device with a communication function, and the data to be encrypted is data sent by the first electronic device to a second electronic device with a communication function.
Optionally, the apparatus further comprises:
the sending module is configured to send the length information of the data to be encrypted to the second electronic device if the target encrypted data has the end character.
According to a fourth aspect of the embodiments of the present disclosure, there is provided a data decryption apparatus, the apparatus including:
the first analysis module is configured to respond to the received target encrypted data, and analyze an encryption factor from the target encrypted data according to a preset first decryption rule and a preset second decryption rule; the target encrypted data is obtained by encrypting data to be encrypted according to the method of the first aspect of the present disclosure, the first decryption rule is used to represent a target arrangement position of an encryption factor in the target encrypted data, the encryption factor being used to encrypt the data to be encrypted, and the second decryption rule is used to represent a second variation of each data in the target encrypted data;
the second analysis module is configured to analyze data at other sorting positions except the target arrangement position in the target encrypted data according to the second decryption rule and the encryption factor to obtain data factors at the other arrangement positions;
and the generating module is configured to generate the data to be encrypted according to the encryption factors at the target arrangement position and the data factors at the other arrangement positions.
Optionally, the first parsing module includes:
a determination submodule configured to determine, in response to receiving target encrypted data, a target arrangement position of the encryption factor in the target encrypted data according to the first decryption rule;
and the analysis submodule is configured to decrypt the data at the target arrangement position in the target encrypted data according to a second variable quantity of the data at the target arrangement position, which is characterized in the second decryption rule, so as to obtain an encryption factor.
According to a fifth aspect of the embodiments of the present disclosure, there is provided a data encryption apparatus including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
responding to a data encryption request, and acquiring data to be encrypted, wherein the data to be encrypted comprises a plurality of data factors;
selecting a data factor from the data to be encrypted as an encryption factor according to a preset first encryption rule; the first encryption rule is used for representing the target arrangement position of the encryption factor in the data to be encrypted;
encrypting a plurality of data factors in the data to be encrypted according to a preset second encryption rule and the encryption factors to obtain target encrypted data; wherein the second encryption rule is used for representing the variation of each data factor.
According to a sixth aspect of the embodiments of the present disclosure, there is provided a data encryption apparatus comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
in response to receiving target encrypted data, analyzing an encryption factor from the target encrypted data according to a preset first decryption rule and a preset second decryption rule; the target encrypted data is obtained by encrypting data to be encrypted according to the method of the first aspect of the present disclosure, the first decryption rule is used to represent a target arrangement position of an encryption factor in the target encrypted data, the encryption factor is used to represent a variation of each data in the target encrypted data;
analyzing data at other sequencing positions except the target arrangement position in the target encrypted data according to the second decryption rule and the encryption factor to obtain data factors at the other sequencing positions;
and generating the data to be encrypted according to the encryption factors at the target arrangement positions and the data factors at the other arrangement positions.
According to a seventh aspect of embodiments of the present disclosure, there is provided a computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement the steps of the data encryption method provided by the first aspect of the present disclosure or the steps of the data decryption method provided by the second aspect of the present disclosure.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects:
by adopting the technical scheme, when a data encryption request is received, the encryption factor of the data to be encrypted is determined according to the first encryption rule, and then the data to be encrypted is encrypted according to the second encryption rule and the encryption factor. So, treat that to encrypt the data and carry out the dual encryption, improve the degree of difficulty of carrying out the deciphering through seeking the rule to the data, and then promoted data transmission's security.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
FIG. 1 is a flow chart illustrating a method of data encryption according to an example embodiment.
Fig. 2 is a flow chart illustrating a method of data decryption in accordance with an exemplary embodiment.
Fig. 3 is a block diagram illustrating a data encryption apparatus according to an example embodiment.
Fig. 4 is a block diagram illustrating a data decryption apparatus according to an example embodiment.
Fig. 5 is a block diagram illustrating a data encryption apparatus according to an example embodiment.
Fig. 6 is a block diagram illustrating a data decryption apparatus according to an example embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
As mentioned in the background art, the encryption algorithm is either complex (the workload of CPU is large in the low-end embedded upper CPU), or the length of the encrypted data is increased by multiple times, which increases the data transmission pressure, and even some encrypted data cannot be decrypted.
In view of this, the present disclosure provides a data encryption method and apparatus, a data decryption method and apparatus, and a readable storage medium, in the data encryption method, data to be encrypted is doubly encrypted, so that the difficulty of decrypting the data by using a search rule is increased, and the security of data transmission is further improved.
FIG. 1 is a flow chart illustrating a method of data encryption in accordance with an exemplary embodiment. As shown in fig. 1, the data encryption method may include the following steps.
In step S11, in response to receiving the data encryption request, data to be encrypted is acquired. Wherein the data to be encrypted comprises a plurality of data factors.
In the present disclosure, the data to be encrypted is a data set, each byte included in the data set is a data factor, and the size of each data factor is 8 bits. The bytes included in the data to be encrypted may be numbers or characters. Illustratively, the data to be encrypted may be [1, 2, 3, 4, 5, 6, 7, 8, 9], where the numbers 1, 2, 3, 4, 5, 6, 7, 8, 9 are data factors. Also illustratively, the data to be encrypted may also be [ 'a', 'b', 'c','d' ], wherein the characters 'a', 'b', 'c','d' are data factors.
It is noted that, in one possible implementation scenario, the data encryption method is applied to a first electronic device with a communication function, and when the first electronic device communicates with a second electronic device with the communication function, the first electronic device encrypts data corresponding to a signal or instruction to be transmitted to the second electronic device. For example, the first electronic device sends a wake-up instruction to the second electronic device, and the data to be encrypted is data corresponding to the wake-up instruction to be sent to the second electronic device by the first electronic device.
In another possible implementation scenario, the main body executing the data encryption method is other devices besides the electronic devices communicating with each other. For example, an encryption server is used to encrypt data corresponding to signals or instructions transmitted during communication between two electronic devices.
In step S12, a data factor is selected as an encryption factor from the data to be encrypted according to a preset first encryption rule.
In the present disclosure, the first encryption rule is used to represent a target arrangement position of an encryption factor in the data to be encrypted.
In the field of data transmission, the last bit in a group of data to be transmitted is the end character '\0', in the present disclosure, the end character in the transmitted data is not encrypted, that is, the data to be encrypted in step S11 refers to valid data in the transmitted data, and therefore, the preset encryption factor may be the last valid data in the data to be encrypted, that is, the target arrangement position may be the first bit in the data to be encrypted, or the last bit in the data to be encrypted.
In addition, the target arrangement position may also be any sequencing position in the data to be encrypted according to actual requirements, and the disclosure is not particularly limited thereto.
In step S13, each data factor in the data to be encrypted is encrypted according to a preset second encryption rule and the encryption factor, so as to obtain target encrypted data.
Wherein the second encryption rule is used for representing the first variation of each data factor. The first variation may be an increasing value or a decreasing value, which is not specifically limited in the present disclosure.
It is noted that, in the present disclosure, the first encryption rule and the second encryption rule are both encryption rules agreed in advance by the first electronic device and the second electronic device. That is to say, the first electronic device encrypts the data to be encrypted based on the first encryption rule and the second encryption rule, and after the second electronic device receives the encrypted data, the data to be encrypted is analyzed based on the first encryption rule and the second encryption rule.
By adopting the technical scheme, when a data encryption request is received, the encryption factor of the data to be encrypted is determined according to the first encryption rule, and then the data to be encrypted is encrypted according to the second encryption rule and the encryption factor. So, treat that to encrypt the data and carry out the dual encryption, improve the degree of difficulty of carrying out the deciphering through seeking the rule to the data, and then promoted data transmission's security.
In order to facilitate a better understanding of the data encryption method provided by the present disclosure for those skilled in the art, the method is described in detail below in a complete embodiment.
A specific implementation of encrypting each data factor in the data to be encrypted according to the second encryption rule and the encryption factor is described below by taking the second encryption rule as an example of an increment value for representing each data factor.
In a first embodiment, it is assumed that the increment value of each data factor characterized by the second encryption rule is different. For example, the increment value of the data factor at the first sorting position in the data to be encrypted is 1, the increment value of the data factor at the second sorting position in the data to be encrypted is 2, … …, and the increment value of the data factor at the nth sorting position in the data to be encrypted is n, where n is the number of data factors included in the data to be encrypted.
For example, suppose that the data to be encrypted is [1, 2, 3, 4, 5, 6, 7, 8, 9], and if the encryption factor determined according to the first encryption rule is 9, the target encrypted data obtained by encrypting each data factor in the data to be encrypted according to the second encryption rule and the encryption factor is [11, 13, 15, 17, 19, 21, 23, 25, 27 ].
Further, for example, assume that the data to be encrypted is [ 'a', 'b', 'c','d', ] where each character in the data to be encrypted corresponds to one ASSII Code (American Standard Code for Information exchange Standard Code), for example, the ASSII Code corresponding to the character 'a' is 97, the ASSII Code corresponding to the character 'b' is 98, the ASSII Code corresponding to the character 'c' is 99, and the ASSII Code corresponding to the character'd' is 100. Assuming that the encryption factor is 100, the ASSII code array corresponding to the encrypted target encrypted data is [ '198', '200', '202', '204', ], and then the ASSII code array is replaced with the corresponding characters to obtain the target encrypted data.
In consideration of the fact that in the decryption process, if an error occurs in the process of obtaining the encryption factor through decryption, accurate decryption cannot be performed, and normal communication between the electronic devices cannot be performed, in the second embodiment, the encryption factor in the data to be encrypted is not changed in the encryption process. Optionally, the other data factors except the encryption factor in the plurality of data factors included in the data to be encrypted are common factors, and accordingly, the second encryption rule is used to characterize that the variation of each common factor is not zero and the variation of the encryption factor is zero. Therefore, when each data factor in the data to be encrypted is encrypted according to the preset second encryption rule and the preset encryption factor, the numerical value of the encryption factor at the target sequencing position is not changed.
Following the above example, assume that the second encryption rule is that the increment value of the data factor located at the ith sorting position in the data to be encrypted is i, where the value range of i is 1 to n-1. If the data to be encrypted is [1, 2, 3, 4, 5, 6, 7, 8, 9] and the encryption factor is 9, then according to the second encryption rule and the encryption factor, the target encrypted data obtained by encrypting each data factor in the data to be encrypted is [11, 13, 15, 17, 19, 21, 23, 25, 9 ].
Optionally, if an end character exists in the target encrypted data, sending length information of the data to be encrypted to the second electronic device.
In the field of communications, an end character is used to indicate that a group of data has been transmitted, and therefore, in order to facilitate a receiving end (e.g., a second electronic device) to know whether a group of data has been transmitted, an end character is usually added at the end of each group of data. If the end character exists in the target encrypted data, the second electronic equipment considers that the group of data is completely received when receiving the end character generated by encryption, and executes corresponding action according to the received data. However, since the end character may be the first sorting position, the third sorting position, the middle sorting position, and the like in the target encrypted data, the second electronic device may not receive complete data, and further, the action performed by the second electronic device may not be consistent with the action indicated by the first electronic device, which may affect normal communication between the first electronic device and the second electronic device.
Therefore, in the present disclosure, after each data factor in the data to be encrypted is encrypted according to the preset second encryption rule and encryption factor according to any of the above manners, if the obtained target encrypted data has an end character, the length information of the data to be encrypted is sent to the second electronic device, so that the second electronic device is combined with a complete set of data, and normal communication between the electronic devices is ensured.
In the above description, the encryption factor is taken as one of the data factors in the data to be encrypted as an example, and in practical application, the data at the target arrangement position in the data to be encrypted may also be encrypted to obtain the encryption factor, where the manner of encrypting the data at the target arrangement position is not limited in the present disclosure.
The present disclosure also provides a data decryption method. Fig. 2 is a flow chart illustrating a method of data decryption in accordance with an exemplary embodiment. As shown in fig. 2, the data decryption method may include the following steps.
In step S21, in response to receiving the target encrypted data, an encryption factor is parsed from the target encrypted data according to a preset first decryption rule and a preset second decryption rule.
The target encrypted data is obtained by encrypting data to be encrypted according to the data encryption method shown in fig. 1. The first decryption rule corresponds to the first encryption rule in fig. 1. Illustratively, the first decryption rule is used for characterizing a target arrangement position of an encryption factor for encrypting data to be encrypted in target encrypted data.
The values are described in the specification, in the process of encrypting data, only the values of the data factors included in the data to be encrypted are adjusted, and the arrangement positions of the data are not adjusted. Therefore, the target arrangement position of the encryption factor represented by the first decryption rule in the target encrypted data is the same as the target arrangement position of the encryption factor represented by the first encryption rule in the data to be encrypted. For example, if the encryption factor characterized by the first encryption rule is located at the last bit in the data to be encrypted, the encryption factor characterized by the first decryption rule is also located at the last bit in the target encrypted data.
Similarly, the second decryption rule corresponds to the second encryption rule in fig. 1, and exemplarily, the second decryption rule characterizes a second variation of each data in the target encrypted data. The second variation in the second decryption rule is the same as the first variation in the second encryption rule in value, and the adjustment direction is opposite. For example, if the first variation in the second encryption rule is the increase value of the data factor located at the ith sorting position in the data to be encrypted is i, the second variation in the second decryption rule is the decrease value of the data located at the ith sorting position in the target encrypted data is i.
Optionally, the specific implementation manner of step S21 may be: and in response to receiving the target encrypted data, determining a target arrangement position of the encryption factor in the target encrypted data according to the first decryption rule, and then decrypting data located at the target arrangement position in the target encrypted data according to a second variation of the data located at the target arrangement position and represented in the second decryption rule to obtain the encryption factor.
By way of example, assuming that the target encrypted data is [11, 13, 15, 17, 19, 21, 23, 25, 27], the target ordering position in the first decryption rule is the last bit, and the second variation of the data at the last bit (ninth ordering position) characterized in the second decryption rule is a reduction value of 9, so that it can be determined that the target factor is 27-92 ═ 9.
In step S22, according to the second decryption rule and the encryption factor, data at other sorting positions except the target arrangement position in the target encrypted data is analyzed to obtain data factors at other arrangement positions.
In step S23, data to be encrypted is generated based on the encryption factor at the target arrangement position and the data factor at the other arrangement position.
Assuming that the target encrypted data is [11, 13, 15, 17, 19, 21, 23, 25, 27], the second decryption rule is used to characterize that the data at the ith position in the target encrypted data has a reduced value of i, i ranges from 1 to 9, and the data in the target encrypted data except the data at the target arrangement position is parsed to obtain a data factor of 11-9-1 at the first arrangement position, a data factor of 13-9-2, … … at the second arrangement position, a data factor of 25-9-8 at the eighth arrangement position, and a data factor of 9 at the target arrangement position, so that the decrypted data to be encrypted is [1, 2, 3, 4, 5, 6, 7, 8, 9 ].
Based on the same inventive concept, the present disclosure also provides a data encryption device. Fig. 3 is a block diagram illustrating a data encryption apparatus according to an example embodiment. Referring to fig. 3, the data encryption apparatus 300 includes:
an obtaining module 301 configured to obtain data to be encrypted in response to receiving a data encryption request, where the data to be encrypted includes a plurality of data factors;
a determining module 302 configured to select a data factor from the data to be encrypted as an encryption factor according to a preset first encryption rule; the first encryption rule is used for representing the target arrangement position of the encryption factor in the data to be encrypted;
the encryption module 303 is configured to encrypt a plurality of data factors in the data to be encrypted according to a preset second encryption rule and the encryption factor to obtain target encrypted data; wherein the second encryption rule is used for representing a first variation of each data factor.
Optionally, the other data factors except the encryption factor in the plurality of data factors are common factors; the second encryption rule is used for representing that the first variation of each common factor is not zero and the first variation of the encryption factor is zero.
Optionally, the target arrangement position in the data to be encrypted is a first bit in the data to be encrypted or a last bit of the data to be encrypted.
Optionally, the method is applied to a first electronic device with a communication function, and the data to be encrypted is data sent by the first electronic device to a second electronic device with a communication function.
Optionally, the apparatus further comprises:
the sending module is configured to send the length information of the data to be encrypted to the second electronic device if the target encrypted data has the end character.
Fig. 4 is a block diagram illustrating a data decryption apparatus according to an example embodiment. Referring to fig. 4, the data decryption apparatus 400 includes:
a first parsing module 401, configured to, in response to receiving target encrypted data, parse an encryption factor from the target encrypted data according to a preset first decryption rule and a preset second decryption rule; the target encrypted data is obtained by encrypting data to be encrypted according to the method of the first aspect of the present disclosure, the first decryption rule is used to represent a target arrangement position of an encryption factor in the target encrypted data, the encryption factor being used to encrypt the data to be encrypted, and the second decryption rule is used to represent a second variation of each data in the target encrypted data;
a second parsing module 402, configured to parse, according to the second decryption rule and the encryption factor, data at other sorting positions except the target arrangement position in the target encrypted data to obtain data factors at the other arrangement positions;
a generating module 403 configured to generate the data to be encrypted according to the encryption factor at the target arrangement position and the data factor at the other arrangement position.
Optionally, the first parsing module 401 may include:
a determination submodule configured to determine, in response to receiving target encrypted data, a target arrangement position of the encryption factor in the target encrypted data according to the first decryption rule;
and the analysis submodule is configured to decrypt the data at the target arrangement position in the target encrypted data according to a second variable quantity of the data at the target arrangement position, which is characterized in the second decryption rule, so as to obtain an encryption factor.
With regard to the apparatus in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be described in detail here.
The present disclosure also provides a computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement the steps of the data encryption method provided by the present disclosure.
The present disclosure also provides a computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement the steps of the data decryption method provided by the present disclosure.
Fig. 5 is a block diagram illustrating a data encryption apparatus according to an example embodiment. For example, the apparatus 500 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 5, the apparatus 500 may include one or more of the following components: a processing component 502, a memory 504, a power component 506, a multimedia component 508, an audio component 510, an input/output (I/O) interface 512, a sensor component 514, and a communication component 516.
The processing component 502 generally controls overall operation of the device 500, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 502 may include one or more processors 520 to execute instructions to perform all or part of the steps of the data encryption method. Further, the processing component 502 can include one or more modules that facilitate interaction between the processing component 502 and other components. For example, the processing component 502 can include a multimedia module to facilitate interaction between the multimedia component 508 and the processing component 502.
The memory 504 is configured to store various types of data to support operations at the apparatus 500. Examples of such data include instructions for any application or method operating on device 500, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 504 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
Power component 506 provides power to the various components of device 500. The power components 506 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the apparatus 500.
The multimedia component 508 includes a screen that provides an output interface between the device 500 and the user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 508 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 500 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 510 is configured to output and/or input audio signals. For example, audio component 510 includes a Microphone (MIC) configured to receive external audio signals when apparatus 500 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 504 or transmitted via the communication component 516. In some embodiments, audio component 510 further includes a speaker for outputting audio signals.
The I/O interface 512 provides an interface between the processing component 502 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 514 includes one or more sensors for providing various aspects of status assessment for the device 500. For example, the sensor assembly 514 may detect an open/closed state of the apparatus 500, the relative positioning of the components, such as a display and keypad of the apparatus 500, the sensor assembly 514 may also detect a change in the position of the apparatus 500 or a component of the apparatus 500, the presence or absence of user contact with the apparatus 500, orientation or acceleration/deceleration of the apparatus 500, and a change in the temperature of the apparatus 500. The sensor assembly 514 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 514 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 514 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 516 is configured to facilitate communication between the apparatus 500 and other devices in a wired or wireless manner. The apparatus 500 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 516 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 516 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 500 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described data encryption methods.
In an exemplary embodiment, a non-transitory computer readable storage medium comprising instructions, such as the memory 504 comprising instructions, executable by the processor 520 of the apparatus 500 to perform the above-described data encryption method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In another exemplary embodiment, a computer program product is also provided, which comprises a computer program executable by a programmable apparatus, the computer program having code portions for performing the above-mentioned data encryption method when executed by the programmable apparatus.
Fig. 6 is a block diagram illustrating a data decryption apparatus according to an example embodiment. For example, the apparatus 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 6, the apparatus 800 may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814, and a communication component 816.
The processing component 802 generally controls overall operation of the device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to perform all or part of the steps of the data decryption method. Further, the processing component 802 can include one or more modules that facilitate interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operations at the apparatus 800. Examples of such data include instructions for any application or method operating on device 800, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 804 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
Power component 806 provides power to the various components of device 800. The power components 806 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the device 800.
The multimedia component 808 includes a screen that provides an output interface between the device 800 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 800 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the apparatus 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 814 includes one or more sensors for providing various aspects of state assessment for the device 800. For example, the sensor assembly 814 may detect the open/closed status of the device 800, the relative positioning of components, such as a display and keypad of the device 800, the sensor assembly 814 may also detect a change in the position of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration/deceleration of the device 800, and a change in the temperature of the device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate communications between the apparatus 800 and other devices in a wired or wireless manner. The device 800 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described data decryption methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium comprising instructions, such as the memory 804 comprising instructions, executable by the processor 820 of the device 800 to perform the data decryption method described above is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In another exemplary embodiment, a computer program product is also provided, which comprises a computer program executable by a programmable apparatus, the computer program having code portions for performing the above-mentioned data decryption method when executed by the programmable apparatus.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice in the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (12)

1. A method for data encryption, the method comprising:
responding to a data encryption request, and acquiring data to be encrypted, wherein the data to be encrypted comprises a plurality of data factors;
selecting a data factor from the data to be encrypted as an encryption factor according to a preset first encryption rule; the first encryption rule is used for representing the target arrangement position of the encryption factor in the data to be encrypted;
encrypting each data factor in the data to be encrypted according to a preset second encryption rule and the encryption factor to obtain target encrypted data; wherein the second encryption rule is used for representing a first variation of each data factor.
2. The method of claim 1, wherein the other data factors than the encryption factor in the plurality of data factors are common factors; the second encryption rule is used for representing that the first variation of each common factor is not zero and the first variation of the encryption factor is zero.
3. The method according to claim 1, wherein the target arrangement position in the data to be encrypted is a first bit in the data to be encrypted or a last bit of the data to be encrypted.
4. The method according to any one of claims 1-3, wherein the method is applied to a first electronic device with a communication function, and the data to be encrypted is data sent by the first electronic device to a second electronic device with a communication function.
5. The method of claim 4, further comprising:
and if the target encrypted data has the ending character, sending the length information of the data to be encrypted to the second electronic equipment.
6. A method for data decryption, the method comprising:
in response to receiving target encrypted data, analyzing an encryption factor from the target encrypted data according to a preset first decryption rule and a preset second decryption rule; the target encrypted data is obtained by encrypting data to be encrypted according to the method of any one of claims 1 to 5, the first decryption rule is used for representing a target arrangement position of an encryption factor for encrypting the data to be encrypted in the target encrypted data, and the second decryption rule is used for representing a second variation of each data in the target encrypted data;
analyzing data at other sequencing positions except the target arrangement position in the target encrypted data according to the second decryption rule and the encryption factor to obtain data factors at the other sequencing positions;
and generating the data to be encrypted according to the encryption factors at the target arrangement positions and the data factors at the other arrangement positions.
7. The method of claim 6, wherein the parsing out the encryption factor from the target encrypted data according to a preset first decryption rule and a preset second decryption rule in response to receiving the target encrypted data comprises:
in response to receiving target encrypted data, determining a target arrangement position of the encryption factor in the target encrypted data according to the first decryption rule;
and decrypting the data at the target arrangement position in the target encrypted data according to a second variable quantity of the data at the target arrangement position represented in the second decryption rule to obtain an encryption factor.
8. An apparatus for encrypting data, the apparatus comprising:
the data encryption device comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is configured to respond to a received data encryption request and acquire data to be encrypted, and the data to be encrypted comprises a plurality of data factors;
the determining module is configured to select one data factor from the data to be encrypted as an encryption factor according to a preset first encryption rule; the first encryption rule is used for representing the target arrangement position of the encryption factor in the data to be encrypted;
the encryption module is configured to encrypt a plurality of data factors in the data to be encrypted according to a preset second encryption rule and the encryption factors to obtain target encrypted data; wherein the second encryption rule is used for representing a first variation of each data factor.
9. An apparatus for decrypting data, the apparatus comprising:
the first analysis module is configured to respond to the received target encrypted data, and analyze an encryption factor from the target encrypted data according to a preset first decryption rule and a preset second decryption rule; the target encrypted data is obtained by encrypting data to be encrypted according to the method of any one of claims 1 to 5, the first decryption rule is used for representing a target arrangement position of an encryption factor for encrypting the data to be encrypted in the target encrypted data, and the second decryption rule is used for representing a second variation of each data in the target encrypted data;
the second analysis module is configured to analyze data at other sorting positions except the target arrangement position in the target encrypted data according to the second decryption rule and the encryption factor to obtain data factors at the other arrangement positions;
and the generating module is configured to generate the data to be encrypted according to the encryption factors at the target arrangement position and the data factors at the other arrangement positions.
10. A data encryption apparatus, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
responding to a data encryption request, and acquiring data to be encrypted, wherein the data to be encrypted comprises a plurality of data factors;
selecting a data factor from the data to be encrypted as an encryption factor according to a preset first encryption rule; the first encryption rule is used for representing the target arrangement position of the encryption factor in the data to be encrypted;
encrypting a plurality of data factors in the data to be encrypted according to a preset second encryption rule and the encryption factors to obtain target encrypted data; wherein the second encryption rule is used for representing the variation of each data factor.
11. A data decryption apparatus, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
in response to receiving target encrypted data, analyzing an encryption factor from the target encrypted data according to a preset first decryption rule and a preset second decryption rule; the target encrypted data is obtained by encrypting the data to be encrypted according to the method of any one of claims 1 to 5, the first decryption rule is used for representing a target arrangement position of an encryption factor for encrypting the data to be encrypted in the target encrypted data, and the second encryption rule is used for representing a variation of each data in the target encrypted data;
analyzing data at other sequencing positions except the target arrangement position in the target encrypted data according to the second decryption rule and the encryption factor to obtain data factors at the other sequencing positions;
and generating the data to be encrypted according to the encryption factors at the target arrangement positions and the data factors at the other arrangement positions.
12. A computer readable storage medium having computer program instructions stored thereon, which when executed by a processor implement the steps of the method of any of claims 1 to 5 or 6 to 7.
CN202210173187.XA 2022-02-24 2022-02-24 Data encryption method and device, data decryption method and device and storage medium Pending CN114553552A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210173187.XA CN114553552A (en) 2022-02-24 2022-02-24 Data encryption method and device, data decryption method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210173187.XA CN114553552A (en) 2022-02-24 2022-02-24 Data encryption method and device, data decryption method and device and storage medium

Publications (1)

Publication Number Publication Date
CN114553552A true CN114553552A (en) 2022-05-27

Family

ID=81678300

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210173187.XA Pending CN114553552A (en) 2022-02-24 2022-02-24 Data encryption method and device, data decryption method and device and storage medium

Country Status (1)

Country Link
CN (1) CN114553552A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116542787A (en) * 2023-07-05 2023-08-04 北京码动摩登科技有限公司 Insurance business information query method, system, equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116542787A (en) * 2023-07-05 2023-08-04 北京码动摩登科技有限公司 Insurance business information query method, system, equipment and storage medium

Similar Documents

Publication Publication Date Title
US20220382884A1 (en) Method and device for parsing shared password
EP3324662B1 (en) Identity verification method, apparatus and system, computer program and recording medium
CN107766701B (en) Electronic equipment, dynamic library file protection method and device
US9723486B2 (en) Method and apparatus for accessing network
CN103914520B (en) Data query method, terminal device and server
CN114978512B (en) Privacy intersection method and device and readable storage medium
CN108900553B (en) Communication method, device and computer readable storage medium
CN106060098B (en) Processing method, processing unit and the processing system of identifying code
CN114969830B (en) Privacy intersection method, system and readable storage medium
CN106778225A (en) The method and apparatus for processing password
CN108155993B (en) Data encryption method and device for VSIM card
CN114553552A (en) Data encryption method and device, data decryption method and device and storage medium
CN112464257B (en) Data detection method and device for data detection
CN107302519B (en) Identity authentication method and device for terminal equipment, terminal equipment and server
CN115277117A (en) File viewing method and device, electronic equipment and storage medium
CN115438345A (en) Log encryption and decryption method, device, equipment and storage medium
CN113868505A (en) Data processing method and device, electronic equipment, server and storage medium
CN111371563A (en) Password verification method and device, electronic equipment and storage medium
CN114880691B (en) Character encoding and decoding method and device for character encoding and decoding
CN107318148B (en) Wireless local area network access information storage method and device
WO2023236042A1 (en) Biological feature recognition method and apparatus, and electronic device and storage medium
CN115499254B (en) User data processing method, device and system and readable storage medium
CN115514479A (en) Data information processing method, device and equipment based on block chain
CN115883061A (en) Key generation method, browser, terminal and storage medium
CN107566998B (en) Communication identifier processing method and device and terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination