CN115348018A - Data processing method, device and storage medium - Google Patents
Data processing method, device and storage medium Download PDFInfo
- Publication number
- CN115348018A CN115348018A CN202210881193.0A CN202210881193A CN115348018A CN 115348018 A CN115348018 A CN 115348018A CN 202210881193 A CN202210881193 A CN 202210881193A CN 115348018 A CN115348018 A CN 115348018A
- Authority
- CN
- China
- Prior art keywords
- key
- sub
- equal
- polynomial
- encryption
- 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.)
- Granted
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/14—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using a plurality of keys or 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
- H04L9/0643—Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
-
- 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/065—Encryption by serially and continuously modifying data stream elements, e.g. stream cipher systems, RC4, SEAL or A5/3
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L2209/00—Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
- H04L2209/12—Details relating to cryptographic hardware or logic circuitry
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Power Engineering (AREA)
- Signal Processing For Digital Recording And Reproducing (AREA)
- Storage Device Security (AREA)
Abstract
The invention discloses a data transmission method, which is based on an encryption algorithm of a CRC8 polynomial, has reversible hash and is unique in a Galois field, and provides a method for applying CRC8 as a hash function to stream encryption in the field of symmetric encryption. The invention adopts a byte (stream) encryption method that a master key hash generates a polynomial table and a sub-key is used as an index table lookup, and adopts a position counter parameter to solve the sub-key collision problem; thirdly, the invention solves the technical problem that the encryption and decryption speed is proportional to the length of the master key when the master key is 128x2 n And when the bit (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4), the encryption and decryption speed is increased along with the increase of n.
Description
Technical Field
The invention belongs to the technical field of data processing, and particularly relates to a data processing method, a data processing device and a storage medium.
Background
For an end-to-end and point-to-point data transmission application scenario, a data processing request sent by a client is received, and a technical problem of data leakage is encountered. If data security processing is involved, the data is in an unprotected state, even delay is generated, and the requirement of real-time performance is not met.
According to galois field theory: finite fields, also known as galois fields, are fields that contain only a limited number of elements. Like other fields, a finite field is a set that is defined for performing addition, subtraction, multiplication, and division operations and satisfies certain rules. Where addition and multiplication must satisfy the rules of swapping, combining, and allocating. Addition and multiplication have a closed nature, i.e. the result of addition and multiplication remains an element in the domain.
The existing stream encryption algorithm obtains a 'pseudo-random key byte stream' in a preparation stage in advance, and encryption or decryption only needs to perform exclusive or calculation. Meanwhile, the conventional stream encryption algorithm generates multi-byte random byte streams through kernel function calculation, and then the multi-byte random byte streams are spliced into the final pseudorandom byte streams to be subjected to exclusive-or operation with a plaintext or ciphertext to complete encryption and decryption, and modes such as static encryption and decryption tables, linear compression tables, nonlinear displacement, a double-key mechanism, dynamic index table lookup and the like are not used.
According to the 'perfect confidentiality' of Shannon theory, the length of the secret key is required to be not less than the length of the plaintext, and the length of the plaintext can be any length. Therefore, the prior art generally realizes that the key stream length is not less than the plaintext length by a pseudo-random key stream generator. In reality, however, the pseudo-random key stream generated by the pseudo-random key stream generator may have periodic variations, thereby creating a potential risk to data security of the key stream.
Disclosure of Invention
Aiming at the problems of the existing stream encryption algorithm, the invention provides a data processing method, a device, computer equipment and a storage medium. The method comprises the steps of receiving a data processing request sent by a client, wherein the data processing request carries ciphertext data, and the ciphertext data is generated by encrypting target data by the client through a polynomial encryption algorithm; responding to the data processing request, and calling polynomial encryption flow operation according to a preset secret key to obtain ciphertext characteristic data; and sending the ciphertext feature data to a server, wherein the server is used for processing the ciphertext feature data with the client by calling a polynomial decryption algorithm according to a preset key to obtain plaintext feature data, and vice versa. The invention provides a new implementation way, which can carry out ciphertext processing on data under the condition of inputting plaintext data, can effectively protect data privacy and can save bandwidth resources.
The invention provides a data transmission method, which is based on an encryption algorithm of a CRC8 polynomial, has reversible hash and is unique in a Galois field, and provides a stream encryption method of applying CRC8 as a hash function to the field of symmetric encryption. Secondly, in order to improve the encryption and decryption speed, the invention adopts a byte (stream) encryption method that a main key hash generates a polynomial table and a sub-key is used as an index table lookup, and adopts a position counter parameter to solve the problem of sub-key collision, thereby realizing the pseudo-random of a ciphertext stream; thirdly, the invention solves the technical problem that the encryption and decryption speed is proportional to the length of the master key when the master key is 128x2 n When the bit (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4), the encryption and decryption speed is increased along with the increase of n.
In order to realize the technical task, the invention adopts the following technical scheme to realize:
a method of data transmission, the method comprising the steps of:
step 1: generating a corresponding static polynomial table by the master key according to an encryption or decryption process;
step 2: the sub-key is continuously converted into a new sub-key in turn in the encryption or decryption process;
and step 3: and performing index table lookup on the new sub-key in the master key static polynomial table for multiple times to complete byte encryption or decryption tasks.
Further, the step 1: and the master key generates a corresponding static polynomial table through a kernel function CRC8 according to the encryption or decryption process.
Step 1: the master key generates a static polynomial table through kernel function CRC8 hashing in an encryption process, the master key generates the static polynomial table through kernel function CRC8 inverse hashing in a decryption process, and the static polynomial tables generated through hashing and inverse hashing are reciprocal and unique in a Galois field.
Step 1: the method for generating the static polynomial table by hashing of the master key through the kernel function CRC8 in the encryption process specifically comprises the following steps:
1) Hashing any type of master key into 128x2 through a kernel function CRC8 n (n is a non-negative integer, n is more than or equal to 0 and less than or equal to4) A master key of bits;
2) For 16x2 n (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4) independent main key bytes, and the composition contains 16x2 n (n is a non-negative integer, 0. Ltoreq. N.ltoreq.4) polynomials of kernel function CRC8, 2m (m is a positive integer, 2. Ltoreq. M.ltoreq.8 x 2) being arbitrarily selected n ) A CRC8 polynomial hash is performed 2m times;
3) For the solution passing through 2m (m is a positive integer, 2 is more than or equal to m is less than or equal to 8x 2) n ) Performing linear S-box replacement on the sub-CRC 8 polynomial hashed data for one time, and then performing 2m (m is a positive integer, 2 is more than or equal to m and less than or equal to 8x 2) n ) sub-CRC 8 polynomial hashing, i.e., at every two 2m (m is a positive integer, 2. Ltoreq. M.ltoreq.8 x2 n ) sub-CRC 8 polynomial with linear S-box permutation in the middle of the interval until the master key byte is traversed, generating 2 n+4 x256 (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4).
Further, step 1: the method for generating the static polynomial table by the inverse hash of the kernel function CRC8 in the decryption process of the master key specifically comprises the following steps:
1) Inverse hashing of any type of master key into 128x2 via the kernel function CRC8 n (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4) bits of master key;
2) For 16x2 n (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4) independent main key bytes which form a byte containing 16x2 n (n is a non-negative integer, 0. Ltoreq. N.ltoreq.4) polynomials of kernel function CRC8, 2m (m is a positive integer, 2. Ltoreq. M.ltoreq.8 x 2) being arbitrarily selected n ) 2m CRC8 polynomial inverse hash;
3) For the solution passing through 2m (m is a positive integer, 2 is more than or equal to m is less than or equal to 8x 2) n ) Performing linear S-box replacement on sub-CRC 8 polynomial inverse hashed data for one time, and performing 2m (m is a positive integer, 2 is more than or equal to m and less than or equal to 8x 2) n ) sub-CRC 8 polynomial inverse hashing, i.e., at every two 2m (m is a positive integer, 2. Ltoreq. M.ltoreq.8 x2 n ) sub-CRC 8 polynomial with a linear S-box permutation in the middle of the interval until the master key byte is traversed, generating 2 n +4 x256 (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4).
Step 2: the continuous rotation of the sub-key into a new sub-key in the encryption or decryption process specifically includes:
1) Generating a sub-key according to the master key;
2) Carrying out XOR operation on the 4-byte sub-key generated according to the master key and a position counter of the plaintext byte which starts to be input to obtain a new sub-key;
3) And dividing the new 4-byte subkey into a subkey 1, a subkey 2, a subkey 3 and a subkey 4 according to bytes.
The step 3: and performing index table lookup on the new subkey in a master key static polynomial table for multiple times to complete a byte encryption or decryption task, wherein the task of completing the byte encryption specifically comprises the following steps:
1) Carrying out XOR operation on input plaintext data and the sub-secret key 1;
2) Inputting the result of the XOR operation into a static polynomial table generated by the main key in the encryption process, performing table indexing through the sub-key 2, performing XOR operation with the result of the index table lookup, and performing nonlinear S-box replacement on the result of the XOR operation;
3) Performing exclusive-or operation on the result of the nonlinear S box after replacement and the subkey 3, inputting the result into a static polynomial table generated by the main key in the encryption process, performing table indexing through the subkey 3, and performing exclusive-or operation on the result of table lookup with the index and the subkey 4;
4) Outputting encrypted ciphertext data;
5) And calling continuous rotation to generate a new sub-key, and repeating the steps 1) -4) until the encryption task is finished.
And 3, step 3: and performing index table lookup on the new subkey in the static polynomial table of the master key for multiple times to complete the byte encryption or decryption task, wherein the task of completing the byte decryption specifically comprises the following steps:
1) Carrying out XOR operation on the input ciphertext data and the sub-secret key 4;
2) Inputting the result of the XOR operation into a static polynomial table generated by the main key in the decryption process, performing table indexing through the sub-key 3, performing XOR operation with the index table look-up result, and performing nonlinear S-box replacement on the XOR operation result;
3) Performing exclusive-or operation on the result of the nonlinear S box after replacement and the subkey 2, inputting the result into a static polynomial table generated by the main key in a decryption process, performing table indexing through the subkey 2, and performing exclusive-or operation on the result of table lookup with the index and the subkey 1;
4) Outputting decrypted plaintext data;
5) And calling the continuous rotation to generate a new sub-key, and repeating the steps 1) -4) until the decryption task is finished.
The method of the present invention further comprises hashing an initial key given by a user to obtain a master key of a fixed length before step 1. Hashing a user-given initial key to 128x2 via a kernel function CRCn (n =128, 256, 512, 1024, 2048) n (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4).
The subkey involved in the invention is 32 bits.
The invention also provides a data transmission device, which comprises a processor and a memory;
the memory is used for storing;
the processor is used for executing the data transmission method of the invention through calling.
A computer program product comprising a computer program and/or instructions which, when executed by a processor, implements the data transmission method of the invention.
Compared with the prior art, the invention has the following technical characteristics and beneficial effects:
1) The invention generates a static polynomial table by the hash of a kernel function CRC8 polynomial of a main key, and dynamically indexes and checks the table by a sub-key, and encrypts or decrypts the byte stream by taking plaintext bytes or ciphertext bytes as a unit sequence.
2) The invention effectively reduces the storage space and improves the use efficiency while improving the security intensity during encryption and decryption, the maximum compression ratio can reach the lossless compression of 32.
3) The stream encryption algorithm of the invention has a double-key mechanism, and before encryption and decryption, a main key generates a static polynomial table for encryption and decryption through reversible polynomial hash of a kernel function CRC8, thereby completing the tabulation process of encryption and decryption. The hash generates a static polynomial table for encryption and decryption, which is unique and has no key collision problem. The sub-key is continuously turned into a new sub-key in the encryption or decryption process.
4) The encryption algorithm adopts a table making mode that the main key hash generates a polynomial table, the sub-keys are used as index table look-up, and a position counter is adopted to solve the problem of sub-key collision, so that the pseudo-randomness of a cipher text stream of the encryption method is improved, and the safety intensity is increased.
5) The encryption algorithm of the invention realizes the relationship that the encryption and decryption speed is in direct proportion to the length of the main key, and when the length of the main key is increased, the encryption and decryption speed is increased along with the increase of the length of the main key.
Drawings
FIG. 1 is a static polynomial table generation flow for encryption and decryption in accordance with the present invention;
fig. 2 is a flow of dynamic table lookup and subkey round robin updating for encryption and decryption according to the present invention.
Fig. 3 shows the same key used in the present invention and the prior art, and the encryption effect is compared. FIG. 3a shows that there is periodicity when ciphertext data collide without using a position counter; FIG. 3b shows that there is no periodicity when ciphertext data is collided using the position calculator.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and specific embodiments.
The invention relates to a data transmission method, which integrally comprises the following steps:
step 1: generating a static polynomial table by the master key according to an encryption or decryption process;
step 2: the sub-key is continuously converted into a new sub-key in turn in the encryption or decryption process;
and step 3: and performing index table lookup on the new sub-key in the master key static polynomial table for multiple times to complete byte encryption or decryption tasks.
Wherein, the step 1: the master key generates a static polynomial table through a reversible kernel function CRC8 according to an encryption flow or a decryption flow respectively.
Specifically, an initial key given by a user is hashed to 128x2 through a kernel function CRCn (n =128, 256, 512, 1024, 2048) n (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4). Then, the master key is hashed through a kernel function CRC8 in an encryption flow to generate a static polynomial table, the master key is inversely hashed through the kernel function CRC8 in a decryption flow to generate the static polynomial table, and the static polynomial table generated through hashing and inverse hashing is mutually inverse and is unique in a Galois field.
Referring to fig. 1, the process of generating the static polynomial table by hash or inverse hash of the kernel function CRC8 in the encryption flow or the decryption flow of the master key is as follows:
1) The initial key given by the user is hashed to obtain 128x2 n (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4).
2) For 16x2 n (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4) independent main key bytes which form a byte containing 16x2 n (n is a non-negative integer, 0. Ltoreq. N.ltoreq.4) polynomials of kernel function CRC8, where 2m (m is a positive integer, 2. Ltoreq. M.ltoreq.8 x2 is arbitrarily selected n ) Byte by byte, CRC8 polynomial hash or inverse hash is performed 2m times.
3) For the solution passing through 2m (m is a positive integer, 2 is more than or equal to m is less than or equal to 8x 2) n ) Performing linear S-box replacement on sub-CRC 8 polynomial hashed or inverse hashed data for one time, and performing 2m (m is a positive integer, 2 is more than or equal to m is less than or equal to 8x2 n ) sub-CRC 8 polynomial hash or inverse hash, i.e., at every two 2m (m is a positive integer, 2. Ltoreq. M.ltoreq.8 x2 n ) sub-CRC 8 polynomial with linear S-box permutation in between until the master key byte is traversed, generating 16x2 n x256 (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4).
For example: the master key is divided into 4 independent master key bytes to form 1 group of polynomials with 4 kernel functions CRC8, and input data 0x 00-0 xFF is subjected to CRC8 polynomial hashing for 4 times respectively. Performing CRC8 polynomial hash on input data 0x 00-0 xFF 4 times respectively, adding CRC8 polynomial linear replacement 1 time in the middle, outputting 1 group of 4x256 data tables until the byte of the master key is used up, and generating 2 n+4 x256 (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4). For 128x2 n (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4) bit, and the analogy can be repeated to obtain 16x256, 32x256, 64x256, 128x256 and 256x256 static polynomial tables. In the process of generating the polynomial table, 4-order kernel function CRC8 polynomial hash calculation is shared, and 1-order linear S-box permutation is carried out in each 2-order calculation. The linear S-box permutation is essentially a hash value generated by a 256x256 CRC8 polynomial hash. In other words, a 1-time linear S-box permutation may be considered as a 1-time hash computation with the ordinate being the kernel function CRC8 polynomial and the abscissa being the input byte. From this, the generator polynomial table shares the 5-degree kernel function CRC8 polynomial hash calculation. For any byte in 0x 00-0 xFF, generating a hash byte in 0x 00-0 xFF through polynomial hash of a kernel function CRC 8; on the contrary, for any hashed byte from 0x00 to 0xFF, the byte from 0x00 to 0xFF is generated by inverse hashing of the polynomial of the kernel function CRC 8. Moreover, the hash and the inverse hash are both unique, and there is no collision generated. For bytes in 0x 00-0 xFF, hash bytes are generated sequentially through polynomial hash of the kernel function CRC8 to form a line of polynomial table corresponding to the kernel function CRC 8. Then, the polynomial hash of the multiple different kernel functions CRC8 may form a multi-line polynomial table, that is, the different kernel functions CRC8 are ordinate, and the bytes in 0x00 to 0xFF are abscissa, so as to form a two-dimensional polynomial table, and the index value of the ordinate and the abscissa is the hash byte.
The encrypted static polynomial table is generated by kernel function CRC8 polynomial hashing, the decrypted static polynomial table is generated by kernel function CRC8 polynomial inverse hashing, and the reversible processes are mutually reversible, thereby forming a reversible mechanism of the core of the stream encryption algorithm.
When the master key is subjected to a process of generating a static polynomial table through kernel function CRC8 hashing or inverse hashing in an encryption flow or a decryption flow, 8 non-repeating bytes are randomly selected from 0x 00-0 xFF, and each byte can be decomposed into the sum of 8 bytes. The 8 bytes of decomposition hash a sub-table of a row of 8-element polynomial table by the polynomial of the kernel function CRC8, and according to this method, a sub-table of other arbitrary 7 bytes of polynomial is made, and a row of polynomial table of CRC8 is synthesized in the galois field. Since the number of row elements of the sub-table of the polynomial table is 8 and the number of row elements of the full table of the polynomial table is 256, it is obvious that the full table can be decomposed into sub-tables and the sub-tables can be synthesized into a full table, and the maximum compression ratio is 32. As can be seen, any one byte of 0x00 to 0xFF can be linearly represented by 8 bytes without repetition in the galois field. Then, 256 bytes of 0x00 to 0xFF can be obtained by linear calculation of the non-repeating 8 bytes, that is, a compression ratio of 256.
For the polynomial table generated by the polynomial hash of the kernel function CRC8, for encryption and decryption, the whole polynomial table is synthesized in the memory and is provided only when the table is looked up by indexes, so that the security intensity of the encryption method is improved, and the use efficiency of the storage space is also improved.
The master key of the present invention is 128x2 n And (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4), and for the encryption and decryption processes, the corresponding shift times are 4-n (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4) in sequence along with the increase of n. As n increases, the difference in algorithm implementation is only a reduction in the number of shifts, and the speed of algorithm implementation is equivalent to an increase in speed, i.e., the encryption and decryption speeds are proportional to the master key length, and as the master key length increases, the encryption and decryption speeds also increase.
The invention comprises the following steps: the sub-key is continuously converted into a new sub-key in turn in the encryption or decryption process, and the specific process comprises the following steps:
1) Generating a sub-key according to the main key; where the subkey is 32 bits, i.e. 4 bytes.
2) Carrying out XOR operation on the randomly generated 4-byte sub-key and a position counter of the plaintext byte which starts to be input to obtain a new sub-key; the position calculator parameter is used for eliminating the subkey collision of the 32-bit pseudo-random stream key generator in the data range of 4G, and the subkey is set to be 0-2 32 The randomness can be enhanced without regularity in the variation range of-1.
3) The new sub-key is divided into sub-key 1, sub-key 2, sub-key 3 and sub-key 4 according to bytes.
Referring to fig. 2, in step 3 of the present invention, a new sub-key is indexed and looked up in a master key static polynomial table for multiple times, so as to complete a business flow chart of a byte encryption or decryption task.
The task of completing byte encryption specifically comprises the following steps:
1) Carrying out XOR operation on input plaintext data and the sub-secret key 1;
2) Inputting the result of the XOR operation into a static polynomial table generated by the main key in the encryption process, performing table indexing through the sub-key 2, performing XOR operation with the result of the index table lookup, and performing nonlinear S-box replacement on the result of the XOR operation;
3) Performing exclusive-or operation on the result of the nonlinear S box after replacement and the subkey 3, inputting the result into a static polynomial table generated by the main key in the encryption process, performing table indexing through the subkey 3, and performing exclusive-or operation on the result of table lookup with the index and the subkey 4;
4) Outputting the encrypted ciphertext data;
5) And calling continuous rotation to generate a new sub-key, and repeating the steps 1) -4) until the encryption task is finished.
The specific completion of the byte decryption task specifically includes:
1) Carrying out XOR operation on the input ciphertext data and the sub-secret key 4;
2) Inputting the result of the XOR operation into a static polynomial table generated by the main key in the decryption process, performing table indexing through the sub-key 3, performing XOR operation with the index table look-up result, and performing nonlinear S-box replacement on the XOR operation result;
3) Performing exclusive-or operation on the result after the nonlinear S box replacement and the sub-secret key 2, inputting the result into a static polynomial table generated by the main secret key in a decryption process, performing table indexing through the sub-secret key 2, and performing exclusive-or operation on the result of table lookup with the index and the sub-secret key 1;
4) Outputting decrypted plaintext data;
5) And calling continuous rotation to generate a new subkey, and repeating the steps 1) -4) until the decryption task is finished.
The invention also provides a data processing device, which comprises a processor and a memory;
the memory is used for storing;
the processor is configured to execute the method according to any one of the above embodiments by calling.
The invention also provides a computer program product comprising a computer program and/or instructions which, when executed by a processor, performs the steps of the method of any of the above embodiments.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, the present invention may take the form of an entirely software embodiment, an entirely hardware embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention is in the form of a computer program product that may be embodied on one or more computer-usable storage media having computer-usable program code embodied therewith. And such computer-usable storage media include, but are not limited to: various media capable of storing program codes, such as a usb disk, a portable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk Memory, a Compact Disc Read-Only Memory (CD-ROM), and an optical Memory.
The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus and computer program products of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a system for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction system which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks. While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the present invention and its equivalent technology, it is intended that the present invention also encompass such modifications and variations.
Fig. 3 is a diagram for verifying the technical effect of the present invention and the prior art. The invention adopts the same key as the prior art, and the encryption effect is compared. FIG. 3a shows that there is periodicity when ciphertext data is collided without using a position counter; FIG. 3b shows that there is no periodicity for collision of ciphertext data by using the position calculator.
The invention relates to a tabulation mode of generating a polynomial table by hashing a main key of a data transmission method, wherein a subkey is used as an index table, and a position counter is adopted to solve the problem of subkey collision so as to improve the randomness of the encryption method and increase the safety intensity.
Compared with the prior art, the invention has the advantages that the existing stream encryption algorithm only needs to carry out XOR for 1 time when encrypting and decrypting one byte. The method comprises the steps of generating multi-byte random byte streams through kernel function calculation, and then splicing the multi-byte random byte streams into a final pseudorandom byte stream to be subjected to exclusive-or operation with a plaintext or a ciphertext to finish encryption and decryption.
Compared with the prior art, the stream encryption algorithm needs table look-up and exclusive-or for 4 times every time a byte is encrypted and decrypted, and completes the encryption and decryption processes by combining static encryption and decryption tables, linear compression tables, nonlinear replacement, a double-key mechanism, dynamic index table look-up and the like. Meanwhile, the encryption algorithm of the invention is used independently as stream encryption and used in parallel as block encryption.
The stream encryption algorithm of the invention provides a brand-new encryption realization way. The stream encryption algorithm of the invention mainly comprises four parts of conversion, namely, horizontal direction shift, exclusive OR, linear substitution and nonlinear substitution, and does not need vertical direction conversion. And, the randomness of the collision enhancement algorithm is eliminated by using a position calculator. Compared with block encryption, the invention has obvious speed performance advantage because the transformation in the vertical direction is not needed, and the plaintext and the ciphertext are encrypted and decrypted according to a single byte.
Claims (13)
1. A method of data transmission, characterized by: the method comprises the following steps:
step 1: generating a corresponding static polynomial table by the master key according to an encryption or decryption process;
step 2: the sub-key is continuously converted into a new sub-key in turn in the encryption or decryption process;
and step 3: and performing index table lookup on the new sub-key in the master key static polynomial table for multiple times to complete byte encryption or decryption tasks.
2. The data transmission method according to claim 1, characterized in that: the step 1: the master key generates a static polynomial table through a kernel function CRC8 according to an encryption flow or a decryption flow respectively.
3. The data transmission method according to claim 2, characterized in that: the step 1: the master key generates a static polynomial table through kernel function CRC8 hashing in an encryption process, the master key generates the static polynomial table through kernel function CRC8 inverse hashing in a decryption process, and the static polynomial tables generated through hashing and inverse hashing are reciprocal and unique in a Galois field.
4. The data transmission method of claim 3, wherein: the step 1: the method for generating the static polynomial table by hashing of the master key through the kernel function CRC8 in the encryption process specifically comprises the following steps:
1) Hashing any type of master key into 128x2 via the kernel function CRC8 n (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4) bits of master key;
2) For 16x2 n (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4) independent main key bytes, and the composition contains 16x2 n (n is a non-negative integer, 0. Ltoreq. N.ltoreq.4) polynomials of kernel function CRC8, where 2m (m is a positive integer, 2. Ltoreq. M.ltoreq.8 x2 is arbitrarily selected n ) A CRC8 polynomial hash is carried out for 2m times;
3) For the solution passing through 2m (m is a positive integer, 2 is more than or equal to m is less than or equal to 8x 2) n ) Performing linear S-box replacement on sub CRC8 polynomial hashed data for one time, and then performing 2m (m is a positive integer, and m is more than or equal to 2 and less than or equal to 8x 2) n ) sub-CRC 8 polynomial hashing, i.e., at every two 2m (m is a positive integer, 2. Ltoreq. M.ltoreq.8 x2 n ) sub-CRC 8 polynomial with a linear S-box permutation in the middle of the interval until the master key byte is traversed, generating 2 n+4 x256 (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4).
5. The data transmission method of claim 3, wherein: the step 1: the master key generates a static polynomial table through inverse hashing of a kernel function CRC8 in a decryption process, and the method specifically comprises the following steps:
1) Inverse hashing of any type of master key into 128x2 via the kernel function CRC8 n (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4) bits of master key;
2) For 16x2 n (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4) independent main key bytes, and the composition contains 16x2 n (n is a non-negative integer, 0. Ltoreq. N.ltoreq.4) polynomials of kernel function CRC8, where 2m (m is a positive integer, 2. Ltoreq. M.ltoreq.8 x2 is arbitrarily selected n ) 2m CRC8 polynomial inverse hash;
3) For the solution passing through 2m (m is a positive integer, 2 is more than or equal to m is less than or equal to 8x 2) n ) Performing linear S-box replacement on sub-CRC 8 polynomial inverse hashed data for one time, and performing 2m (m is a positive integer, 2 is more than or equal to m and less than or equal to 8x 2) n ) sub-CRC 8 polynomial inverse hashing, i.e., at every two 2m (m is a positive integer, 2. Ltoreq. M.ltoreq.8 x2 n ) sub-CRC 8 polynomial with a linear S-box permutation in the middle of the interval until the master key byte is traversed, generating 2 n+4 x256 (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4).
6. The data transmission method according to claim 1, wherein: the step 2: the continuous rotation of the sub-key into a new sub-key in the encryption or decryption process specifically includes:
1) Generating a sub-key according to the master key;
2) Carrying out XOR operation on the 4-byte sub-key generated according to the master key and a position counter of the plaintext byte which starts to be input to obtain a new sub-key;
3) The new sub-key is divided into sub-key 1, sub-key 2, sub-key 3 and sub-key 4 according to bytes.
7. The data transmission method according to claim 6, wherein: the step 3: and performing index table lookup on the new subkey in a master key static polynomial table for multiple times to complete a byte encryption or decryption task, wherein the task of completing the byte encryption specifically comprises the following steps:
1) Carrying out XOR operation on input plaintext data and the sub-secret key 1;
2) Inputting the result of the XOR operation into a static polynomial table generated by the main key in the encryption process, performing table indexing through the sub-key 2, performing XOR operation with the result of the index table lookup, and performing nonlinear S-box replacement on the result of the XOR operation;
3) Performing exclusive-or operation on the result of the nonlinear S box after replacement and the subkey 3, inputting the result into a static polynomial table generated by the main key in the encryption process, performing table indexing through the subkey 3, and performing exclusive-or operation on the result of table lookup with the index and the subkey 4;
4) Outputting the encrypted ciphertext data;
5) And calling continuous rotation to generate a new sub-key, and repeating the steps 1) -4) until the encryption task is finished.
8. The data transmission method according to claim 6, wherein: the step 3: and performing index table lookup on the new subkey in the static polynomial table of the master key for multiple times to complete the byte encryption or decryption task, wherein the task of completing the byte decryption specifically comprises the following steps:
1) Carrying out XOR operation on the input ciphertext data and the sub-secret key 4;
2) Inputting the result of the exclusive-or operation into a static polynomial table generated by the main key in the decryption process, performing table indexing through the sub-key 3, performing exclusive-or operation on the table indexing result and the table lookup result of the index, and performing nonlinear S-box replacement on the result of the exclusive-or operation;
3) Performing exclusive-or operation on the result after the nonlinear S box replacement and the sub-secret key 2, inputting the result into a static polynomial table generated by the main secret key in a decryption process, performing table indexing through the sub-secret key 2, and performing exclusive-or operation on the result of table lookup with the index and the sub-secret key 1;
4) Outputting the decrypted plaintext data;
5) And calling continuous rotation to generate a new sub-key, and repeating the steps 1) -4) until the decryption task is finished.
9. The data transmission method of claim 1, wherein: the method further comprises the step of hashing an initial key given by a user to obtain a master key with a fixed length before the step 1.
10. The data transmission method of claim 9, wherein: the initial key given by the user is hashed into 128x2 by a kernel function CRCn (n =128, 256, 512, 1024, 2048) n (n is a non-negative integer, n is more than or equal to 0 and less than or equal to 4).
11. The data transmission method according to claim 1, 7 or 8, characterized in that: the subkey is 32 bits.
12. A data transmission device comprising a processor and a memory;
the memory is used for storing;
the processor is configured to execute the data transmission method according to any one of claims 1 to 11 by calling.
13. A computer program product comprising a computer program and/or instructions, characterized in that the computer program and/or instructions, when executed by a processor, implement the data transmission method of any one of claims 1-12.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210881193.0A CN115348018B (en) | 2022-07-26 | 2022-07-26 | Data processing method, device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210881193.0A CN115348018B (en) | 2022-07-26 | 2022-07-26 | Data processing method, device and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115348018A true CN115348018A (en) | 2022-11-15 |
CN115348018B CN115348018B (en) | 2023-05-16 |
Family
ID=83950365
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210881193.0A Active CN115348018B (en) | 2022-07-26 | 2022-07-26 | Data processing method, device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115348018B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118400196A (en) * | 2024-06-27 | 2024-07-26 | 中国人民解放军国防科技大学 | Short text symmetric encryption and decryption method, device, equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5398284A (en) * | 1993-11-05 | 1995-03-14 | United Technologies Automotive, Inc. | Cryptographic encoding process |
CN101262334A (en) * | 2008-04-17 | 2008-09-10 | 中国人民解放军海军工程大学 | Encryption method for Bluetooth data transmission |
CN109274485A (en) * | 2017-07-17 | 2019-01-25 | 科大国盾量子技术股份有限公司 | A kind of data ciphering method, data authentication method and relevant device and system |
CN112311527A (en) * | 2020-09-17 | 2021-02-02 | 裴文耀 | Encryption method for converting master key into polynomial table lattice key lookup |
-
2022
- 2022-07-26 CN CN202210881193.0A patent/CN115348018B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5398284A (en) * | 1993-11-05 | 1995-03-14 | United Technologies Automotive, Inc. | Cryptographic encoding process |
CN101262334A (en) * | 2008-04-17 | 2008-09-10 | 中国人民解放军海军工程大学 | Encryption method for Bluetooth data transmission |
CN109274485A (en) * | 2017-07-17 | 2019-01-25 | 科大国盾量子技术股份有限公司 | A kind of data ciphering method, data authentication method and relevant device and system |
CN112311527A (en) * | 2020-09-17 | 2021-02-02 | 裴文耀 | Encryption method for converting master key into polynomial table lattice key lookup |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118400196A (en) * | 2024-06-27 | 2024-07-26 | 中国人民解放军国防科技大学 | Short text symmetric encryption and decryption method, device, equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN115348018B (en) | 2023-05-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7945049B2 (en) | Stream cipher using multiplication over a finite field of even characteristic | |
CA2723319C (en) | A closed galois field cryptographic system | |
JP4828068B2 (en) | Computer efficient linear feedback shift register | |
KR100296958B1 (en) | Apparatus for encoding block data | |
KR20070039161A (en) | Stream cipher combining system and method | |
CA2578316C (en) | Table splitting for cryptographic processes | |
CN109417468B (en) | Method and device for realizing safe and efficient block cipher algorithm | |
WO2006063275A1 (en) | Method and apparatus for increasing the speed of cryptographic processing | |
US7720225B2 (en) | Table splitting for cryptographic processes | |
US8619985B2 (en) | Table splitting for cryptographic processes | |
KR101095386B1 (en) | A Cryptosystem with a Discretized Chaotic Map | |
Alemami et al. | Advanced approach for encryption using advanced encryption standard with chaotic map | |
CN115348018B (en) | Data processing method, device and storage medium | |
JPH0675525A (en) | Cipher communication equipment | |
JPH10240500A (en) | Random number generator and method, enciphering device and method, decoder and method and stream cipher system | |
KR20190020988A (en) | Computer-executable lightweight white-box cryptographic method and apparatus thereof | |
CN1251444A (en) | Efficient block encryption method | |
Li et al. | A secure and efficient entropy coding based on arithmetic coding | |
Durak et al. | FAST: secure and high performance format-preserving encryption and tokenization | |
Belmeguenai et al. | Speech encryption using stream cipher | |
JP5436373B2 (en) | Confidentiality enhancement processing arithmetic device and quantum cryptography communication terminal equipped with the same | |
Singh et al. | Enhancing AES using novel block key generation algorithm and key dependent S-boxes | |
Mihalkovich et al. | MPF based symmetric cipher performance comparison to AES and TDES | |
Ledda et al. | Enhancing IDEA algorithm using circular shift and middle square method | |
KR101971001B1 (en) | A method of generating random number based on block cipher with whitebox encryption and apparatus thereof |
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 |