CN109981250A - A kind of SM4 encryption, cipher key spreading method, apparatus, equipment and medium - Google Patents

A kind of SM4 encryption, cipher key spreading method, apparatus, equipment and medium Download PDF

Info

Publication number
CN109981250A
CN109981250A CN201910154930.5A CN201910154930A CN109981250A CN 109981250 A CN109981250 A CN 109981250A CN 201910154930 A CN201910154930 A CN 201910154930A CN 109981250 A CN109981250 A CN 109981250A
Authority
CN
China
Prior art keywords
bigsbox
encryption
follows
input
key
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
Application number
CN201910154930.5A
Other languages
Chinese (zh)
Other versions
CN109981250B (en
Inventor
王学进
蒋红宇
安晓江
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Haitai Fangyuan High Technology Co Ltd
Original Assignee
Beijing Haitai Fangyuan High Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Haitai Fangyuan High Technology Co Ltd filed Critical Beijing Haitai Fangyuan High Technology Co Ltd
Priority to CN201910154930.5A priority Critical patent/CN109981250B/en
Publication of CN109981250A publication Critical patent/CN109981250A/en
Application granted granted Critical
Publication of CN109981250B publication Critical patent/CN109981250B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic 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/0618Block 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 a kind of SM4 encryption, cipher key spreading method, apparatus, equipment and media to realize the quick encryption of mass data to optimize SM4 Encryption Algorithm.The SM4 encryption method, comprising: carry out 32 iterative calculation, the iterative calculation using data of the pre-generated round key to 128 bits to be encrypted are as follows:I=0,1 ..., 31, wherein RKiFor pre-generated round key,Indicate XOR operation, the calculation method of the T are as follows: if T input is A,ThenThe iteration result that 32 times are iterated to calculate is as encryption data.

Description

A kind of SM4 encryption, cipher key spreading method, apparatus, equipment and medium
Technical field
The present invention relates to computer security technical field, more particularly, to a kind of SM4 encryption, cipher key spreading method, apparatus, Equipment and medium.
Background technique
SM4 is a block cipher, is mainly used for data encryption, block length and key length are 128 ratios Spy, Encryption Algorithm and key schedule all use 32 wheel nonlinear iteration structures.
In existing SM4 Encryption Algorithm T displacement calculation method be T ()=L (τ ()), wherein nonlinear transformation τ by 4 simultaneously Capable S box is constituted, if input isOutput isThen (b0, b1, b2, b3)=τ A=(Sbox (a0), Sbox (a1), Sbox (a2), Sbox (a3))。
The output of nonlinear transformation τ is the input of linear transformation L, if the input of L isOutput is ThenIt can from above-mentioned calculating process Out, the calculating that T is replaced in existing SM4 Encryption Algorithm needs 4 computation of table lookup, 4 ring shift lefts calculating and 4 XOR operation altogether, Computationally intensive and calculating is complicated.
With application of the password in cloud computing and big data, people propose higher want to the performance of cryptographic algorithm It asks, it is desired to be able to the encryption of mass data is fast implemented, but existing SM4 Encryption Algorithm is computationally intensive and calculates complexity, it can not Meets the needs of mass data quickly encrypts.
Summary of the invention
A kind of SM4 encryption of the embodiment of the present invention, cipher key spreading method, apparatus, equipment and medium, to optimize SM4 encryption Algorithm improves computational efficiency, realizes the quick encryption of mass data.
In a first aspect, the embodiment of the present invention provides a kind of SM4 encryption method, comprising:
32 iterative calculation, iterative calculation are carried out using data of the pre-generated round key to 128 bits to be encrypted Are as follows:Wherein, RKiFor what is pre-generated Round key,Indicate XOR operation, the calculation method of T are as follows: if T input is A, Then
The iteration result that 32 times are iterated to calculate is as encryption data.
SM4 encryption method provided in an embodiment of the present invention, by constructing T1 and T2, by synthesis displacement T in SM4 Encryption Algorithm Calculating decomposed, need to table look-up for 4 times with the linear transformation in existing SM4 Encryption Algorithm, 4 ring shift lefts and 4 exclusive or Operation is compared, and the linear transformation in SM4 Encryption Algorithm is reduced to only need to table look-up twice and an XOR operation, to simplify SM4 Encryption Algorithm improves computational efficiency, and then can be realized the quick encryption of mass data.
In a kind of possible embodiment, in method provided in an embodiment of the present invention, if encryption key Then round key RKiGeneration method are as follows: FK=(FK0, FK1, FK2, FK3) and CK= (CK0, CK1..., CK31) it is fixed constant, the calculation method of T' are as follows: if T' input is A, Then
In a kind of possible embodiment, in method provided in an embodiment of the present invention, T1 [A1]=L1 [BigSbox (A1)], T2 [A2]=L2 [BigSbox (A2)], wherein T1 is calculated by BigSbox and linear transformation L1 composite computing obtains, T2 It is calculated by BigSbox and linear transformation L2 composite computing show that BigSbox, L1 and L2 are computation of table lookup.
In a kind of possible embodiment, in method provided in an embodiment of the present invention, if the input of BigSbox is A1,Then BigSbox (A1)=B1,
Second aspect, the embodiment of the present invention provide a kind of SM4 cipher key spreading method, comprising:
If encryption keyThen round key RKiGeneration method are as follows: FK= (FK0, FK1, FK2, FK3) and CK=(CK0, CK1..., CK31) it is fixed constant, the calculation method of T' are as follows: if T' input is A,Then
SM4 cipher key spreading method provided in an embodiment of the present invention, by constructing T'1 and T'2, by SM4 key schedule The calculating of middle synthesis displacement T' is decomposed, and is tabled look-up, is followed with linear transformation needs 4 times in existing SM4 key schedule for 4 times Ring is moved to left to be compared with 4 XOR operation, and the linear transformation in SM4 key schedule is reduced to only need to table look-up twice and once XOR operation improves computational efficiency to simplify SM4 key schedule, and then can be realized the quick of mass data Encryption.
In a kind of possible embodiment, in method provided in an embodiment of the present invention, T'1 [A1]=L'1 [BigSbox (A1)], T'2 [A2]=L'2 [BigSbox (A2)], wherein T'1 is calculated by BigSbox and linear transformation L'1 composite computing obtains Out, T'2 is calculated by BigSbox and linear transformation L'2 composite computing show that BigSbox, L'1 and L'2 are computation of table lookup.
In a kind of possible embodiment, in method provided in an embodiment of the present invention, if the input of BigSbox is A1,Then BigSbox (A1)=B1,
The third aspect, the embodiment of the present invention provide a kind of SM4 encryption device, comprising:
Computing unit, for carrying out 32 iteration using data of the pre-generated round key to 128 bits to be encrypted It calculates, the iterative calculation are as follows: Wherein, RKiFor pre-generated round key,Indicate XOR operation, the calculation method of the T are as follows: if T input is A,Then
Processing unit, the iteration result for iterating to calculate 32 times is as encryption data.
In a kind of possible embodiment, in device provided in an embodiment of the present invention, if encryption key Then computing unit generates round key with the following method RKi: FK=(FK0, FK1, FK2, FK3) and CK=(CK0, CK1..., CK31) it is fixed constant, the calculation method of T' are as follows: if T' input is A,Then
In a kind of possible embodiment, in device provided in an embodiment of the present invention, T1 [A1]=L1 [BigSbox (A1)], T2 [A2]=L2 [BigSbox (A2)], wherein T1 is calculated by BigSbox and linear transformation L1 composite computing obtains, T2 It is calculated by BigSbox and linear transformation L2 composite computing show that BigSbox, L1 and L2 are computation of table lookup.
In a kind of possible embodiment, in device provided in an embodiment of the present invention, if the input of BigSbox is A1,Then BigSbox (A1)=B1,
Fourth aspect, the embodiment of the present invention provide a kind of SM4 cipher key spreading device, comprising:
Processing unit, in encryption key Under conditions of, round key RK is generated with the following methodi: FK=(FK0, FK1, FK2, FK3) and CK=(CK0, CK1..., CK31) it is fixed constant, the meter of T' Calculation method are as follows: if T' input is A, Then
In a kind of possible embodiment, in device provided in an embodiment of the present invention, T'1 [A1]=L'1 [BigSbox (A1)], T'2 [A2]=L'2 [BigSbox (A2)], wherein T'1 is calculated by BigSbox and linear transformation L'1 composite computing obtains Out, T'2 is calculated by BigSbox and linear transformation L'2 composite computing show that BigSbox, L'1 and L'2 are computation of table lookup.
In a kind of possible embodiment, in device provided in an embodiment of the present invention, if the input of BigSbox is A1,Then BigSbox (A1)=B1,
5th aspect, the embodiment of the present application provide a kind of SM4 password optimization equipment, comprising: at least one processor, extremely A few memory and computer program instructions stored in memory, when computer program instructions are executed by processor Realize the method that the embodiment of the present application first aspect or second aspect provide.
6th aspect, the embodiment of the present application provide a kind of computer readable storage medium, are stored thereon with computer journey Sequence instruction realizes that the embodiment of the present application first aspect or second aspect are provided when computer program instructions are executed by processor Method.
Detailed description of the invention
Fig. 1 is a kind of schematic flow diagram of SM4 encryption method provided in an embodiment of the present invention;
Fig. 2 is a kind of structural schematic diagram of SM4 encryption device provided in an embodiment of the present invention;
Fig. 3 is the structural schematic diagram that a kind of SM4 password provided in an embodiment of the present invention optimizes equipment.
Specific embodiment
With reference to the accompanying drawing, to SM4 provided in an embodiment of the present invention encryption, cipher key spreading method, apparatus, equipment and medium Specific embodiment be described in detail.
As shown in Figure 1, SM4 encryption method provided in an embodiment of the present invention, step may include:
S11,32 iterative calculation, iteration are carried out using data of the pre-generated round key to 128 bits to be encrypted It calculates are as follows:Wherein, RKiFor pre- Mr. At round key,Indicate XOR operation, the calculation method of T are as follows: if T input is A,Then
When it is implemented, round key can be generated using the method for the prior art, it can also be using the following implementations of the present invention The round key extended method that example provides generates, and it is not limited in the embodiment of the present invention.
When it is implemented, if encryption key Then round key RKiGeneration method are as follows: FK=(FK0, FK1, FK2, FK3) and CK=(CK0, CK1..., CK31) it is fixed constant, the calculation method of T ' are as follows: if T' is inputted For A,Then
S12, the iteration result for iterating to calculate 32 times are as encryption data.
When it is implemented, the calculation method derivation process of T is as follows:
In T displacement, T ()=L (τ ()), first against τ, if input is Output isThen (b0, b1, b2, b3)=τ A=(Sbox (a0), Sbox (a1), Sbox (a2), Sbox (a3))。
One 16 bit of construction input the permutation table BigSbox of 16 bits output, and permutation table BigSbox construction is as follows: If the input of BigSbox is A1=(a0, a1), it exports as B1=(b0, b1), wherein a0, a1, b0, b1It is 8 bit bytes, then BigSbox[a0, a1]=(b0, b1), wherein b0=Sbox [a0], b1=Sbox [a1], it can similarly obtain, input as A2=(a2, a3), it exports as B2=(b2, b3), then BigSbox [a2, a3]=(b2, b3)。
It can to sum up obtain, B=(B1, B2)=(b0, b1, b2, b3)=τ A=(BigSbox [a0, a1], BigSbox [a2, a3]), The calculating of τ A needs to look into 2 BigSbox tables.
In T displacement, linear transformation L has the property that hypothesisThen
Assuming that B1, B2,Then According to the property of linear transformationIt is construction two big Small is 216=65536 linear transformation table L1 and L2, this two table inputs are 16 bits, and output is 32 bits, then L1 [B1]=L (B1*65536);L2 [B2]=L (B2).
Combination L1 and BigSbox table obtains T1 table, and combination L2 and BigSbox table obtains T2 table, and specific configuration is as follows: assuming thatThen T1 [a]=L1 [BigSbox [a]];The calculating of T2 [a]=L2 [BigSbox [a]] namely T are as follows: if input ForThen have
In conjunction with the SM4 encryption method that the above embodiment of the present invention provides, the embodiment of the present invention also provides a kind of SM4 key expansion Exhibition method is below described in detail the specific embodiment of the SM4 cipher key spreading method.
A kind of SM4 cipher key spreading method provided in an embodiment of the present invention, specific steps may include:
If encryption keyThen round key RKi's Generation method are as follows: WhereinIndicate exclusive or Operation, FK=(FK0, FK1, FK2, FK3) and CK=(CK0, CK1..., CK31) it is fixed constant, when it is implemented, the meter of T' Calculation method are as follows: if T' input is A,Then
When it is implemented, the calculation method derivation process of T' is as follows:
In T ' displacement, T'()=L'(τ ()), first against τ, if input is Output isThen (b0, b1, b2, b3)=τ A=(Sbox (a0), Sbox (a1), Sbox (a2), Sbox (a3))。
One 16 bit of construction input the permutation table BigSbox of 16 bits output, and permutation table BigSbox construction is as follows: If the input of BigSbox is A1=(a0, a1), it exports as B1=(b0, b1), wherein a0, a1, b0, b1It is 8 bit bytes, then BigSbox[a0, a1]=(b0, b1) wherein b0=Sbox [a0], b1=Sbox [a1], it can similarly obtain, input as A2=(a2, a3), it exports as B2=(b2, b3), then BigSbox [a2, a3]=(b2, b3)。
It can to sum up obtain, B=(B1, B2)=(b0, b1, b2, b3)=τ A=(Big BigSbox [a0, a1], Big BigSbox [a2, a3]), the calculating of τ A needs to look into 2 BigSbox tables.
In T' displacement, linear transformation L' has the property that hypothesisThen
Assuming that B1, B2,Then According to the property of linear transformationConstruction two Size is 216=65536 linear transformation table L'1 and L'2, this two table inputs are 16 bits, and output is 32 bits, then L'1 [B1]=L'(B1*65536);L'2 [B2]=L'(B2).
Combination L'1 and BigSbox table obtains T'1 table, and combination L'2 and BigSbox table obtains T'2 table, and specific configuration is as follows: Assuming thatThen T'1 [a]=L'1 [BigSbox [a]];The calculating of T'2 [a]=L'2 [BigSbox [a]] namely T' Are as follows: it inputs and isThen
Based on identical inventive concept, the embodiment of the present invention also provides a kind of SM4 encryption device.
As shown in Fig. 2, a kind of SM4 encryption device provided in an embodiment of the present invention, comprising:
Computing unit 201, for carrying out 32 times repeatedly using data of the pre-generated round key to 128 bits to be encrypted In generation, calculates, the iterative calculation are as follows: Its In, RKiFor pre-generated round key,Indicate XOR operation, the calculation method of the T are as follows: if T input is A,Then
Processing unit 202, the iteration result for iterating to calculate 32 times is as encryption data.
In a kind of possible embodiment, in device provided in an embodiment of the present invention, if encryption key Then computing unit generates round key with the following method RKi: FK=(FK0, FK1, FK2, FK3) and CK=(CK0, CK1..., CK31) it is fixed constant, the calculation method of T' are as follows: if T' input is A,Then
In a kind of possible embodiment, in device provided in an embodiment of the present invention, T1 [A1]=L1 [BigSbox (A1)], T2 [A2]=L2 [BigSbox (A2)], wherein T1 is calculated by BigSbox and linear transformation L1 composite computing obtains, T2 It is calculated by BigSbox and linear transformation L2 composite computing show that BigSbox, L1 and L2 are computation of table lookup.
In a kind of possible embodiment, in device provided in an embodiment of the present invention, if the input of BigSbox is A1,Then BigSbox (A1)=B1,
The embodiment of the present invention also provides a kind of SM4 cipher key spreading device, comprising:
Processing unit, in encryption key Under conditions of, round key RK is generated with the following methodi: FK=(FK0, FK1, FK2, FK3) and CK=(CK0, CK1..., CK31) it is fixed constant, wherein T' Calculation method are as follows: if T' input be A, Then
In a kind of possible embodiment, in device provided in an embodiment of the present invention, T'1 [A1]=L'1 [BigSbox (A1)], T'2 [A2]=L'2 [BigSbox (A2)], wherein T'1 is calculated by BigSbox and linear transformation L'1 composite computing obtains Out, T'2 is calculated by BigSbox and linear transformation L'2 composite computing show that BigSbox, L'1 and L'2 are computation of table lookup.
In a kind of possible embodiment, in device provided in an embodiment of the present invention, if the input of BigSbox is A1,Then BigSbox (A1)=B1,
In addition, can be by conjunction with the SM4 encryption of Fig. 1-Fig. 2 the embodiment of the present application described, cipher key spreading method and apparatus SM4 password optimizes equipment to realize.The hardware configuration that Fig. 3 shows SM4 password optimization equipment provided by the embodiments of the present application shows It is intended to.
It may include processor 301 and the memory 302 for being stored with computer program instructions that SM4 password, which optimizes equipment,.
Specifically, above-mentioned processor 301 may include central processing unit (CPU) or specific integrated circuit (Application Specific Integrated Circuit, ASIC), or may be configured to implement implementation of the present invention One or more integrated circuits of example.
Memory 302 may include the mass storage for data or instruction.For example it rather than limits, memory 302 may include hard disk drive (Hard Disk Drive, HDD), floppy disk drive, flash memory, CD, magneto-optic disk, tape or logical With the combination of universal serial bus (Universal Serial Bus, USB) driver or two or more the above.It is closing In the case where suitable, memory 302 may include the medium of removable or non-removable (or fixed).In a suitable case, it stores Device 302 can be inside or outside data processing equipment.In a particular embodiment, memory 302 is nonvolatile solid state storage Device.In a particular embodiment, memory 302 includes read-only memory (ROM).In a suitable case, which can be mask ROM, programming ROM (PROM), erasable PROM (EPROM), the electric erasable PROM (EEPROM), electrically-alterable ROM of programming (EAROM) or the combination of flash memory or two or more the above.
Processor 301 is by reading and executing the computer program instructions stored in memory 302, to realize above-mentioned implementation Any one SM4 encryption method or SM4 cipher key spreading method in example.
In one example, SM4 password optimization equipment may also include communication interface 303 and bus 310.Wherein, such as Fig. 3 institute Show, processor 301, memory 302, communication interface 303 connect by bus 310 and complete mutual communication.
Communication interface 303 is mainly used for realizing in the embodiment of the present invention between each module, device, unit and/or equipment Communication.
Bus 310 includes hardware, software or both, and the component of SM4 password optimization equipment is coupled to each other together.Citing For rather than limit, bus may include accelerated graphics port (AGP) or other graphics bus, enhancing Industry Standard Architecture (EISA) Bus, front side bus (FSB), super transmission (HT) interconnection, the interconnection of Industry Standard Architecture (ISA) bus, infinite bandwidth, low pin count (LPC) bus, memory bus, micro- channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, Serial Advanced Technology Attachment (SATA) bus, Video Electronics Standards Association part (VLB) bus or other conjunctions The combination of suitable bus or two or more the above.In a suitable case, bus 310 may include one or more Bus.Although specific bus has been described and illustrated in the embodiment of the present invention, the present invention considers any suitable bus or interconnection.
SM4 password optimization equipment can execute SM4 encryption method or the cipher key spreading side SM4 in the embodiment of the present invention Method, to realize the SM4 encryption method or SM4 cipher key spreading method described in conjunction with Fig. 1.
In addition, in conjunction with the SM4 password optimization method in above-described embodiment, the embodiment of the present invention can provide a kind of computer can Storage medium is read to realize.Computer program instructions are stored on the computer readable storage medium;The computer program instructions Any one SM4 encryption method or SM4 cipher key spreading method in above-described embodiment are realized when being executed by processor.
It should be understood by those skilled in the art that, embodiments herein can provide as method, system or computer program Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the application Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the application, which can be used in one or more, The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces The form of product.
The application is referring to method, the process of equipment (system) and computer program product according to the embodiment of the present application Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates, Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one The step of function of being specified in a box or multiple boxes.
Although the preferred embodiment of the application has been described, it is created once a person skilled in the art knows basic Property concept, then additional changes and modifications can be made to these embodiments.So it includes excellent that the following claims are intended to be interpreted as It selects embodiment and falls into all change and modification of the application range.
Obviously, various changes and modifications can be made to the invention without departing from essence of the invention by those skilled in the art Mind and range.In this way, if these modifications and changes of the present invention belongs to the range of the claims in the present invention and its equivalent technologies Within, then the present invention is also intended to include these modifications and variations.

Claims (10)

1. a kind of SM4 encryption method characterized by comprising
32 iterative calculation, the iterative calculation are carried out using data of the pre-generated round key to 128 bits to be encrypted Are as follows:Wherein, RKiFor what is pre-generated Round key,Indicate XOR operation, the calculation method of the T are as follows: if T input is A,Then
The iteration result that 32 times are iterated to calculate is as encryption data.
2. the method as described in claim 1, which is characterized in that if encryption key Then round key RKiGeneration method are as follows: FK=(FK0, FK1, FK2, FK3) and CK=(CK0, CK1..., CK31) it is fixed constant, the calculation method of T' are as follows: if T' input is A,Then
3. the method as described in claim 1, which is characterized in that T1 [A1]=L1 [BigSbox (A1)], T2 [A2]=L2 [BigSbox (A2)], wherein T1 by BigSbox calculate and linear transformation L1 composite computing obtain, T2 by BigSbox calculate and Linear transformation L2 composite computing show that BigSbox, L1 and L2 are computation of table lookup.
4. method as claimed in claim 3, which is characterized in that if the input of the BigSbox is A1,Then BigSbox (A1)=B1,
5. a kind of SM4 cipher key spreading method characterized by comprising
If encryption keyThen round key RKi's Generation method are as follows: FK =(FK0, FK1, FK2, FK3) and CK=(CK0, CK1..., CK31) it is fixed constant, the calculation method of T' are as follows: if T' input is A,Then
6. method as claimed in claim 5, which is characterized in that T'1 [A1]=L'1 [BigSbox (A1)], T'2 [A2]=L'2 [BigSbox (A2)], wherein T'1 is calculated by BigSbox and linear transformation L'1 composite computing show that T'2 is calculated by BigSbox Show that BigSbox, L'1 and L'2 are computation of table lookup with linear transformation L'2 composite computing.
7. method as claimed in claim 6, which is characterized in that if the input of the BigSbox is A1,Then BigSbox (A1)=B1,
8. a kind of SM4 encryption device, which is characterized in that described device includes:
Computing unit, for carrying out 32 iterative calculation using data of the pre-generated round key to 128 bits to be encrypted, The iterative calculation are as follows: Wherein, RKiIt is pre- The round key first generated,Indicate XOR operation, the calculation method of the T are as follows: if T input is A,Then
Processing unit, the iteration result for iterating to calculate 32 times is as encryption data.
9. device as claimed in claim 8, which is characterized in that if encryption key Then the computing unit generates round key RK with the following methodi: FK=(FK0, FK1, FK2, FK3) and CK=(CK0, CK1..., CK31) it is fixed constant, the calculation method of T' are as follows: if T' input is A,Then
10. a kind of SM4 cipher key spreading device, which is characterized in that described device includes:
Processing unit, in encryption key 's Under the conditions of, round key RK is generated with the following methodi: FK=(FK0, FK1, FK2, FK3) and CK=(CK0, CK1..., CK31) it is fixed constant, the meter of T' Calculation method are as follows: if T' input is A,Then
CN201910154930.5A 2019-03-01 2019-03-01 SM4 encryption and key expansion method, device, equipment and medium Active CN109981250B (en)

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 true CN109981250A (en) 2019-07-05
CN109981250B 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)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111736902A (en) * 2020-07-16 2020-10-02 北京炼石网络技术有限公司 Parallel computing method and device of SM4 based on SIMD (Single instruction multiple data) instructions and readable storage medium
CN115801227A (en) * 2022-11-10 2023-03-14 北京海泰方圆科技股份有限公司 Method and device for generating substitution table

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160094340A1 (en) * 2014-09-26 2016-03-31 Intel Corporation Instructions and logic to provide simd sm4 cryptographic block cipher functionality
CN105577363A (en) * 2016-01-29 2016-05-11 江苏沁恒股份有限公司 Extensible pipelined circuit aiming at SM4 cryptographic algorithm and implementation method thereof
CN106209358A (en) * 2016-07-12 2016-12-07 黑龙江大学 A kind of SM4 key schedule based on long key realize system and method
CN106712930A (en) * 2017-01-24 2017-05-24 北京炼石网络技术有限公司 SM4 encryption method and device
CN108123792A (en) * 2017-12-19 2018-06-05 武汉瑞纳捷电子技术有限公司 A kind of power consumption method for scrambling of SM4 algorithms circuit

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160094340A1 (en) * 2014-09-26 2016-03-31 Intel Corporation Instructions and logic to provide simd sm4 cryptographic block cipher functionality
US20170033928A1 (en) * 2014-09-26 2017-02-02 Intel Corporation Instructions and logic to provide simd sm4 cryptographic block cipher functionality
CN105577363A (en) * 2016-01-29 2016-05-11 江苏沁恒股份有限公司 Extensible pipelined circuit aiming at SM4 cryptographic algorithm and implementation method thereof
CN106209358A (en) * 2016-07-12 2016-12-07 黑龙江大学 A kind of SM4 key schedule based on long key realize system and method
CN106712930A (en) * 2017-01-24 2017-05-24 北京炼石网络技术有限公司 SM4 encryption method and device
CN108123792A (en) * 2017-12-19 2018-06-05 武汉瑞纳捷电子技术有限公司 A kind of power consumption method for scrambling of SM4 algorithms circuit

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111736902A (en) * 2020-07-16 2020-10-02 北京炼石网络技术有限公司 Parallel computing method and device of SM4 based on SIMD (Single instruction multiple data) instructions and readable storage medium
CN115801227A (en) * 2022-11-10 2023-03-14 北京海泰方圆科技股份有限公司 Method and device for generating substitution table

Also Published As

Publication number Publication date
CN109981250B (en) 2020-04-07

Similar Documents

Publication Publication Date Title
KR100296958B1 (en) Apparatus for encoding block data
CN111464308B (en) Method and system for realizing reconstruction of multiple Hash algorithms
US20140233727A1 (en) Method for secure substring search
US20030081769A1 (en) Non-algebraic method of encryption and decryption
JP2008295108A (en) Secure encryption method and device
EP3384628A1 (en) Adding privacy to standard credentials
KR20130045333A (en) Asymmetrical chaotic encryption
WO2016088453A1 (en) Encryption apparatus, decryption apparatus, cryptography processing system, encryption method, decryption method, encryption program, and decryption program
EP2991264B1 (en) Encrypted text matching system, method and program
CN109981250A (en) A kind of SM4 encryption, cipher key spreading method, apparatus, equipment and medium
KR20200070090A (en) Apparatus for processing non-polynomial operation on encrypted messages and methods thereof
CN112383389B (en) Block chain random number generation method and system
EP3032523B1 (en) Information processing device, program, and storage medium
JPWO2017056150A1 (en) Message authenticator generating apparatus, message authenticator generating method, and message authenticator generating program
WO2019043921A1 (en) Encryption device, decryption device, encryption method, decryption method, encryption program, and decryption program
KR102033351B1 (en) Computer-executable lightweight white-box cryptographic method and apparatus thereof
CN109660328A (en) Symmetric block encryption method, apparatus, equipment and medium
CN114830211A (en) Secret random number generation system, secret calculation device, secret random number generation method, and program
CN113098675A (en) Binary data encryption system and method based on polynomial complete homomorphism
CN108234108B (en) High-efficiency de-ordering encryption method for weak leakage
CN107835070B (en) Simple embedded encryption method
Dobraunig et al. Differential cryptanalysis of SipHash
KR20040041186A (en) Hyperelliptic curve crtpto processor hardware apparatus
KR102045843B1 (en) Method and apparatus for block encryption algorithm
KR101428770B1 (en) Apparatus and method for performing compression operation in hash algorithm

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