Secret key packaging method based on number-theory transformation variant optimization of new modular multiplication algorithm
By optimizing the modular multiplication algorithm in the key encapsulation mechanism, the problem of high CPU count value during key encapsulation in the grid-based cryptographic system is solved, and more efficient key encapsulation efficiency is achieved.
Patent Information
- Application Number
- CN202410945626.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2024-11-12
AI Technical Summary
In the existing grid-based cryptographic system, the number theory transformation algorithms (such as Kyber and NewHope) have high CPU count values during key encapsulation, resulting in inefficiency. The previous optimizations are mainly focused on the hardware structure, and there is a lack of general software optimization. plan.
Using the number theory transformation transformation optimization method based on the new modular multiplication algorithm, two-byte multiplication is optimized to single-byte multiplication, and two double-byte addition is optimized to single-byte plus one Add and delete subtraction operations to reduce the CPU cycle count value and improve the efficiency of key packaging.
In the key encapsulation mechanism, the CPU cycle count value is significantly reduced, the efficiency of key encapsulation is improved, the computational amount is reduced, and more efficient key generation, encryption and decryption processes are achieved.
Smart Images

Figure CN118944868A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of key encapsulation, and in particular relates to a key encapsulation method based on number theory transformation variant optimization of a new modular multiplication algorithm. Background Art
[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.
[0003] The key encapsulation method can be used as a reliable and efficient encryption method in application fields such as finance, e-commerce and government departments to ensure relevant security rights and privacy information.
[0004] Currently, most lattice-based post-quantum algorithm construction processes apply number theory transformations and their related algorithms, including key encapsulation mechanisms: Kyber and NewHope algorithms.
[0005] The Kyber cryptographic encapsulation method was initially proposed and constructed using the number theoretic transform (NTT) algorithm based on the classic butterfly structure. In this scheme, the degree of the polynomial is denoted by n, and the modulus is denoted by Q. Both must satisfy the restriction of the relationship Q≡1 mod 2n. Therefore, the value of Q in the lattice-based cryptographic scheme must be relatively large, which may lead to excessive bandwidth in actual application construction. Later, the Preprocess-then-NTT (PtNTT) and KNTT algorithms were successively proposed to relax the restriction of the relationship to Q≡1 mod n;
[0006] The development background of the NewHope cryptographic encapsulation method is basically similar to that of Kyber. The differences include the different parameters of n and Q, and the restriction relationship after PtNTT optimization is Q≡1 mod n / 2.
[0007] Compared with the previous cryptographic system construction, the CPU count values consumed during the construction under these two number theory transformation variant algorithms are basically the same or even higher, which reduces the efficiency of key encapsulation.
[0008] In the implementation of the original algorithm of the NewHope cryptographic mechanism, the performance of the NTT algorithm depends largely on the optimization of its external structure and internal modular multiplication algorithm. From the perspective of the NTT internal modular multiplication algorithm, the most classic modular multiplication algorithms are the Montgomery algorithm, the Barrett algorithm, the signed Montgomery algorithm, and the Plantard algorithm, which is currently the most efficient. Previous studies mainly applied the Plantard algorithm to a more typical butterfly structure, and then implemented it based on the corresponding hardware and software conditions. Although these studies applied the Plantard algorithm to cryptographic mechanisms such as Kyber, they only considered specific hardware structures for optimization during the implementation process, and did not provide software optimization solutions that can be applied to a variety of cryptographic mechanisms. Summary of the invention
[0009] In order to solve at least one technical problem existing in the above-mentioned background technology, the present invention provides a key encapsulation method based on number theory transformation variant optimization of a new modular multiplication algorithm, which improves the key encapsulation efficiency by reducing the CPU cycle count value when constructing the key encapsulation mechanism and minimizing parameter restrictions.
[0010] In order to achieve the above object, the present invention adopts the following technical solution:
[0011] The first aspect of the present invention provides a key encapsulation method based on a number theory transformation variant optimization of a new modular multiplication algorithm, comprising the following steps:
[0012] Obtain the polynomial coefficient vectors of each phase involved in the polynomial multiplication operation corresponding to each stage in the key encapsulation process;
[0013] In the polynomial multiplication operation of the key encapsulation mechanism, the optimized modular multiplication algorithm is added to the NTT variant algorithm to obtain the optimized key encapsulation mechanism; wherein the optimization process of the modular multiplication algorithm includes: in the polynomial multiplication operation corresponding to each stage of the key encapsulation process, the original two-byte multiplication is optimized to a single-byte multiplication, the original two double-byte additions are optimized to a single-byte plus one addition, and the subtraction operation is deleted;
[0014] Based on the optimized key encapsulation mechanism and combined with various polynomial coefficient vectors, keys are generated, encrypted and decrypted.
[0015] Furthermore, the optimized modular multiplication algorithm is added to the NTT variant algorithm to obtain an optimized key encapsulation mechanism, including:
[0016] Decompose the acquired private key polynomial coefficient sequence and the message according to different cryptographic schemes to obtain a decomposed polynomial sequence;
[0017] Perform NTT forward transformation on the decomposed polynomial sequence to obtain the corresponding polynomial sequence after NTT forward transformation. In NTT, separate the coefficient terms of the polynomial representation into odd and even numbers, and use the divide-and-conquer method to perform layered calculations on the NTT cycle. Use the optimized modular multiplication algorithm to calculate in each layer to obtain the private key polynomial coefficient sequence after NTT forward transformation.
[0018] The coefficient sequence of the private key polynomial that has undergone NTT forward transformation and the message that has undergone the same transformation are point multiplied, and the result of the point multiplication is subjected to NTT inverse transformation. Similarly, in the NTT inverse transformation, the optimized modular multiplication algorithm is used for calculation in each layer to obtain the coefficient vector of the product result of the NTT inverse transformation, that is, the message.
[0019] Furthermore, in the NewHope encryption scheme, the 2KNTT decomposition method is used during the NTT forward transformation, including first dividing the private key polynomial coefficient sequence and the message into two parts according to the coefficient parity terms according to 1KNTT, and then continuing to decompose 2KNTT on the basis of 1KNTT. The length of the polynomial obtained after decomposition is n / 4, and the cyclic hierarchical calculation is completely decomposed, that is, the number of layers is log(n / 4), where n is the degree of the polynomial;
[0020] In the Kyber encryption scheme, during the NTT forward transformation, 1KNTT is applied to decompose the private key polynomial coefficient sequence into two parts, each with a power of n / 2. The NTT cyclic layering does not decompose the power n / 2 completely, but is divided into log(n / 2)-1 layers, and the last layer is a quadratic polynomial.
[0021] Furthermore, in the NewHope encryption scheme, both the NTT forward and inverse transformation processes use the Gentleman-Sande butterfly operation structure, and in the Kyber encryption scheme, the NTT forward and inverse transformation processes use the Cooley-Tukey and Gentleman-Sande butterfly structures, respectively.
[0022] Furthermore, when the NTT cycle is layered and calculated using the divide-and-conquer method, the mapping formula (X,Y)→(X+WY,X-WY) is used for calculation in each layer. In the inverse transformation of NTT, the mapping formula (X,Y)→(X+Y,(XY)W) is used for calculation in each layer, where X and Y are polynomial coefficients and W is the primitive unit root calculated in the number theory transformation.
[0023] Furthermore, the optimized key encapsulation mechanism is combined with various polynomial coefficient vectors to generate, encrypt and decrypt keys, including:
[0024] The first polynomial coefficient vector is processed by the forward transformation part in the NTT variant algorithm to generate a private key and a public key;
[0025] Assuming that the user has received the generated public key, the encrypted message is encrypted using the public key. During encryption, the ciphertext is generated through the encoding function and the compression function;
[0026] The private key is used to decrypt the message. During decryption, the message, i.e. the encrypted message, is obtained through the decoding function and the decompression function.
[0027] The second aspect of the present invention provides a key encapsulation system based on a number theory transformation variant optimization of a new modular multiplication algorithm, comprising:
[0028] The polynomial acquisition module is configured to: acquire the polynomial coefficient vectors of each polynomial involved in the polynomial multiplication operation corresponding to each stage in the key encapsulation process;
[0029] The key encapsulation mechanism building module is configured to: in the polynomial multiplication operation of the key encapsulation mechanism, add the optimized modular multiplication algorithm to the NTT variant algorithm to obtain the optimized key encapsulation mechanism; wherein the optimization process of the modular multiplication algorithm includes: in the participating polynomial multiplication operation corresponding to each stage of the key encapsulation process, optimizing the original two-byte multiplication to a single-byte multiplication, optimizing the original two double-byte additions to a single-byte plus one addition, and deleting the subtraction operation;
[0030] The key encapsulation module is configured to: generate, encrypt and decrypt keys based on the optimized key encapsulation mechanism in combination with various polynomial coefficient vectors.
[0031] A third aspect of the present invention provides a computer-readable storage medium.
[0032] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps in the key encapsulation method based on number theory transformation variant optimization of a new modular multiplication algorithm as described above.
[0033] A fourth aspect of the present invention provides a computer device.
[0034] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps in the key encapsulation method based on number theory transformation variant optimization of a new modular multiplication algorithm as described above are implemented.
[0035] A fifth aspect of the present invention provides a program product.
[0036] A program product, which is a computer program product, includes a computer program, and is characterized in that when the computer program is executed by a processor, it implements the steps in the key encapsulation method based on the number theory transformation variant optimization of the new modular multiplication algorithm as described above.
[0037] Compared with the prior art, the present invention has the following beneficial effects:
[0038] 1. In the process of constructing a lattice-based cryptographic system, the present invention optimizes the modular multiplication algorithm frequently used in the polynomial multiplication part of the key encapsulation mechanism to address the problem of redundant operations. In the key encapsulation mechanism, the key generation, encapsulation and decapsulation algorithms all reduce the CPU cycle count value required for the construction process.
[0039] 2, the present invention optimizes the modular multiplication algorithm frequently used in the polynomial multiplication part, and reduces the amount of calculation in the construction process. Now the algorithm consists of two multiplications, one addition, one subtraction and one division, and the original algorithm consists of two multiplications, one addition and one division, wherein the original algorithm multiplication is two-byte multiplication, and in the optimized algorithm, one of them is single-byte multiplication, and the original addition is two double-byte additions, which is single-byte plus one addition after optimization. Therefore, the CPU count value required when the optimized algorithm is constructed is less, and the required time is less and the efficiency is higher.
[0040] Advantages of additional aspects of the present invention will be given in part in the following description, and in part will become obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0042] Figure 1 It is a schematic diagram of the overall process of a key encapsulation method based on number theory transformation variant optimization of a new modular multiplication algorithm provided by an embodiment of the present invention;
[0043] Figure 2 This is a polynomial multiplication implementation process based on optimized NTT provided by an embodiment of the present invention;
[0044] Figure 3 This is a key encapsulation mechanism process based on optimized polynomial multiplication provided by an embodiment of the present invention; DETAILED DESCRIPTION
[0045] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0046] It should be noted that the following detailed descriptions are all illustrative and intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.
[0047] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0048] Regarding the key encapsulation efficiency improvement mentioned in the background technology of the present invention for the construction of Kyber and NewHope, especially the NTT algorithm variant algorithm, there is an optimization feasibility. To complete the above optimization process, the problems that need to be solved and have been solved include understanding the construction ideas of the Kyber and NewHope cryptographic systems, especially the construction techniques of the polynomial multiplication part using the number theory transformation variant algorithm, understanding the application conditions of the Plantard algorithm, improving and completing the KNTT algorithm optimization based on the original algorithm, and finally completing the construction implementation in the cryptographic system to achieve efficiency improvement.
[0049] Embodiment 1
[0050] like Figure 1 As shown, this embodiment provides a key encapsulation method based on number theory transformation variant optimization of a new modular multiplication algorithm, comprising the following steps:
[0051] Step 1: Obtain the polynomial coefficient vectors involved in the polynomial multiplication operation corresponding to each stage in the key encapsulation process;
[0052] In this embodiment, the polynomial coefficient sequence obtained in the key generation phase includes a first polynomial coefficient vector including a private key vector s and an error vector e; wherein the private key vector s and the error vector e are obtained by a χ distribution sampling algorithm;
[0053] Step 2: Construct a key encapsulation mechanism. In the polynomial multiplication operation of the key encapsulation mechanism, add the optimized modular multiplication algorithm to the NTT variant algorithm to obtain the optimized key encapsulation mechanism.
[0054] Wherein, step 2 specifically includes:
[0055] Step 201: Optimizing the modular multiplication algorithm;
[0056] In order for the Plantard algorithm to have practical computational significance, the parameter N is required to satisfy Q < 2 N, and Q is the modulus selected by the NTT algorithm. Because in the Kyber and NewHope key encapsulation mechanisms, the values of Q include 3329, 7681, and 12289. At the same time, in order to more conveniently represent variables with unsigned 16-bit and 32-bit numbers in the actual construction process, N=16, that is, the number of single-byte bits of the polynomial coefficients in the computer storage in the present invention.
[0057] The modular multiplication algorithm frequently used in the polynomial multiplication part has been optimized to reduce the amount of calculation in the construction process. The algorithm now consists of two multiplications, one addition, one subtraction, and one division. The original algorithm consists of two multiplications, one addition, and one division. The multiplication of the original algorithm is a two-byte multiplication, and one of the optimized algorithms is a single-byte multiplication. The original addition is two double-byte additions, and the optimized one is a single-byte plus one addition. Therefore, fewer CPU count values are required when constructing the optimized algorithm, which means less time is required and higher efficiency.
[0058] In order to understand the difference between the modular multiplication algorithms before and after optimization, the two modular multiplication algorithms are described in detail in this embodiment, where qinv = R – Q -1 mod 2 N The result of modular inversion, qinvr = Q -1 mod 2 2N The result of modular inversion, where R = 2 N .
[0059] Because the modular multiplication algorithm is a fast algorithm for calculating the primitive unit root W and the corresponding polynomial coefficient Y in number theory transformation, that is, the WY multiplication in step 2022, the input of the modular multiplication algorithm is the product of the two variables WY, which is denoted as a for convenience in this embodiment, and the output is the modular multiplication form of the output value, that is, –a2 -2N mod Q, where shifting right by N bits means dividing by 2 N , that is, the counting consumption of division in the CPU is reduced by shifting.
[0060] The specific steps of the original modular multiplication algorithm are: input a, assign the product of a·qinv to u, assign u·Q+a to c, and finally output c shifted to the right by N bits, that is, c / 2 N The output value means a2 -N mod Q.
[0061] The input values of the optimized algorithm have the same meaning, but the direct output value range is inconsistent with the original algorithm. Therefore, it is modified to subtract the result value from the output modulus Q to ensure that the results before and after optimization are consistent.
[0062] Specific steps: Input a, assign the product of a·qinvr to u, shift u right by N bits and add 1, that is Let it be c, assign the result of c·Q to r, and finally return Qr to get the same output value a2 as the original algorithm -N modQ.
[0063] The experimental results show that the two modular multiplication algorithms produce the same results under the same input. From the perspective of using the CPU for addition, subtraction and multiplication operations, the optimized algorithm construction requires fewer CPU cycle counts.
[0064] Step 202: adding the optimized modular multiplication algorithm to the NTT variant algorithm to obtain an optimized key encapsulation mechanism;
[0065] In this embodiment, two different NTT algorithms are implemented based on the Kyber and NewHope cryptographic schemes, and are named KNTT-plan algorithms.
[0066] Next, we will first introduce the NTT algorithm that matches NewHope, and then introduce the difference between the NTT algorithm based on Kyber.
[0067] The polynomial multiplication constructed using the NTT variant algorithm includes five steps: preprocessing of the polynomial ring, NTT forward transformation, point multiplication operation, NTT inverse transformation and result merging. This algorithm mainly calculates the multiplication of two polynomials, that is, the KNTT-plan algorithm mentioned in steps 301-303. In the specific application process, preprocessing and NTT forward transformation are used In the form of NTT, the inverse transformation and result merging are performed using KNTT-plan -1 Indicates. The KNTT-plan algorithm is called multiple times during the key encapsulation process. This patent takes the application process in the decapsulation algorithm as an example to illustrate. The entire step inputs the private key polynomial coefficient sequence s, the polynomial degree is recorded as n, and the output is the product result coefficient vector, that is, the message μ.
[0068] like Figure 2 As shown, the following takes the NTT algorithm matching NewHope as an example, which specifically includes the following steps:
[0069] Step 2021: The first part of the forward KNTT-plan is to decompose s. According to 1KNTT decomposition, it is divided into two parts according to the parity terms of the coefficients. 2KNTT continues to decompose on the basis of 1KNTT. In this embodiment, a polynomial multiplication algorithm for decomposition to 3KNTT is implemented. The 2KNTT decomposition method is used in the NewHope construction process, and the length of the polynomial after decomposition is n / 4.
[0070] Step 2022: The first part of KNTT–plan forward, namely NTT forward transform (NTT), is In this example, step 2022 inputs the input s processed by step 2021. 00 ,s 01 ,s 10 ,s 11 , output the NTT form sequence of s after conversion by NTT algorithm (including four parts of decomposition), this process is frequently used in the key encapsulation mechanism. When focusing on this step itself, the Gentleman-Sande butterfly operation structure is used, the coefficient terms of the polynomial representation are separated into odd and even in NTT, and the NTT is cyclically layered and calculated using the divide-and-conquer method. In each layer, the mapping formula (X, Y) → (X + WY, X-WY) is used for calculation. The WY multiplication process applies the modular multiplication algorithm optimized in step 201, and the cyclic layered calculation is completely decomposed, that is, the number of layers is log(n / 4).
[0071] Step 223: Karatsuba algorithm is applied to perform corresponding operations during the dot multiplication operation. Specific steps: The result obtained in step 222 and the same transformed message Perform point multiplication, that is, multiply the values on the n-bit sequence separately, denoted as therefore Represents dot product.
[0072] Step 2024: NTT inverse transformation (INTT), i.e. The Gentleman-Sande butterfly structure is also used. When applied to a specific polynomial, each layer of INTT uses (X,Y)→(X+Y,(X–Y)W) for calculation, where the multiplication process of (XY)W uses the modular multiplication algorithm optimized in step 201.
[0073] Step 2025: Finally, the obtained results are merged and partially processed to obtain the normal form of the message μ.
[0074] Through the above scheme, we can see that the above modular multiplication algorithm is written into the NTT algorithm, and the GS butterfly structure is adopted in the NewHope NTT algorithm. However, in the specific implementation process, the NTT algorithm based on the butterfly structure is not directly used, but the Chinese remainder theorem is first used to decompose n polynomials into n / 4 quadratic polynomials, and the number of NTT loop layers is reduced from logn to log(n / 4), and then the butterfly structure of log(n / 4) layers is implemented.
[0075] Based on Kyber's NTT algorithm, the basic implementation idea is similar to NewHope. The differences include that NTT and INTT use Cooley-Turkey and Gentleman-Sande butterfly structures respectively, and 1KNTT is used to decompose the polynomial coefficients into two parts, each with a power of n / 2. It is particularly important to note that the NTT cyclic layering does not decompose the power n / 2 completely, but is divided into log(n / 2)-1 layers, and the last layer is a quadratic polynomial.
[0076] The polynomial multiplication algorithm was optimized, and the operational efficiency of the NTT variant algorithm was improved under the existing loose parameter constraints and experimentally verified.
[0077] Experimental conditions: Considering that the original NTT algorithm cannot break through the strict relationship between the modulus Q and the polynomial degree n during the comparative experiment, this part of the experimental verification selects three combinations of modulus and polynomial degree: (7681, 256), (12289, 512) and (12289, 1024). Experimental results: The cost of 1KNTT-plan is about 74.1% of the original, 2KNTT-plan is about 87.9%, 3KNTT-plan is about 75.6%, and the overall cost of KNTT-plan is about 65.5% and 69.9% of PtNTT and NTT respectively.
[0078] Step 3: Generate, encrypt and decrypt keys based on the optimized key encapsulation mechanism.
[0079] In this embodiment, it includes optimized Kyber and NewHope key encapsulation mechanisms;
[0080] Taking the NewHope scheme as an example, the modulus Q is 7681, and the polynomial degree n is 512 and 1024, which are used to encapsulate a 256-bit symmetric key or message plaintext. At the same time, based on the relationship between Q and n, only the 2KNTT-plan algorithm can be selected for construction.
[0081] In order to improve communication efficiency, the ciphertext and plaintext are compressed and decompressed respectively. The input and output plaintext and ciphertext are both polynomial coefficient sequences.
[0082] Taking NewHope's key encapsulation as an example, the key generation algorithm (Key Generation), encryption algorithm (Encryption) and decryption algorithm (Decryption) are described in detail.
[0083] like Figure 3 As shown, the specific steps include:
[0084] Step 301: Process the first polynomial coefficient vector obtained by 2KNTT-plan through the forward transformation part to generate the private key sk=s and the public key
[0085] In this embodiment, the first polynomial coefficient vector sequence obtained in the key generation phase includes: s, e, and seed; where seed is obtained by generating an n-bit random number, the private key vector s and the error vector e are obtained by the χ distribution sampling algorithm, Obtained through sampling algorithm;
[0086] After the forward transformation part of 2KNTT-plan, that is Get the public key Private key sk = s;
[0087] Step 302: Assuming that the user has received the public key pk generated by the key generation step in step 301, the encrypted message m is now encrypted using the public key to generate the ciphertext
[0088] Specifically, in the encryption stage, the obtained second polynomial coefficient vector sequence is recorded as: s′, e′, e″, all of which are obtained through the χ distribution sampling algorithm;
[0089] In this algorithm, generate pass h←Compress(v′,3) generates h, where Encode and Compress are the encoding and compression functions respectively.
[0090] Step 303: Decrypt the message using the private key sk=s Get the message μ, that is, the encrypted message m in step 302, by v′←Decompress(h,3), Among them, Decode and Decompress are decoding and decompression functions respectively.
[0091] The basic idea of the key encapsulation mechanism based on NewHope is basically the same as the public key encryption scheme, except that the key is no longer transmitted as a message, and a hash function is applied to it. The construction idea of the key encapsulation mechanism scheme based on Kyber is basically the same, except that the 1KNTT-plan algorithm is used, and there are differences in the details of the compression and decompression methods.
[0092] Through the above scheme, in the key encapsulation mechanism, the CPU cycle count value required for the construction process is reduced in the key generation, encapsulation and decapsulation algorithms.
[0093] Experimental verification
[0094] In the first part, the present invention implements a polynomial multiplication scheme based on KNTT-plan, and conducts comparative experimental analysis with the existing NTT, PtNTT and KNTT algorithms based on butterfly structure. From the perspective of decomposing polynomial rings, all comparative experiments from 1KNTT-plan to 3KNTT-plan are implemented. The efficiency of KNTT-plan algorithm is improved compared with NTT, PtNTT and KNTT algorithms, which are about 69.9%, 65.5% and 74.1% of the original, respectively.
[0095] The specific data are shown in Table 1, where the PtNTT, KNTT and KNTT-plan algorithms all use a structure in which the polynomial (ring) is decomposed once in the preprocessing stage, namely 1PtNTT, 1KNTT and 1KNTT-plan algorithms. The experiment takes the average value of 100,000 times, in microseconds.
[0096] Table 1 Comparison of the effects of the method of the present invention and the existing NTT algorithm
[0097]
[0098] In the second part, the present invention implements a lattice cryptographic mechanism scheme based on KNTT-plan. In the current cryptographic mechanism based on PtNTT, three parameters, small-Kyber512, small-Kyber768, and small-Kyber1024, are selected to complete the Kyber key encapsulation mechanism implementation. At the same time, two parameters, small-NewHope512 and small-NewHope1024, are selected to implement the NewHope key encapsulation mechanism. We use the KNTT-plan algorithm to implement the key encapsulation mechanism with the same parameters and compare the implementation effect. Compared with the current key encapsulation mechanism based on PtNTT, the scheme of the present invention has significantly improved the efficiency of key generation, encapsulation, and decapsulation processes.
[0099] The specific data are shown in Table 2 and Table 3. The security of KEM based on Kyber is indistinguishably under chosen plaintext attacks (IND-CPA), and the security of KEM based on NewHope includes two basics: indistinguishably under chosen-plaintext attacks and chosen-ciphertext attacks (IND-CPA and IND-CCA). The data in the table are CPU cycle count values.
[0100] Table 2 Comparison of the effects of the present invention and the existing Kyber key encapsulation mechanism
[0101]
[0102] Table 3 Comparison of the effects of the present invention and the existing NewHope key encapsulation mechanism
[0103]
[0104] Embodiment 2
[0105] This embodiment provides a key encapsulation system based on number theory transformation variant optimization of a new modular multiplication algorithm, including:
[0106] The polynomial acquisition module is configured to: acquire the polynomial coefficient vectors of each polynomial involved in the polynomial multiplication operation corresponding to each stage in the key encapsulation process;
[0107] The key encapsulation mechanism building module is configured to: in the polynomial multiplication operation of the key encapsulation mechanism, add the optimized modular multiplication algorithm to the NTT variant algorithm to obtain the optimized key encapsulation mechanism; wherein the optimization process of the modular multiplication algorithm includes: in the participating polynomial multiplication operation corresponding to each stage of the key encapsulation process, optimizing the original two-byte multiplication to a single-byte multiplication, optimizing the original two double-byte additions to a single-byte plus one addition, and deleting the subtraction operation;
[0108] The key encapsulation module is configured to: generate, encrypt and decrypt keys based on the optimized key encapsulation mechanism in combination with various polynomial coefficient vectors.
[0109] Embodiment 3
[0110] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps in the key encapsulation method based on number theory transformation variant optimization of the new modular multiplication algorithm as described above are implemented.
[0111] Embodiment 4
[0112] This embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps in the key encapsulation method based on number theory transformation variant optimization of the new modular multiplication algorithm as described above are implemented.
[0113] Embodiment 5
[0114] This embodiment provides a program product, which is a computer program product, including a computer program, characterized in that when the computer program is executed by a processor, the steps in the key encapsulation method based on the number theory transformation variant optimization of the new modular multiplication algorithm as described above are implemented.
[0115] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program code.
[0116] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0117] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0118] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0119] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0120] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A key encapsulation method based on number theory transformation variant optimization of a new modular multiplication algorithm, characterized in that: The steps include: Obtain the polynomial coefficient vectors of each phase involved in the polynomial multiplication operation corresponding to each stage in the key encapsulation process; In the polynomial multiplication operation of the key encapsulation mechanism, the optimized modular multiplication algorithm is added to the NTT variant algorithm to obtain the optimized key encapsulation mechanism; wherein the optimization process of the modular multiplication algorithm includes: in the polynomial multiplication operation corresponding to each stage of the key encapsulation process, the original two-byte multiplication is optimized to a single-byte multiplication, the original two double-byte additions are optimized to a single-byte plus one addition, and the subtraction operation is deleted; Based on the optimized key encapsulation mechanism and combined with various polynomial coefficient vectors, keys are generated, encrypted and decrypted.
2. The key encapsulation method based on number theory transformation variant optimization of the new modular multiplication algorithm as claimed in claim 1 is characterized in that: The optimized modular multiplication algorithm is added to the NTT variant algorithm to obtain an optimized key encapsulation mechanism, including: Decompose the acquired private key polynomial coefficient sequence and the message according to different cryptographic schemes to obtain a decomposed polynomial sequence; Perform NTT forward transformation on the decomposed polynomial sequence to obtain the corresponding polynomial sequence after NTT forward transformation. In NTT, separate the coefficient terms of the polynomial representation into odd and even numbers, and use the divide-and-conquer method to perform layered calculations on the NTT cycle. Use the optimized modular multiplication algorithm to calculate in each layer to obtain the private key polynomial coefficient sequence after NTT forward transformation. The coefficient sequence of the private key polynomial that has undergone NTT forward transformation and the message that has undergone the same transformation are point multiplied, and the result of the point multiplication is subjected to NTT inverse transformation. Similarly, in the NTT inverse transformation, the optimized modular multiplication algorithm is used for calculation in each layer to obtain the coefficient vector of the product result of the NTT inverse transformation, that is, the message.
3. The key encapsulation method based on number theory transformation variant optimization of the new modular multiplication algorithm as claimed in claim 2 is characterized in that: In the NewHope encryption scheme, the 2KNTT decomposition method is used during the NTT forward transformation, which includes first dividing the private key polynomial coefficient sequence and the message into two parts according to the coefficient parity terms according to 1KNTT, and then continuing to decompose 2KNTT on the basis of 1KNTT. The length of the polynomial obtained after decomposition is n / 4, and the cyclic layered calculation is completely decomposed, that is, the number of layers is log(n / 4), where n is the degree of the polynomial; In the Kyber encryption scheme, during the NTT forward transformation, 1KNTT is applied to decompose the private key polynomial coefficient sequence into two parts, each with a power of n / 2. The NTT cyclic layering does not decompose the power n / 2 completely, but is divided into log(n / 2)-1 layers, and the last layer is a quadratic polynomial.
4. The key encapsulation method based on number theory transformation variant optimization of the new modular multiplication algorithm as claimed in claim 2, characterized in that: In the NewHope encryption scheme, both the NTT forward and inverse transformation processes use the Gentleman-Sande butterfly operation structure. In the Kyber encryption scheme, the NTT forward and inverse transformation processes use the Cooley-Tukey and Gentleman-Sande butterfly structures respectively.
5. The key encapsulation method based on number theory transformation variant optimization of the new modular multiplication algorithm as claimed in claim 2, characterized in that: When the NTT cycle is layered and calculated using the divide-and-conquer method, the mapping formula (X,Y)→(X+WY,X-WY) is used in each layer for calculation. In the inverse transformation of NTT, the formula (X,Y)→(X+Y,(XY)W) is used in each layer for calculation, where X and Y are polynomial coefficients and W is the primitive unit root calculated in the number theory transformation.
6. The key encapsulation method based on number theory transformation variant optimization of the new modular multiplication algorithm as claimed in claim 1, characterized in that: The optimized key encapsulation mechanism is combined with various polynomial coefficient vectors to generate, encrypt and decrypt keys, including: The first polynomial coefficient vector is processed by the forward transformation part in the NTT variant algorithm to generate a private key and a public key; Assuming that the user has received the generated public key, the encrypted message is encrypted using the public key. During encryption, the ciphertext is generated through the encoding function and the compression function; The private key is used to decrypt the message. During decryption, the message, i.e. the encrypted message, is obtained through the decoding function and the decompression function.
7. A key encapsulation system based on number theory transformation optimization of a new modular multiplication algorithm, characterized in that: include: The polynomial acquisition module is configured to: acquire the polynomial coefficient vectors of each polynomial involved in the polynomial multiplication operation corresponding to each stage in the key encapsulation process; The key encapsulation mechanism building module is configured to: in the polynomial multiplication operation of the key encapsulation mechanism, add the optimized modular multiplication algorithm to the NTT variant algorithm to obtain the optimized key encapsulation mechanism; wherein the optimization process of the modular multiplication algorithm includes: in the participating polynomial multiplication operation corresponding to each stage of the key encapsulation process, optimizing the original two-byte multiplication to a single-byte multiplication, optimizing the original two double-byte additions to a single-byte plus one addition, and deleting the subtraction operation; The key encapsulation module is configured to: generate, encrypt and decrypt keys based on the optimized key encapsulation mechanism in combination with various polynomial coefficient vectors.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps in the key encapsulation method based on number theory transformation variant optimization of a new modular multiplication algorithm as described in any one of claims 1 to 6 are implemented.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps in the key encapsulation method based on number theory transformation variant optimization of the new modular multiplication algorithm as described in any one of claims 1 to 6 are implemented.
10. A program product, the program product being a computer program product, comprising a computer program, characterized in that: When the computer program is executed by a processor, the steps in the key encapsulation method based on number theory transformation variant optimization of a new modular multiplication algorithm as described in any one of claims 1 to 6 are implemented.
Citation Information
Cited By
Improved plantard algorithm-based lattice cipher modular multiplication method and modular multiplier
CN120050042A
A lattice cryptography modular multiplication method and multiplier based on an improved Plantard algorithm
CN120050042B
Secret key packaging method and device and computer equipment
CN120433933A
Key encapsulation method, device and computer equipment
CN120433933B
