CN109981250B - SM4 encryption and key expansion method, device, equipment and medium - Google Patents
SM4 encryption and key expansion method, device, equipment and medium Download PDFInfo
- Publication number
- CN109981250B CN109981250B CN201910154930.5A CN201910154930A CN109981250B CN 109981250 B CN109981250 B CN 109981250B CN 201910154930 A CN201910154930 A CN 201910154930A CN 109981250 B CN109981250 B CN 109981250B
- Authority
- CN
- China
- Prior art keywords
- bigsbox
- input
- calculation
- key
- encrypted
- 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
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Storage Device Security (AREA)
Abstract
The embodiment of the invention discloses SM4 encryption and key expansion methods, devices, equipment and media, which are used for optimizing an SM4 encryption algorithm and realizing rapid encryption of mass data. The SM4 encryption method, packageComprises the following steps: carrying out 32 times of iterative computation on 128-bit data to be encrypted by using a pre-generated round key, wherein the iterative computation comprises the following steps:i is 0, 1, …, 31, where RKiFor the purpose of the pre-generated round key,the calculation method of T is as follows: if the T input is a, then,thenAnd taking the iteration result of 32 iteration calculations as the encrypted data.
Description
Technical Field
The invention relates to the technical field of computer security, in particular to a method, a device, equipment and a medium for SM4 encryption and key expansion.
Background
The SM4 is a block cipher algorithm, mainly used for data encryption, the block length and the key length are both 128 bits, and both the encryption algorithm and the key expansion algorithm adopt 32-round nonlinear iteration structures.
A conventional method for calculating T permutation in SM4 encryption algorithm is T (·) ═ L (τ (·)), where a nonlinear transformation τ is composed of 4 parallel S boxes, and the input is assumed to beOutput is asThen (b)0,b1,b2,b3)=τA=(Sbox(a0),Sbox(a1),Sbox(a2),Sbox(a3))。
The output of the non-linear transformation τ is the input of the linear transformation L, let L beOutput is asThenAs can be seen from the above calculation process, the calculation of T permutation in the existing SM4 encryption algorithm needs 4 times of table lookup calculation, 4 times of round left shift calculation, and 4 times of xor operation, and the calculation amount is large and the calculation is complex.
With the application of passwords in cloud computing and big data, people put higher requirements on the performance of a password algorithm, and expect to realize the encryption of mass data quickly, but the existing SM4 encryption algorithm has large calculation amount and complex calculation and cannot meet the requirement of quick encryption of mass data.
Disclosure of Invention
The embodiment of the invention discloses a method, a device, equipment and a medium for SM4 encryption and key expansion, which are used for optimizing an SM4 encryption algorithm, improving the calculation efficiency and realizing the rapid encryption of mass data.
In a first aspect, an embodiment of the present invention provides an SM4 encryption method, including:
carrying out 32 times of iterative computation on 128-bit data to be encrypted by using a pre-generated round key, wherein the iterative computation comprises the following steps:i is 0, 1, …, 31, where RKiFor the purpose of the pre-generated round key,the calculation method of T is as follows: if the T input is a, then, then
And taking the iteration result of 32 iteration calculations as the encrypted data.
According to the SM4 encryption method provided by the embodiment of the invention, the calculation of the synthesis and replacement T in the SM4 encryption algorithm is decomposed by constructing the T1 and the T2, and compared with the linear transformation in the existing SM4 encryption algorithm which needs 4 times of table lookup, 4 times of circulation left shift and 4 times of XOR operation, the linear transformation in the SM4 encryption algorithm is simplified into the method which only needs two times of table lookup and one time of XOR operation, so that the SM4 encryption algorithm is simplified, the calculation efficiency is improved, and the rapid encryption of mass data can be realized.
In a possible implementation manner, in the method provided in the embodiment of the present invention, if the key is encrypted Then the round key RKiThe generation method comprises the following steps: i=0,1,…,31,FK=(FK0,FK1,FK2,FK3) And CK ═ CK (CK)0,CK1,…,CK31) All are fixed constants, and the calculation method of T' is as follows: if the T' input is a,then
In one possible embodiment, the method provided by the present example includes T1[ a1] ═ L1[ BigSbox (a1) ], T2[ a2] ═ L2[ BigSbox (a2) ], where T1 is obtained by combining BigSbox calculation with linear transformation L1, T2 is obtained by combining BigSbox calculation with linear transformation L2, and BigSbox, L1, and L2 are all table lookup calculations.
In one possible implementation, embodiments of the present invention provide a method wherein, if the input to the BigSbox is a1,then BigSbox (a1) ═ B1,
in a second aspect, an embodiment of the present invention provides an SM4 key expansion method, including:
if the key is encryptedThen the round key RKiThe generation method comprises the following steps: i=0,1,…,31,FK=(FK0,FK1,FK2,FK3) And CK ═ CK (CK)0,CK1,…,CK31) All are fixed constants, and the calculation method of T' is as follows: if the T' input is a,then
According to the SM4 key expansion method provided by the embodiment of the invention, the calculation of synthesizing and replacing T ' in the SM4 key expansion algorithm is decomposed by constructing T '1 and T '2, and compared with the linear transformation in the existing SM4 key expansion algorithm which needs 4 times of table lookup, 4 times of circulation left shift and 4 times of XOR operation, the linear transformation in the SM4 key expansion algorithm is simplified into the linear transformation which only needs two times of table lookup and one time of XOR operation, so that the SM4 key expansion algorithm is simplified, the calculation efficiency is improved, and the rapid encryption of mass data can be realized.
In one possible embodiment, the method provided by the embodiments of the present invention includes that T '1[ a1] ═ L'1[ BigSbox (a1) ], T '2[ a2] ═ L'2[ BigSbox (a2) ], where T '1 is obtained by combining BigSbox calculation and linear transformation L'1, T '2 is obtained by combining BigSbox calculation and linear transformation L'2, and BigSbox, L '1, and L'2 are all table lookup calculations.
In one possible implementation, embodiments of the present invention provide a method wherein, if the input to the BigSbox is a1,then BigSbox (a1) ═ B1,
in a third aspect, an embodiment of the present invention provides an SM4 encryption apparatus, including:
a calculating unit, configured to perform 32 iterative computations on 128-bit data to be encrypted by using a pre-generated round key, where the iterative computations are:i is 0, 1, …, 31, where RKiFor the purpose of the pre-generated round key,the calculation method of T is as follows: if the T input is a, then,then
And the processing unit is used for taking the iteration result of the 32 times of iterative computation as the encrypted data.
In a possible implementation manner, in the apparatus provided in this embodiment of the present invention, if the key is encrypted The calculation unit generates the round key RK in the following wayi: i=0,1,…,31,FK=(FK0,FK1,FK2,FK3) And CK ═ CK (CK)0,CK1,…,CK31) All are fixed constants, and the calculation method of T' is as follows: if the T' input is a,then
In one possible implementation, in the apparatus provided by the embodiment of the present invention, T1[ a1] ═ L1[ BigSbox (a1) ], T2[ a2] ═ L2[ BigSbox (a2) ], where T1 is obtained by combining BigSbox calculation and linear transformation L1, T2 is obtained by combining BigSbox calculation and linear transformation L2 calculation, and BigSbox, L1, and L2 are all table lookup calculations.
In one possible implementation, in the apparatus provided in the embodiments of the present invention, if the input of BigSbox is a1,then BigSbox (a1) ═ B1,
in a fourth aspect, an embodiment of the present invention provides an SM4 key expansion apparatus, including:
a processing unit for encrypting the keyUnder the condition of (1), a round key RK is generated by adopting the following methodi: i=0,1,…,31,FK=(FK0,FK1,FK2,FK3) And CK ═ CK (CK)0,CK1,…,CK31) All are fixed constants, and the calculation method of T' is as follows: if the T' input is a, then
In one possible implementation, in the apparatus provided in this embodiment of the present invention, T '1[ a1] ═ L'1[ BigSbox (a1) ], T '2[ a2] ═ L'2[ BigSbox (a2) ], where T '1 is obtained by combining BigSbox calculation and linear transformation L'1, T '2 is obtained by combining BigSbox calculation and linear transformation L'2, and BigSbox, L '1, and L'2 are all table lookup calculations.
In one possible implementation, in the apparatus provided in the embodiments of the present invention, if the input of BigSbox is a1,then BigSbox (a1) ═ B1,
in a fifth aspect, an embodiment of the present application provides an SM4 password optimization apparatus, including: the apparatus may include at least one processor, at least one memory, and computer program instructions stored in the memory, which when executed by the processor, implement the method provided by the first or second aspect of an embodiment of the present application.
In a sixth aspect, embodiments of the present application provide a computer-readable storage medium, on which computer program instructions are stored, which, when executed by a processor, implement the method provided by the first aspect or the second aspect of the embodiments of the present application.
Drawings
Fig. 1 is a schematic flow chart of an SM4 encryption method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an SM4 encryption device according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an SM4 password optimization device according to an embodiment of the present invention.
Detailed Description
The following describes in detail specific embodiments of SM4 encryption and key expansion methods, apparatuses, devices, and media according to embodiments of the present invention with reference to the accompanying drawings.
As shown in fig. 1, the SM4 encryption method provided by the embodiment of the present invention may include the following steps:
s11, performing 32 times of iterative computations on the 128-bit data to be encrypted by using the pre-generated round key, where the iterative computations are as follows:i is 0, 1, …, 31, where RKiFor the purpose of the pre-generated round key,the calculation method of T is as follows: if the T input is a, then,then
In specific implementation, the round key may be generated by using a method in the prior art, or may be generated by using a round key expansion method provided in the following embodiment of the present invention, which is not limited in this embodiment of the present invention.
In practice, if the key is encrypted Then the round key RKiThe generation method comprises the following steps: i=0,1,…,31,FK=(FK0,FK1,FK2,FK3) And CK ═ CK (CK)0,CK1,…,CK31) All are fixed constants, and the calculation method of T' is as follows: if the T' input is a,then
And S12, taking the iteration result of 32 iteration calculations as encrypted data.
In specific implementation, the derivation process of the T calculation method is as follows:
in T substitution, T (·) ═ L (τ (·)), first, for τ, the input is assumed to beOutput is asThen (b)0,b1,b2,b3)=τA=(Sbox(a0),Sbox(a1),Sbox(a2),Sbox(a3))。
Constructing a 16-bit input and 16-bit output substitution table BigSbox, wherein the substitution table BigSbox is constructed as follows: let the input of BigSbox be a1 ═ a0,a1) The output is B1 ═ B0,b1) Wherein a is0,a1,b0,b1All are 8-bit bytes, BigSbox [ a ]0,a1]=(b0,b1) Wherein b is0=Sbox[a0],b1=Sbox[a1]For the same reason, the input is a2 ═ a2,a3) The output is B2 ═ B2,b3) Then BigSbox [ a ]2,a3]=(b2,b3)。
In summary, B ═ (B1, B2) ═ B (B) can be obtained0,b1,b2,b3)=τA=(BigSbox[a0,a1],BigSbox[a2,a3]) The calculation of τ a requires 2 table lookups of the BigSbox.
Suppose thatThen According to the nature of the linear transformationTwo sizes of the structure are 216Linear transformation tables L1 and L2 of 65536, both 16-bit input and 32-bit output, L1[ B1 ]]=L(B1*65536);L2[B2]=L(B2)。
Combining the L1 and BigSbox tables gives Table T1 and combining the L2 and BigSbox tables gives Table T2, the specific construction being as follows: suppose thatThen T1[ a ]]=L1[BigSbox[a]];T2[a]=L2[BigSbox[a]]I.e. T is calculated as: if the input isThen there is
In combination with the SM4 encryption method provided in the above embodiment of the present invention, an embodiment of the present invention further provides an SM4 key expansion method, and a specific implementation of the SM4 key expansion method is described in detail below.
The SM4 key expansion method provided by the embodiment of the invention comprises the following specific steps:
if the key is encryptedThen the round key RKiThe generation method comprises the following steps: i is 0, 1, …, 31, whereinDenotes an exclusive or operation, FK ═ FK0,FK1,FK2,FK3) And CK ═ CK (CK)0,CK1,…,CK31) All are fixed constants, and when the method is implemented specifically, the calculation method of T' is as follows: if the T' input is a,then
In specific implementation, the derivation process of the calculation method of T' is as follows:
in the T ' substitution, T ' (·) L ' (τ (·)), first, for τ, the input is assumed to be Output is asThen (b)0,b1,b2,b3)=τA=(Sbox(a0),Sbox(a1),Sbox(a2),Sbox(a3))。
Constructing a 16-bit input and 16-bit output substitution table BigSbox, wherein the substitution table BigSbox is constructed as follows: let the input of BigSbox be a1 ═ a0,a1) The output is B1 ═ B0,b1) Wherein a is0,a1,b0,b1All are 8-bit bytes, BigSbox [ a ]0,a1]=(b0,b1) In which b is0=Sbox[a0],b1=Sbox[a1]For the same reason, the input is a2 ═ a2,a3) The output is B2 ═ B2,b3) Then BigSbox [ a ]2,a3]=(b2,b3)。
In summary, B ═ (B1, B2) ═ B (B) can be obtained0,b1,b2,b3)=τA=(Big BigSbox[a0,a1],Big BigSbox[a2,a3]),Tau A calculation requires 2 BigSbox tables.
Suppose thatThen According to the nature of the linear transformationTwo sizes of the structure are 216When the linear transformation tables L '1 and L '2 of 65536, both of which have 16 bits input and 32 bits output, are used, L '1[ B1 []=L'(B1*65536);L'2[B2]=L'(B2)。
Combining the L '1 and BigSbox tables to obtain a T'1 table, and combining the L '2 and BigSbox tables to obtain a T'2 table, wherein the specific structure is as follows: suppose thatThen T'1[ a ]]=L'1[BigSbox[a]];T'2[a]=L'2[BigSbox[a]]I.e. T' is calculated as: input is asThen
Based on the same inventive concept, the embodiment of the invention also provides an SM4 encryption device.
As shown in fig. 2, an SM4 encryption apparatus provided in an embodiment of the present invention includes:
a calculating unit 201, configured to perform 32 iterative computations on 128 bits of data to be encrypted by using a pre-generated round key, where the iterative computations are:i is 0, 1, …, 31, where RKiFor the purpose of the pre-generated round key,the calculation method of T is as follows: if the T input is a, then,then
And the processing unit 202 is used for taking an iteration result of the 32 iteration calculations as the encrypted data.
In a possible implementation manner, in the apparatus provided in this embodiment of the present invention, if the key is encrypted The calculation unit generates the round key RK in the following wayi: i=0,1,…,31,FK=(FK0,FK1,FK2,FK3) And CK ═ CK (CK)0,CK1,…,CK31) All are fixed constants, and the calculation method of T' is as follows: if the T' input is a,then
In one possible implementation, in the apparatus provided by the embodiment of the present invention, T1[ a1] ═ L1[ BigSbox (a1) ], T2[ a2] ═ L2[ BigSbox (a2) ], where T1 is obtained by combining BigSbox calculation and linear transformation L1, T2 is obtained by combining BigSbox calculation and linear transformation L2 calculation, and BigSbox, L1, and L2 are all table lookup calculations.
In one possible implementation, in the apparatus provided in the embodiments of the present invention, if the input of BigSbox is a1,then BigSbox (a1) ═ B1,
an embodiment of the present invention further provides an SM4 key expansion apparatus, including:
a processing unit for encrypting the key Under the condition of (1), a round key RK is generated by adopting the following methodi: i=0,1,…,31,FK=(FK0,FK1,FK2,FK3) And CK ═ CK (CK)0,CK1,…,CK31) Are all fixed constantThe method for calculating T' comprises the following steps: if the T' input is a, then
In one possible implementation, in the apparatus provided in this embodiment of the present invention, T '1[ a1] ═ L'1[ BigSbox (a1) ], T '2[ a2] ═ L'2[ BigSbox (a2) ], where T '1 is obtained by combining BigSbox calculation and linear transformation L'1, T '2 is obtained by combining BigSbox calculation and linear transformation L'2, and BigSbox, L '1, and L'2 are all table lookup calculations.
In one possible implementation, in the apparatus provided in the embodiments of the present invention, if the input of BigSbox is a1,then BigSbox (a1) ═ B1,
in addition, the SM4 encryption and key expansion methods and apparatuses of the embodiments of the present application described in connection with fig. 1-2 can be implemented by an SM4 password optimization device. Fig. 3 shows a hardware structure diagram of an SM4 password optimization device provided in an embodiment of the present application.
The SM4 password optimization device may include a processor 301 and a memory 302 having stored computer program instructions.
In particular, the processor 301 may include a Central Processing Unit (CPU), or an Application Specific Integrated Circuit (ASIC), or may be configured as one or more Integrated circuits implementing embodiments of the present invention.
The processor 301 implements any one of the SM4 encryption methods or the SM4 key expansion method in the above embodiments by reading and executing computer program instructions stored in the memory 302.
In one example, the SM4 password optimization device may also include a communication interface 303 and a bus 310. As shown in fig. 3, the processor 301, the memory 302, and the communication interface 303 are connected via a bus 310 to complete communication therebetween.
The communication interface 303 is mainly used for implementing communication between modules, apparatuses, units and/or devices in the embodiment of the present invention.
The bus 310 includes hardware, software, or both that couple the components of the SM4 cryptographic optimization device to one another. By way of example, and not limitation, a bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hypertransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an infiniband interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a video electronics standards association local (VLB) bus, or other suitable bus or a combination of two or more of these. Bus 310 may include one or more buses, where appropriate. Although specific buses have been described and shown in the embodiments of the invention, any suitable buses or interconnects are contemplated by the invention.
The SM4 password optimization device may perform the SM4 encryption method or the SM4 key expansion method in the embodiment of the present invention, thereby implementing the SM4 encryption method or the SM4 key expansion method described in conjunction with fig. 1.
In addition, in combination with the SM4 password optimization method in the foregoing embodiments, embodiments of the present invention may provide a computer-readable storage medium to implement. The computer readable storage medium having stored thereon computer program instructions; the computer program instructions, when executed by a processor, implement any one of the SM4 encryption methods or the SM4 key expansion method of the above embodiments.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. 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 means 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 instruction means 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 the preferred embodiments of the present application 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. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application.
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 claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.
Claims (16)
1. An SM4 encryption method, comprising:
carrying out 32 times of iterative computation on 128-bit data to be encrypted by using a pre-generated round key, wherein the iterative computation comprises the following steps:wherein, Xi、Xi+1、Xi+2、Xi+3For input data of the ith iteration, Xi+4For output data of the ith iteration, RKiFor the purpose of the pre-generated round key,the calculation method of T is as follows: if the T input is a, then,thenWherein A1, Represents a 16-bit binary integer;
and taking the iteration result of 32 iteration calculations as the encrypted data.
2. The method of claim 1, wherein the key is encrypted if it is encrypted Then the round key RKiThe generation method comprises the following steps: FK=(FK0,FK1,FK2,FK3) And CK ═ CK (CK)0,CK1,…,CK31) All being fixed constants, TThe calculation method comprises the following steps: if the T' input is a,then
3. The method of claim 1, wherein T1[ a1] ═ L1[ BigSbox (a1) ], T2[ a2] ═ L2[ BigSbox (a2) ], wherein T1 is computed from a complex of BigSbox computations and linear transforms L1, T2 is computed from a complex of BigSbox computations and linear transforms L2, and wherein BigSbox, L1, and L2 are each computed as a look-up table.
5. An SM4 key expansion method, comprising:
if the key is encryptedThen the round key RKiIs generated byThe method comprises the following steps: FK=(FK0,FK1,FK2,FK3) And CK ═ CK (CK)0,CK1,…,CK31) All are fixed constants, and the calculation method of T' is as follows: if the T' input is a,then Wherein A1, Representing a 16-bit binary integer.
6. The method of claim 5, wherein T '1[ a1] ═ L'1[ BigSbox (a1) ], T '2[ a2] ═ L'2[ BigSbox (a2) ], wherein T '1 is derived from a complex calculation of BigSbox and a linear transformation L'1, T '2 is derived from a complex calculation of BigSbox and a linear transformation L'2, and wherein BigSbox, L '1 and L'2 are each table lookup calculations.
8. An SM4 encryption apparatus, the apparatus comprising:
a calculating unit, configured to perform 32 iterative computations on 128-bit data to be encrypted by using a pre-generated round key, where the iterative computations are: wherein, Xi、Xi+1、Xi+2、Xi+3For input data of the ith iteration, Xi+4For output data of the ith iteration, RKiFor the purpose of the pre-generated round key,the calculation method of T is as follows: if the T input is a, then,thenWherein A1, Represents a 16-bit binary integer;
and the processing unit is used for taking the iteration result of the 32 times of iterative computation as the encrypted data.
10. The apparatus of claim 8, wherein T1[ a1] ═ L1[ BigSbox (a1) ], T2[ a2] ═ L2[ BigSbox (a2) ], wherein T1 is derived from a complex calculation of BigSbox and a linear transformation L1, T2 is derived from a complex calculation of BigSbox and a linear transformation L2, and wherein BigSbox, L1, and L2 are each table lookup calculations.
12. An SM4 key expansion apparatus, characterized in that the apparatus comprises:
a processing unit for encrypting the keyUnder the condition of (1), a round key RK is generated by adopting the following methodi: FK=(FK0,FK1,FK2,FK3) And CK ═ CK (CK)0,CK1,…,CK31) All are fixed constants, and the calculation method of T' is as follows: if the T' input is a,thenWherein A1, Representing a 16-bit binary integer.
13. The apparatus of claim 12, wherein T '1[ a1] ═ L'1[ BigSbox (a1) ], T '2[ a2] ═ L'2[ BigSbox (a2) ], wherein T '1 is derived from a complex calculation of BigSbox and a linear transformation L'1, T '2 is derived from a complex calculation of BigSbox and a linear transformation L'2, and wherein BigSbox, L '1 and L'2 are each table lookup calculations.
15. An SM4 password optimization device, comprising: at least one processor, at least one memory, and computer program instructions stored in the memory, which when executed by the processor, implement the method of any of claims 1-4 or the method of any of claims 5-7.
16. A computer readable storage medium having computer program instructions stored thereon, which when executed by a processor implement the method of any of claims 1-4 or the method of any of claims 5-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910154930.5A CN109981250B (en) | 2019-03-01 | 2019-03-01 | SM4 encryption and key expansion method, device, equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910154930.5A CN109981250B (en) | 2019-03-01 | 2019-03-01 | SM4 encryption and key expansion method, device, equipment and medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109981250A CN109981250A (en) | 2019-07-05 |
CN109981250B true CN109981250B (en) | 2020-04-07 |
Family
ID=67077520
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910154930.5A Active CN109981250B (en) | 2019-03-01 | 2019-03-01 | SM4 encryption and key expansion method, device, equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109981250B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111736902B (en) * | 2020-07-16 | 2022-04-19 | 北京炼石网络技术有限公司 | Parallel computing method and device of SM4 based on SIMD (Single instruction multiple data) instructions and readable storage medium |
CN115801227B (en) * | 2022-11-10 | 2023-07-21 | 北京海泰方圆科技股份有限公司 | Method and device for generating substitution table |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9467279B2 (en) * | 2014-09-26 | 2016-10-11 | Intel Corporation | Instructions and logic to provide SIMD SM4 cryptographic block cipher functionality |
CN105577363B (en) * | 2016-01-29 | 2018-06-01 | 江苏沁恒股份有限公司 | For the Extensible pipeline circuit and its implementation of SM4 cryptographic algorithms |
CN106209358B (en) * | 2016-07-12 | 2019-03-12 | 黑龙江大学 | A kind of realization system and method for the SM4 key schedule based on long key |
CN106712930A (en) * | 2017-01-24 | 2017-05-24 | 北京炼石网络技术有限公司 | SM4 encryption method and device |
CN108123792B (en) * | 2017-12-19 | 2021-05-18 | 武汉瑞纳捷电子技术有限公司 | Power consumption scrambling method of SM4 algorithm circuit |
-
2019
- 2019-03-01 CN CN201910154930.5A patent/CN109981250B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN109981250A (en) | 2019-07-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11733966B2 (en) | Protection system and method | |
EP3559811B1 (en) | Protecting parallel multiplication operations from external monitoring attacks | |
US7908641B2 (en) | Modular exponentiation with randomized exponent | |
CN110995420A (en) | Data processing method and system | |
CN114175572B (en) | System and method for performing equal and less operations on encrypted data using a quasi-group operation | |
CN108270550B (en) | Safe and efficient white box implementation method and device based on SM4 algorithm | |
JP6575532B2 (en) | Encryption device, decryption device, encryption processing system, encryption method, decryption method, encryption program, and decryption program | |
US11436946B2 (en) | Encryption device, encryption method, decryption device, and decryption method | |
CN109981250B (en) | SM4 encryption and key expansion method, device, equipment and medium | |
CN112464258B (en) | Data encryption and decryption methods, devices, equipment and storage medium | |
JP6044738B2 (en) | Information processing apparatus, program, and storage medium | |
CN108259506A (en) | SM2 whitepack password implementation methods | |
EP3020159A1 (en) | Electronic signature system | |
CN113098675A (en) | Binary data encryption system and method based on polynomial complete homomorphism | |
CN112636903A (en) | Construction method, encryption method, decryption method, device, equipment and storage medium | |
CN116561787A (en) | Training method and device for visual image classification model and electronic equipment | |
US20110103578A1 (en) | Systems and methods for efficiently creating digests of digital data | |
Arunachalam et al. | FPGA implementation of time-area-efficient Elliptic Curve Cryptography for entity authentication | |
CN116633526A (en) | Data processing method, device, equipment and medium | |
JP2009169316A (en) | Hash function operational device, signature device, program and hash function operational method | |
CN114826560B (en) | Lightweight block cipher CREF implementation method and system | |
CN112887097A (en) | Signature method based on SM2 elliptic curve, related device and storage medium | |
EP3419213A1 (en) | Computer implemented method, computer system and computer readable computer program product | |
CN115065470B (en) | Data transmission method and device | |
KR102510077B1 (en) | Apparatus and method for performing operation being secure against side channel attack |
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 |