CN109462468B - Data processing method and device - Google Patents
Data processing method and device Download PDFInfo
- Publication number
- CN109462468B CN109462468B CN201710804820.XA CN201710804820A CN109462468B CN 109462468 B CN109462468 B CN 109462468B CN 201710804820 A CN201710804820 A CN 201710804820A CN 109462468 B CN109462468 B CN 109462468B
- Authority
- CN
- China
- Prior art keywords
- encrypted
- byte
- result
- encryption result
- data
- 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.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/06—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
- H04L9/0618—Block ciphers, i.e. encrypting groups of characters of a plain text message using fixed encryption transformation
- H04L9/0631—Substitution permutation network [SPN], i.e. cipher composed of a number of stages or rounds each involving linear and nonlinear transformations, e.g. AES algorithms
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/06—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/06—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
- H04L9/0618—Block ciphers, i.e. encrypting groups of characters of a plain text message using fixed encryption transformation
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/14—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using a plurality of keys or algorithms
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Storage Device Security (AREA)
Abstract
The invention discloses a data processing method and a data processing device. Wherein, the method comprises the following steps: acquiring a plurality of target parameters of bytes to be encrypted; performing first logic operation on the target parameters and the bytes to be encrypted to obtain a first intermediate encryption result; redistributing the position of each bit according to the current position of each bit in the first intermediate encryption result; shifting the first intermediate encryption result subjected to position reallocation to a first direction to obtain a second intermediate encryption result; and performing second logic operation on the plurality of target parameters and the second intermediate encryption result to obtain an encryption result of the byte to be encrypted. The invention solves the technical problem that the encryption algorithm aiming at the data with shorter length in the prior art wastes the computing resources because of larger calculated amount.
Description
Technical Field
The present invention relates to the field of data processing, and in particular, to a data processing method and apparatus.
Background
Most of the prior high-intensity encryption algorithms (DES,3DES, AES) encrypt the length of the byte to be encrypted with 8 x n (n is more than or equal to 1), namely the multiple of 8, and the calculated amount is large when corresponding encryption calculation is carried out. In embedded practical application, the length of the transmitted data is often not large, for example, the length of the communication data required by a simple action instruction can be clearly expressed in 10 bytes, and meanwhile, the performance resources of the device in the embedded application are also poor. Therefore, if the above encryption algorithm is adopted, the content to be encrypted needs to be filled to a specific length (for example, an integral multiple of 8), and communication and system performance resources are not consumed.
Taking a 3DES encryption algorithm commonly used in the current embedded industry as an example, the scheme adopts multiple DES encryption and achieves the purpose of high-strength encryption through operations such as conversion, displacement and the like. The defects are as follows: 1. the byte to be encrypted is an integral multiple of 8; 2. the calculation amount is large; 3. a large memory space is required. Therefore, the scheme can consume the computing resources of the equipment in a vacant way, has longer computing time, and cannot be completely suitable for the application of the embedded system by combining the characteristics of shortage of corresponding resources and high requirement on timeliness in the embedded application.
Aiming at the problem that the calculation amount of an encryption algorithm is large in the prior art, so that the calculation resource is wasted, an effective solution is not provided at present.
Disclosure of Invention
The embodiment of the invention provides a data processing method and a data processing device, which are used for at least solving the technical problem that in the prior art, an encryption algorithm for short-length data wastes computing resources due to large computation amount.
According to an aspect of an embodiment of the present invention, there is provided a data processing method including: acquiring a plurality of target parameters of bytes to be encrypted; performing first logic operation on the target parameters and the bytes to be encrypted to obtain a first intermediate encryption result; redistributing the position of each bit according to the current position of each bit in the first intermediate encryption result; shifting the first intermediate encryption result subjected to position reallocation to a first direction to obtain a second intermediate encryption result; performing a second logic operation on the plurality of target parameters and the second intermediate encryption result to obtain an encryption result of the byte to be encrypted
Further, the reassigning the position of each bit according to the current position of each bit in the first intermediate encryption result includes: and the lower four bits of the address content in the first intermediate encryption result are changed into 2 x n addresses, and the upper four bits of the first intermediate encryption result are changed into 2 x (n-4) -1 addresses, wherein n is the current position of each bit in the first intermediate encryption result.
Further, the decryption end decrypts the encrypted result, wherein the decryption end decrypts the encrypted result by the step of: performing third logic operation on the encryption result and the plurality of target parameters to obtain a first intermediate decryption result, and adjusting the position of each bit of data in the first intermediate decryption result to obtain a second intermediate decryption result; and performing fourth logic operation on the second intermediate decryption result and the plurality of target parameters to obtain the byte to be encrypted.
Further, the first intermediate decryption result is shifted to a second direction, wherein the second direction is opposite to the first direction; and redistributing the position of each bit according to the current position of each bit in the shifted first intermediate encryption result to obtain a second intermediate decryption result.
Further, redistributing the position of each bit according to the current position of each bit in the shifted first intermediate encryption result, comprising: and in the shifted first intermediate encryption result, the content with the current position as an odd number is replaced by (n +1)/2+4, the content with the current position as an even number address is replaced by an n/2 address, wherein n is the current position of each bit in the shifted first intermediate decryption result.
Further, determining a first target parameter in the target parameters according to the position of the byte to be encrypted in the data; and determining a second target parameter in the target parameters according to the position of the byte to be encrypted in the data and a preset key of the data.
Further, acquiring a position parameter and a first preset value corresponding to the position of the byte to be encrypted in the data; and determining the result of the position parameter which is obtained by subtracting the first preset value as a first target parameter.
Further, acquiring a preset secret key of the data, a position parameter corresponding to the position of the byte to be encrypted in the data and a second preset value, wherein the second preset value is the byte number of the preset secret key; the position parameter is subjected to remainder on the second preset value, and a byte key is searched in the preset key according to the remainder result; and determining the byte key as a second target parameter.
Further, the first logical operation and the second logical operation are exclusive-or operations.
Further, the third logical operation and the fourth logical operation are exclusive-or operations.
According to another aspect of the embodiments of the present invention, there is also provided a data processing apparatus, including: the acquisition module is used for acquiring a plurality of target parameters of bytes to be encrypted; the first logic operation module is used for carrying out first logic operation on the target parameters and the bytes to be encrypted to obtain a first intermediate encryption result; the distribution module is used for redistributing the position of each bit according to the current position of each bit in the first intermediate encryption result; the shifting module is used for shifting the first intermediate encryption result after the position is redistributed to the first direction to obtain a second intermediate encryption result; and the second logic operation module is used for performing second logic operation on the plurality of target parameters and the second intermediate encryption result to obtain an encryption result of the byte to be encrypted.
According to another aspect of the embodiments of the present invention, there is also provided a storage medium including a stored program, wherein when the program runs, a device on which the storage medium is located is controlled to execute the data processing method of any one of the above.
According to another aspect of the embodiments of the present invention, there is also provided a processor, configured to execute a program, where the program executes a data processing method according to any one of the foregoing methods.
In the embodiment of the invention, a plurality of target parameters of bytes to be encrypted are obtained, a first logic operation is carried out on the plurality of target parameters and the bytes to be encrypted to obtain a first intermediate encryption result, the position of each position is redistributed according to the current position of each position in the first intermediate encryption result, the first intermediate encryption result after the position is redistributed is shifted to a first direction to obtain a second intermediate encryption result, and a second logic operation is carried out on the plurality of target parameters and the second intermediate encryption result to obtain the encryption result of the bytes to be encrypted. The scheme carries out encryption operation on the basis of byte data, thereby adapting to the particularity of embedded communication data, solving the technical problem that the encryption algorithm aiming at data with shorter length wastes computing resources due to larger calculated amount in the prior art, and further achieving the purpose of greatly reducing the loss of performance resources in the encryption process and the loss of communication resources occupied by invalid data in communication.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow diagram of a data processing method according to an embodiment of the invention;
FIG. 2 is a schematic diagram of obtaining a first intermediate encryption result according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating obtaining an encryption result of a byte to be encrypted according to an embodiment of the invention;
FIG. 4 is a diagram illustrating obtaining a first intermediate decryption result, according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating a decryption of bytes to be encrypted according to an embodiment of the present invention; and
fig. 6 is a schematic diagram of a data processing apparatus according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first", "second", and the like in the description and claims of the present invention and the above-mentioned drawings are used for distinguishing similar bytes to be encrypted, and are not necessarily used for describing a specific order or sequence. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
In accordance with an embodiment of the present invention, there is provided an embodiment of a data processing method, it should be noted that the steps illustrated in the flowchart of the accompanying drawings may be performed in a computer system such as a set of computer executable instructions, and that while a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be performed in an order different than that herein.
Fig. 1 is a flowchart of a data processing method according to an embodiment of the present invention, as shown in fig. 1, the method including the steps of:
step S102, a plurality of target parameters of the byte to be encrypted are obtained, wherein the byte to be encrypted is one or more bytes in the preset data. Specifically, the byte is a metering unit for metering the storage capacity, and the byte type data is stored in one byte and can be represented by 8-bit binary numbers.
In the above steps, the byte to be encrypted is the first byte or a plurality of bytes in the preset data, the length of the byte does not need to be multiple of 8, and the byte to be encrypted does not need to be filled; the object is the byte to be encrypted, namely the target parameter of the byte to be encrypted is obtained in the steps. In an optional embodiment, the byte to be encrypted has a preset key, and the target parameter of the byte to be encrypted can be obtained according to the key of the data to which the byte to be encrypted belongs.
Step S104, a first logic operation is carried out on the plurality of target parameters and the bytes to be encrypted, and a first intermediate encryption result is obtained.
And step S106, redistributing the position of each bit according to the current position of each bit in the first intermediate encryption result.
Specifically, each bit is used to indicate each bit in the first encryption result, and the position of each bit is redistributed, which may be adjusted according to a preset rule according to the current position of each bit. In an alternative embodiment, the lower four bits of the first intermediate encryption result are replaced by 2 × n address, and the upper four bits of the first intermediate encryption result are replaced by 2 × n (n-4) -1 address, where n is the current position of each bit in the first intermediate encryption result.
Step S108, the first intermediate encryption result after the position is redistributed is shifted to the first direction to obtain a second intermediate encryption result.
Step S110, perform a second logical operation on the plurality of target parameters and the second intermediate encryption result to obtain an encryption result of the byte to be encrypted.
Specifically, the second logic operation may be the same as the first logic operation, the encryption result of the byte to be encrypted is data that is finally transmitted to the decryption end, and the decryption end decrypts the byte to be encrypted according to the encryption result to obtain the original byte to be encrypted.
As can be seen from the above, in the above embodiments of the present application, a plurality of target parameters of a byte to be encrypted are obtained, a first logic operation is performed on the plurality of target parameters and the byte to be encrypted to obtain a first intermediate encryption result, a position of each position is redistributed according to a current position of each position in the first intermediate encryption result, a shift operation is performed on the first intermediate encryption result after the position is redistributed to a first direction to obtain a second intermediate encryption result, and a second logic operation is performed on the plurality of target parameters and the second intermediate encryption result to obtain an encryption result of the byte to be encrypted. The scheme carries out encryption operation on the basis of byte data, thereby adapting to the particularity of embedded communication data, solving the technical problem that the encryption algorithm aiming at data with shorter length wastes computing resources due to larger calculated amount in the prior art, and further achieving the purpose of greatly reducing the loss of performance resources in the encryption process and the loss of communication resources occupied by invalid data in communication.
It should be noted here that the above-mentioned scheme of the present application can be applied to devices related to a process of small data encryption, for example, in the fields of security and home appliances, and common applicable products may include: the method comprises the steps of encrypting communication data of household appliance remote controllers such as air conditioners, televisions and the like, encrypting security wireless transmission data, encrypting transmission data of intelligent household control products, encrypting communication data among infrared receiving and transmitting devices and the like. The high-strength encryption of data is realized by the low-performance main control chip, the data security is improved, and the product cost is correspondingly reduced. Meanwhile, the efficiency of the encryption process is improved, and the real-time performance in the control process is improved.
Optionally, according to the foregoing embodiment of the present application, after obtaining the encryption result of the byte to be encrypted, the method further includes: step S1010, the decryption end decrypts the encrypted result, wherein the step of decrypting the encrypted result by the decryption end comprises the following steps:
step S1012, performing a third logic operation on the encrypted result and the plurality of target parameters to obtain a first intermediate decrypted result, and adjusting a position of each bit of data in the first intermediate decrypted result to obtain a second intermediate decrypted result.
Specifically, the decryption end has a decryption algorithm corresponding to the encryption end. In the above step, the target parameter is not used to encrypt the encryption result again, but is used to decrypt the encryption result as a parameter.
Specifically, the third logical operation may be the same as the first logical operation and the second logical operation. Adjusting the position of the first intermediate result may include shifting and transposition operations, corresponding to the method in step 104.
Step 1014, performing a fourth logical operation on the second intermediate decryption result and the plurality of target parameters to obtain a byte to be encrypted.
Specifically, the fourth logical operation may be the same as the first logical operation, the second logical operation, and the third logical operation. The decryption method of the decryption side corresponds to the encryption method of the encryption side in steps S102 to S108, and the original byte to be encrypted can be obtained by the decryption method.
Optionally, adjusting a position of each bit of data in the first intermediate decryption result to obtain a second intermediate decryption result, including:
step S10121, a shift operation is performed on the first intermediate decryption result in a second direction, where the second direction is opposite to the first direction.
Step S10123, redistributing the position of each bit according to the current position of each bit in the shifted first intermediate encryption result, and obtaining a second intermediate decryption result.
In an alternative embodiment, in the shifted first intermediate encryption result, the content with the current position being an odd number is replaced by (n +1)/2+4, and the content with the current position being an even number address is replaced by an n/2 address, where n is the current position of each bit in the shifted first intermediate decryption result.
Optionally, according to the foregoing embodiment of the present application, obtaining a plurality of target parameters of a byte to be encrypted includes:
step S1021, a first target parameter in the target parameters is determined according to the position of the byte to be encrypted in the data.
In the above steps, since the position of each byte in the data is different, the position of the byte to be encrypted is used as the target parameter, so that different bytes to be encrypted can be prevented from having the same encryption result, and the one-to-one correspondence between the byte to be encrypted and the encryption result is ensured.
In step S1023, a second target parameter of the target parameters is determined according to the position of the byte to be encrypted in the data and the preset key of the data.
Similarly, the position of the byte to be encrypted in the data and the data preset key are used for determining the third target parameter, so that the unique and one-to-one corresponding third target parameter can be obtained.
Optionally, according to the foregoing embodiment of the present application, determining a first target parameter in the target parameters according to a position of a byte to be encrypted in data includes:
step S10211, obtain a location parameter and a first preset value corresponding to a location of a byte to be encrypted in data.
Step S10213, determining the first target parameter as the result of the position parameter 'S first preset value' S remainder.
In an alternative embodiment, in combination with the data shown in table one, the content B is taken as the byte to be encrypted, the content B is 0xC5, the position in the data is 2, the first preset value is set to be 16, and 2 is left over from 16 to obtain the first target parameter of 2, that is, 00000010.
Watch 1
Content providing method and apparatus | A | B | C | D | E | ...... |
Address | 1 | 2 | 3 | 4 | 5 | ...... |
Optionally, according to the foregoing embodiment of the present application, determining a second target parameter in the target parameters according to the preset key and the position of the data includes:
step S10231, a preset key of the data, a position parameter corresponding to the position of the byte to be encrypted in the data and a second preset value are obtained, wherein the second preset value is the byte number of the preset key.
And S10233, the position parameter is subjected to remainder on the second preset value, and the byte key is searched in the preset key according to the remainder result.
In step S10235, the byte key is determined as the second target parameter.
In an alternative embodiment, still taking the byte to be encrypted as the content B in the first table as an example, the preset key of the data shown in the first table is 6E7D05AA642E, the preset key is 6 bytes, the location parameter corresponding to the location of the content B is 2, and the location parameter 2 corresponding to the location of the content B is 2 obtained by subtracting the second preset value 6, so that the second byte can be searched in the preset key as the byte key, that is, the second target parameter is 0x 7D.
Optionally, according to the above embodiments of the present application, the first logic operation and the second logic operation are exclusive or operations.
Optionally, according to the above embodiments of the present application, the third logical operation and the fourth logical operation are exclusive-or operations.
In an alternative embodiment, taking the data shown in table one as an example, the byte B to be encrypted is 0xC5, and the preset key of the data is 6E7D05AA 642E. The content B is encrypted by the method provided by the above embodiment.
First, a second intermediate encryption result for the byte to be encrypted is obtained, which may be obtained using the formula bse ≦ bN ≦ bDA0,
in this embodiment, the first logical operation is an exclusive or operation, and the byte to be encrypted, the first target parameter, and the second target parameter are subjected to an exclusive or operation to obtain a second intermediate encryption result 0xBA, where bRES is the second intermediate encryption result of the byte to be encrypted, bDA0 is the byte to be encrypted 0xC5, bN _16 is the first target parameter 2, and bSEC is the second target parameter 0x7D, and the specific operation process is shown in fig. 2.
The first intermediate encryption result is then subjected to a repositioning operation, which includes transposition and shifting.
Transposition: starting from 1, the address is numbered from the lower order, and the content of the address of the lower four orders is changed to 2 x n address. The upper four bits are converted to 2 x (n-4) -1 addresses, the result after conversion is shown in table two, the byte content is rearranged according to the address after conversion, and the new content value is (11001101).
Watch two
Content providing method and apparatus | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 0 |
Address | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
Post-swap address | 7 | 5 | 3 | 1 | 8 | 6 | 4 | 2 |
And (3) shifting: and performing left cyclic shift on the data obtained by transposition by 3 bits to obtain 01101110, namely the second intermediate encryption result is 0x 6E.
Finally, the second intermediate encryption result 01101110 is subjected to exclusive or with the first target parameter 2 and the second target parameter 0x7D, as shown in fig. 3. Through the above steps of this embodiment, the encryption result of the content B (0xC5) is 0x 11.
Next, a decoding process corresponding to the above-described embodiment will be described.
First, a series of target parameters of the encryption result are obtained, wherein bDA is the encryption result of B, 0x11, the first target parameter bN _16 is 2% 16, the value is 2, and the second target parameter bSEC selects the second byte content, which is 0x7D, from the provided 6-byte encryption key 6E7D05AA 642E. And performing exclusive or on the encryption result and the two target parameters to obtain a second intermediate decryption result 0x 6E. The specific calculation process is shown in fig. 4.
Then, right-circularly shifting the data obtained in the first process by 3 bits to obtain 11001101, numbering addresses from the lower bits from 1, changing the content of the odd address n to the (n +1)/2+4 address, and changing the content of the even address m to the m/2 address, where the transposition operation can be shown in table three to obtain a second intermediate decryption result 10111010.
Watch III
Content providing method and apparatus | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 1 |
Address | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
Post-swap address | 4 | 8 | 3 | 7 | 2 | 6 | 1 | 5 |
Finally, the second intermediate decryption result 10111010 is subjected to exclusive or with the first target parameter 2 and the second target parameter 0x7D, as shown in fig. 5. Through the above steps of this embodiment, it can be obtained that the original content B corresponding to the encryption result is 0xC 5.
Example 2
According to an embodiment of the present invention, there is provided a data processing apparatus, and fig. 6 is a schematic diagram of a data processing apparatus according to an embodiment of the present application, and with reference to fig. 6, the apparatus includes:
an obtaining module 60 is configured to obtain a plurality of target parameters of the bytes to be encrypted.
The first logic operation module 62 is configured to perform a first logic operation on the multiple target parameters and the byte to be encrypted to obtain a first intermediate encryption result.
And the distribution module 64 is configured to redistribute the position of each bit according to the current position of each bit in the first intermediate encryption result.
And a shifting module 66, configured to shift the first intermediate encryption result after the position reallocation to the first direction to obtain a second intermediate encryption result.
A second logic operation module 68, configured to perform a second logic operation on the multiple target parameters and the second intermediate encryption result to obtain an encryption result of the byte to be encrypted.
Example 3
According to an embodiment of the present invention, there is provided a storage medium including a stored program, wherein, when the program runs, a device on which the storage medium is located is controlled to execute any one of the data processing methods described above.
Example 4
According to an embodiment of the present invention, there is provided a processor, configured to execute a program, where the program executes a data processing method according to any one of the foregoing methods.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.
Claims (12)
1. A data processing method, comprising:
acquiring a plurality of target parameters of bytes to be encrypted;
performing a first logic operation on the target parameters and the bytes to be encrypted to obtain a first intermediate encryption result;
redistributing the position of each bit according to the current position of each bit in the first intermediate encryption result;
shifting the first intermediate encryption result subjected to position reallocation to a first direction to obtain a second intermediate encryption result;
performing a second logical operation on the plurality of target parameters and the second intermediate encryption result to obtain an encryption result of the byte to be encrypted, wherein the first logical operation is the same as the second logical operation;
the obtaining of the plurality of target parameters of the byte to be encrypted includes: determining a first target parameter in the target parameters according to the position of the byte to be encrypted in the data; and determining a second target parameter in the target parameters according to the position of the byte to be encrypted in the data and a preset key of the data.
2. The method of claim 1, wherein redistributing the position of each bit according to the current position of each bit in the first intermediate encryption result comprises: and the lower four bits of the address content in the first intermediate encryption result are changed into 2 x n addresses, and the upper four bits of the first intermediate encryption result are changed into 2 x (n-4) -1 addresses, wherein n is the current position of each bit in the first intermediate encryption result.
3. The method of claim 2, wherein after obtaining the encryption result of the byte to be encrypted, the method further comprises: the decryption end decrypts the encrypted result, wherein the decryption end decrypts the encrypted result and comprises the following steps:
performing a third logic operation on the encryption result and the plurality of target parameters to obtain a first intermediate decryption result, and adjusting the position of each bit of data in the first intermediate decryption result to obtain a second intermediate decryption result;
and performing fourth logical operation on the second intermediate decryption result and the plurality of target parameters to obtain the byte to be encrypted, wherein the first logical operation, the second logical operation, the third logical operation and the fourth logical operation are the same.
4. The method of claim 3, wherein adjusting the position of each bit of data in the first intermediate decryption result to obtain a second intermediate decryption result comprises:
shifting the first intermediate decryption result to a second direction, wherein the second direction is opposite to the first direction;
and redistributing the position of each bit according to the current position of each bit in the shifted first intermediate encryption result to obtain a second intermediate decryption result.
5. The method of claim 4, wherein the reassigning the position of each bit according to the current position of each bit in the shifted first intermediate encryption result comprises: and in the shifted first intermediate encryption result, the content with the current position as an odd number is replaced by (n +1)/2+4, the content with the current position as an even number address is replaced by an n/2 address, wherein n is the current position of each bit in the shifted first intermediate decryption result.
6. The method of claim 1, wherein determining a first parameter of the target parameters according to the position of the byte to be encrypted in the data comprises:
acquiring a position parameter and a first preset value corresponding to the position of the byte to be encrypted in the data;
and determining the result of the position parameter for the first preset value as the first target parameter.
7. The method of claim 1, wherein determining a second target parameter of the target parameters according to the position of the byte to be encrypted in the data and a preset key of the data comprises:
acquiring a preset secret key of the data, a position parameter corresponding to the position of the byte to be encrypted in the data and a second preset value, wherein the second preset value is the byte number of the preset secret key;
the position parameter is subjected to remainder on the second preset value, and a byte key is searched in the preset key according to the remainder result;
and determining the byte key as the second target parameter.
8. The method of claim 1, wherein the first logical operation and the second logical operation are exclusive-or operations.
9. The method of claim 3, wherein the third logical operation and the fourth logical operation are exclusive OR operations.
10. A data processing apparatus, comprising:
the acquisition module is used for acquiring a plurality of target parameters of bytes to be encrypted;
the first logic operation module is used for carrying out first logic operation on the target parameters and the bytes to be encrypted to obtain a first intermediate encryption result;
the distribution module is used for redistributing the position of each bit according to the current position of each bit in the first intermediate encryption result;
the shifting module is used for shifting the first intermediate encryption result after the position is redistributed to the first direction to obtain a second intermediate encryption result;
the second logic operation module is used for performing second logic operation on the plurality of target parameters and the second intermediate encryption result to obtain an encryption result of the byte to be encrypted, wherein the first logic operation is the same as the second logic operation;
wherein the obtaining module is further configured to: determining a first target parameter in the target parameters according to the position of the byte to be encrypted in the data; and determining a second target parameter in the target parameters according to the position of the byte to be encrypted in the data and a preset key of the data.
11. A storage medium storing a program, wherein the program is executed by a processor to control an apparatus in which the storage medium is located to execute the data processing method according to any one of claims 1 to 9.
12. A processor, characterized in that the processor is configured to run a program, wherein the program is configured to execute the data processing method according to any one of claims 1 to 9 when running.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710804820.XA CN109462468B (en) | 2017-09-06 | 2017-09-06 | Data processing method and device |
PCT/CN2018/079772 WO2019047503A1 (en) | 2017-09-06 | 2018-03-21 | Data processing method and apparatus |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710804820.XA CN109462468B (en) | 2017-09-06 | 2017-09-06 | Data processing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109462468A CN109462468A (en) | 2019-03-12 |
CN109462468B true CN109462468B (en) | 2021-05-28 |
Family
ID=65606174
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710804820.XA Active CN109462468B (en) | 2017-09-06 | 2017-09-06 | Data processing method and device |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN109462468B (en) |
WO (1) | WO2019047503A1 (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110837510B (en) * | 2019-11-13 | 2020-08-07 | 北京深演智能科技股份有限公司 | Data processing method, device, storage medium and processor |
CN111400738B (en) * | 2020-03-19 | 2023-05-02 | 杭州小影创新科技股份有限公司 | Data encryption method adopting multidimensional table look-up mode |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7295671B2 (en) * | 2002-05-23 | 2007-11-13 | Atmel Corporation | Advanced encryption standard (AES) hardware cryptographic engine |
CN101013938B (en) * | 2007-01-12 | 2010-04-07 | 广州市诚毅科技软件开发有限公司 | Encryption method of block cipher |
CN100544250C (en) * | 2007-07-13 | 2009-09-23 | 南京邮电大学 | The encrypting and decrypting method of broadcast of network information |
CN102932135A (en) * | 2012-10-25 | 2013-02-13 | 福建升腾资讯有限公司 | 3DES (triple data encrypt standard) encryption method |
CN105556583B (en) * | 2014-05-21 | 2019-06-21 | 富士电机株式会社 | Information processing unit, program and recording medium |
CN106407127B (en) * | 2015-07-31 | 2019-12-10 | 腾讯科技(深圳)有限公司 | Data encryption method and device |
CN107038383B (en) * | 2016-02-03 | 2020-08-25 | 华为技术有限公司 | Data processing method and device |
-
2017
- 2017-09-06 CN CN201710804820.XA patent/CN109462468B/en active Active
-
2018
- 2018-03-21 WO PCT/CN2018/079772 patent/WO2019047503A1/en active Application Filing
Also Published As
Publication number | Publication date |
---|---|
CN109462468A (en) | 2019-03-12 |
WO2019047503A1 (en) | 2019-03-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102710415B (en) | Method and table look-up device for encrypting and decrypting data by using symmetric cryptographic algorithm | |
CN105610793B (en) | A kind of outsourcing data encryption storage and cryptogram search system and its application process | |
CN104396183B (en) | Method and system for firmware or software to be sent to multiple equipment | |
JP5835458B2 (en) | Information processing apparatus, information processing method, and program | |
CN105071927B (en) | Method is locally stored in a kind of mobile device data | |
CN104410616A (en) | Method and system for encrypting, decrypting and transmitting data | |
CN110768787A (en) | Data encryption and decryption method and device | |
CN104660726A (en) | Network configuration method, device and system for intelligent device | |
JP6282343B2 (en) | Broadcast encryption method and computer program | |
WO2013129054A1 (en) | Information processing device, information processing method, and programme | |
Panda | Data security in wireless sensor networks via AES algorithm | |
CN109462468B (en) | Data processing method and device | |
CN106411501B (en) | Rights token generation method, system and its equipment | |
CN102664730B (en) | 128 bit secret key expansion method based on AES (Advanced Encryption Standard) | |
CN102624520B (en) | 192 bit key expansion system and method based on AES (Advanced Encryption Standard) | |
Fadhil et al. | A lightweight aes algorithm implementation for secure iot environment | |
CN105723647A (en) | System for sharing a cryptographic key | |
JP5289476B2 (en) | Communication device and key calculation device | |
CN109040092A (en) | data random encrypting method and device | |
JP2013182148A (en) | Information processing apparatus, information processing method, and program | |
CN115426111A (en) | Data encryption method and device, electronic equipment and storage medium | |
CN104462994A (en) | Data encryption and decryption operation method | |
CN106454435B (en) | Conditional access method and related equipment and system | |
CN106878266A (en) | A kind of unstructured data Transmission system | |
KR101428665B1 (en) | Security system and method for using aes-otp |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |