A GPU-based Paillier homomorphic encryption and decryption calculation method and system

By generating global precomputation tables and decomposing encryption and decryption operations in parallel on the GPU platform, the problem of low efficiency of the Paillier homomorphic encryption algorithm on the GPU platform is solved, efficient homomorphic encryption and decryption operations are achieved, and data security and computing are improved. efficiency.

CN115459898BActive Publication Date: 2024-09-17XIDIAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211017789.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-23
Publication Date
2024-09-17
Estimated Expiration
2042-08-23

AI Technical Summary

Technical Problem

Existing homomorphic encryption solutions have low computing efficiency in cloud computing environments. The Paillier homomorphic encryption algorithm is difficult to implement efficiently on the GPU platform due to its complex algorithm structure and ciphertext expansion, resulting in poor encryption and decryption efficiency.

Method used

By generating a global precomputation table in parallel on the GPU device side, decomposing encryption and decryption operations into multiple parallel tasks, multiple GPU threads are used to perform homomorphic addition operations to improve computing efficiency.

Benefits of technology

It improves the efficiency of Paillier homomorphic encryption and decryption operations, enhances data security, and leverages the computing power of the GPU platform to provide efficient homomorphic encryption and decryption services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115459898B
    Figure CN115459898B
Patent Text Reader

Abstract

The present invention discloses a GPU-based Paillier homomorphic encryption and decryption calculation method, which is applied to a GPU device end and comprises: according to a password parameter, a sliding window parameter and a first part pre-calculation table sent by a CPU device end, a second part pre-calculation table is generated in parallel by multiple GPU threads, and a global pre-calculation table is obtained according to the second part pre-calculation table and the first part pre-calculation table; according to the global pre-calculation table, a message to be encrypted and a homomorphic encryption parameter, a first ciphertext message is generated in parallel by multiple GPU threads, and the first ciphertext message is sent to the CPU device end; according to the message to be decrypted and the decryption parameter sent by the CPU device end, a plaintext message is generated in parallel by multiple GPU threads, and the plaintext message is sent to the CPU device end; according to a second ciphertext message and a third ciphertext message sent by the CPU device end, a homomorphic addition operation is performed in parallel by multiple GPU threads to generate a fourth ciphertext message, and the fourth ciphertext message is sent to the CPU device end.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of information security technology, and in particular relates to a GPU-based Paillier homomorphic encryption and decryption calculation method and system. Background Art

[0002] At present, with the popularity of outsourced computing models, outsourcing of data storage and computing services has become an inevitable trend. However, while outsourced computing provides economical and reliable shared computing services, it also poses new challenges to the security of the data outsourcing process. Ensuring the confidentiality and integrity of data in the outsourced computing process has become an urgent problem to be solved in cloud computing.

[0003] As a special encryption system, the greatest advantage of homomorphic encryption is that it can complete the task of processing ciphertext without leaking sensitive information. However, the existing homomorphic encryption schemes are relatively complex and the ciphertext expansion is large. The current computing efficiency is still low. In a cloud environment, a large number of homomorphic operations will cause great computing pressure on the client and server. The Paillier homomorphic encryption algorithm is a public key cryptographic system that supports additive homomorphic properties. Due to its relatively high efficiency and complete security proof, it has been widely used in the design of privacy protection schemes. However, at present, with the continuous improvement of device computing power, the Paillier encryption algorithm needs to continuously increase the key length to meet security needs, resulting in a significant reduction in its encryption and decryption efficiency.

[0004] In recent years, with the gradual maturity of the semiconductor industry and the improvement of various hardware computing platforms, the computing power of various hardware devices has developed rapidly. Processing computing-intensive tasks based on hardware system architecture is very suitable for the efficient implementation of cryptographic algorithms. However, the Paillier homomorphic encryption algorithm has the characteristics of complex algorithm structure logic, large memory usage of calculation results and intermediate results, and the classical optimization algorithm it relies on cannot be directly adapted to the characteristics of various hardware platforms, which will lead to problems such as poor efficiency of encryption and decryption operations and homomorphic operations.

[0005] At present, there are some solutions to the above problems, but one of the problems with the existing solutions is that they mainly focus on the low-latency implementation of the Central Processing Unit (CPU) platform, and the research on the efficient implementation of the Graphics Processing Unit (GPU) platform is not sufficient, making it difficult to give full play to the computing power of the GPU platform. Summary of the invention

[0006] In order to solve the above problems existing in the related art, the present invention provides a GPU-based Paillier homomorphic encryption and decryption calculation method and system. The technical problem to be solved by the present invention is achieved through the following technical solutions:

[0007] The present invention provides a GPU-based Paillier homomorphic encryption and decryption calculation method, which is applied to a GPU device end and includes:

[0008] According to the password parameters, sliding window parameters and the first part of the pre-calculation table sent by the CPU device end, a second part of the pre-calculation table is generated in parallel by multiple first GPU threads of the GPU device end, and a global pre-calculation table is obtained according to the second part of the pre-calculation table and the first part of the pre-calculation table;

[0009] Generate a first ciphertext message in parallel through multiple second GPU threads of the GPU device end according to the global pre-calculation table, the message to be encrypted sent by the CPU device end, and the homomorphic encryption parameter, and send the first ciphertext message to the CPU device end;

[0010] Generate plaintext messages in parallel through multiple third GPU threads of the GPU device end according to the message to be decrypted and the decryption parameter sent by the CPU device end, and send the plaintext messages to the CPU device end;

[0011] According to the second ciphertext message and the third ciphertext message sent by the CPU device end, a homomorphic addition operation is performed in parallel by multiple fourth GPU threads of the GPU device end to generate a fourth ciphertext message, and the fourth ciphertext message is sent to the CPU device end.

[0012] The present invention also provides a GPU-based Paillier homomorphic encryption and decryption calculation method, which is applied to a CPU device, including:

[0013] Get security parameters, random values, and sliding window parameters;

[0014] Based on the security parameter and the random value, generate a cryptographic parameter;

[0015] Based on the sliding window parameters, calculate a first part of the pre-calculated table;

[0016] Sending the password parameter, the sliding window parameter and the first part of the pre-calculated table to the GPU device end;

[0017] Obtaining a message to be encrypted, and generating homomorphic encryption parameters corresponding to the message to be encrypted;

[0018] Sending the message to be encrypted and the homomorphic encryption parameters to the GPU device end;

[0019] Get the message to be decrypted and the decryption parameters;

[0020] Sending the message to be decrypted and the decryption parameters to the GPU device end;

[0021] Obtaining a second ciphertext message and a third ciphertext message;

[0022] The second ciphertext message and the third ciphertext message are sent to the GPU device end.

[0023] The present invention also provides a GPU-based Paillier homomorphic encryption and decryption computing system, comprising:

[0024] A homomorphic operation module and an arithmetic operation module; the arithmetic operation module is used to be called by the homomorphic operation module;

[0025] The homomorphic operation module comprises:

[0026] The system initialization and pre-calculation module is used to obtain security parameters, random values, and sliding window parameters from the CPU device side, generate password parameters based on the security parameters and the random values, calculate the first part of the pre-calculation table based on the sliding window parameters, and send the password parameters, the sliding window parameters, and the first part of the pre-calculation table to the GPU device side; the GPU device side generates the second part of the pre-calculation table in parallel through multiple first GPU threads of the GPU device side according to the password parameters, the sliding window parameters, and the first part of the pre-calculation table, and obtain the global pre-calculation table according to the second part of the pre-calculation table and the first part of the pre-calculation table;

[0027] The encryption calculation module is used to obtain the message to be encrypted by the CPU device end, generate homomorphic encryption parameters corresponding to the message to be encrypted, and send the message to be encrypted and the homomorphic encryption parameters to the GPU device end; the GPU device end generates a first ciphertext message in parallel through multiple second GPU threads of the GPU device end according to the global pre-calculation table, the message to be encrypted and the homomorphic encryption parameters, and sends the first ciphertext message to the CPU device end;

[0028] The decryption calculation module is used to obtain the message to be decrypted and the decryption parameter by the CPU device end, and send the message to be decrypted and the decryption parameter to the GPU device end; the GPU device end generates a plaintext message in parallel through multiple third GPU threads of the GPU device end according to the message to be decrypted and the decryption parameter, and sends the plaintext message to the CPU device end;

[0029] A homomorphic addition calculation module is used to obtain a second ciphertext message and a third ciphertext message by the CPU device end, and send the second ciphertext message and the third ciphertext message to the GPU device end; the GPU device end performs a homomorphic addition operation in parallel according to the second ciphertext message and the third ciphertext message through multiple fourth GPU threads of the GPU device end to generate a fourth ciphertext message, and send the fourth ciphertext message to the CPU device end;

[0030] The arithmetic operation module comprises:

[0031] A non-fixed basis modular exponentiation operation module based on a sliding window method, used for, when a plaintext message is generated in parallel by the plurality of third GPU threads, generating a local pre-calculation table by performing a pre-calculation window calculation, and executing a modular multiplication calculation method based on the Montgomery algorithm and the Karatsuba algorithm by calling a modular multiplication calculation module based on the Montgomery algorithm and the Karatsuba algorithm, and performing a non-fixed basis modular exponentiation operation by querying the local pre-calculation table;

[0032] A modular operation module based on the Barrett algorithm, used for performing modular processing when plaintext messages are generated in parallel by the plurality of third GPU threads;

[0033] A fixed-basis modular exponentiation operation module based on a pre-calculation table is used to perform a modular multiplication calculation method based on the Montgomery algorithm and the Karatsuba algorithm by calling a modular multiplication calculation module based on the Montgomery algorithm and the Karatsuba algorithm when generating the second part of the pre-calculation table by the multiple first GPU threads; and when generating the first ciphertext message in parallel by the multiple second GPU threads, perform a fixed-basis modular exponentiation operation by querying the global pre-calculation table;

[0034] The modular multiplication calculation module based on the Montgomery algorithm and the Karatsuba algorithm is used for performing modular multiplication and modular square operations based on the Montgomery algorithm, and performing multi-precision multiplication operations in modular multiplication and modular square operations based on the Karatsuba algorithm;

[0035] A basic operation module based on the assembly instructions of GPU hardware, used to perform addition, subtraction, multiplication and shift operations.

[0036] The present invention has the following beneficial technical effects:

[0037] The GPU device side generates the second part of the pre-calculation table in parallel through its own multiple GPU threads according to the password parameters, sliding window parameters and the first part of the pre-calculation table sent by the CPU device side, and obtains the global pre-calculation table according to the second part of the pre-calculation table and the first part of the pre-calculation table; generates the first ciphertext message in parallel through its own multiple GPU threads according to the global pre-calculation table, the message to be encrypted and the homomorphic encryption parameters sent by the CPU device side, and sends the first ciphertext message to the CPU device side; generates the plaintext message in parallel through its own multiple GPU threads according to the message to be decrypted and the decryption parameters sent by the CPU device side, and sends the plaintext message to the CPU device side; and, according to the second ciphertext message and the third ciphertext message sent by the CPU device side, performs homomorphic addition operations in parallel through its own multiple GPU threads to generate a fourth ciphertext message, and sends the fourth ciphertext message to the CPU device side. In this way, the calculation, encryption and decryption of the global pre-calculation table and other homomorphic operations are transferred to the GPU for parallel calculation. On the one hand, generating a global pre-calculation table on the GPU side can improve the throughput of subsequent encryption calculations; on the other hand, the GPU has strong computing power, so it can allow the use of longer passwords for encryption calculations, thereby improving the security of the encrypted data; on the other hand, through parallel homomorphic operations, the computing efficiency of homomorphic operations can be improved. In other words, since the GPU has more computing units than the CPU, it can efficiently process computationally intensive data in parallel. The present invention considers the characteristics of the GPU multi-core hardware architecture, transfers the calculation, encryption and decryption of the global pre-calculation table and other homomorphic operations to the GPU, and decomposes the calculation, encryption and decryption of the global pre-calculation table and other homomorphic operations, and performs fine-grained concurrent homomorphic operations, which not only improves the throughput during calculation, improves the security of the encrypted data, but also greatly improves the efficiency of homomorphic operations such as Paillier encryption and decryption, and can provide efficient homomorphic encryption, decryption and other computing services for homomorphic encryption outsourcing computing services in privacy protection scenarios.

[0038] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 An optional flowchart of a GPU-based Paillier homomorphic encryption and decryption calculation method applied on a GPU device end provided in an embodiment of the present invention;

[0040] Figure 2 Another optional flowchart of the GPU-based Paillier homomorphic encryption and decryption calculation method applied on a CPU device end provided in an embodiment of the present invention;

[0041] Figure 3A schematic diagram of the structure of an exemplary GPU-based Paillier homomorphic encryption and decryption computing system provided for an embodiment of the present invention. DETAILED DESCRIPTION

[0042] The present invention is further described in detail below with reference to specific embodiments, but the embodiments of the present invention are not limited thereto.

[0043] In the description of the present invention, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0044] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification.

[0045] Although the present invention is described herein in conjunction with various embodiments, in the process of implementing the claimed invention, those skilled in the art may understand and implement other variations of the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple situations. A single processor or other unit may implement several functions listed in a claim. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.

[0046] At present, the Paillier homomorphic encryption algorithm has the characteristics of complex algorithm structure logic, large memory usage of calculation results and intermediate results, and the classical optimization algorithm it relies on cannot be directly adapted to the characteristics of various hardware platforms, which will lead to problems such as poor efficiency of encryption and decryption operations and homomorphic operations. There are related solutions, but these solutions have the following problems and defects:

[0047] 1. The focus is mainly on low-latency implementation on the CPU platform, and the research on efficient implementation on the GPU platform is not sufficient. Some optimization algorithms cannot adapt to the platform characteristics of the GPU and it is difficult to give full play to the computing power of the GPU platform.

[0048] 2. There is insufficient research on the efficient implementation of arithmetic operation modules that cryptographic algorithms rely on on the GPU platform. For example, modular operations, modular multiplication operations, and modular exponentiation operations all have relatively complex algorithm structures. Directly implementing them on the GPU platform will cause serious thread bundle differentiation, resulting in high computational overhead.

[0049] Figure 1 is an optional flowchart of the GPU-based Paillier homomorphic encryption and decryption calculation method provided by an embodiment of the present invention, such as Figure 1 As shown, the method comprises the following steps:

[0050] S101, according to the password parameters, sliding window parameters and the first part of the pre-calculation table sent by the CPU device side, a second part of the pre-calculation table is generated in parallel by multiple first GPU threads on the GPU device side, and a global pre-calculation table is obtained according to the second part of the pre-calculation table and the first part of the pre-calculation table.

[0051] In an embodiment of the present invention, the CPU device side can obtain security parameters, random values, and sliding window parameters; generate cryptographic parameters based on the security parameters and the random values; calculate the first part of the pre-calculation table based on the sliding window parameters; and transmit the cryptographic parameters, sliding window parameters, and the first part of the pre-calculation table to the GPU device side through the PCIe bus.

[0052] In some embodiments, each first GPU thread calculates the second portion of the pre-calculation table by using a fixed-base modular exponentiation method based on the pre-calculation table.

[0053] Here, the security parameter is λ, the random values ​​are p and q, and the sliding window parameters include the global sliding window value ω1 and the host-side sliding window value ω2.

[0054] In some embodiments, the global pre-calculation table includes multiple rows of pre-calculated values; the first part of the pre-calculation table is the first part of the pre-calculated values ​​in the multiple rows of pre-calculated values; the second part of the pre-calculation table is the second part of the pre-calculated values ​​in the multiple rows of pre-calculated values; the GPU device side determines the second part of the pre-calculated values ​​as the values ​​to be calculated based on the first part of the pre-calculated values; according to the sliding window parameters, the total number of loop calculations and the multiple first GPU threads corresponding to each loop calculation are determined; in each loop calculation, multiple pre-calculated values ​​are calculated through multiple first GPU threads; the pre-calculated values ​​corresponding to the total number of loop calculations are used as the second part of the pre-calculated values.

[0055] Exemplarily, the CPU device generates password parameters, sliding window parameters and a first part of the pre-calculation table, and sends the password parameters, sliding window parameters and the first part of the pre-calculation table to the GPU end. The GPU end generates a second part of the pre-calculation table in parallel through its own multiple first GPU threads according to the password parameters, sliding window parameters and the first part of the pre-calculation table, and obtains a global pre-calculation table according to the second part of the pre-calculation table and the first part of the pre-calculation table. The process is as follows:

[0056] a) The CPU selects the system security parameter λ according to the user input instruction, and randomly generates two prime numbers p and q of λ / 2 bits, and calculates n=p×q, μ=lcm(p-1,q-1), where lcm(.) represents the least common multiple; then, the CPU selects α, where α<λ and |α|=Ω(|n| ζ ), ζ>0, and generate a group generator g∈B α , where B α for Finally, the CPU side calculates h = L (g α modn 2 ) -1 , where g α modn 2 Indicates the use of g α For 2 Take the model,

[0057] b) The CPU selects the global sliding window value ω1 and the host sliding window value ω2 according to the instructions input by the user, and calculates the pre-calculation table on the CPU in, g represents a fixed basis in the fixed basis modular exponentiation method based on a pre-computed table.

[0058] c) The CPU side generates the password parameters n, g, α, h and the host side pre-calculation table P x Transfer to the GPU.

[0059] d) The GPU receives n, g, α, h and the host-side pre-calculated table P sent by the CPU x , and saved in GPU device memory.

[0060] e) GPU startup The remaining pre-calculated tables are calculated in parallel by the GPU streams, where each GPU thread calculates the pre-calculated value of a row in the remaining pre-calculated table. In each GPU stream, ω1-ω2-1 loops are executed, and each loop starts GPU threads parallelize the computation pre-calculated values, where i decreases from l-1 to 0 in the loop calculation, and each loop calculation first calculates Then substitute the obtained c value into In this way, the remaining pre-calculated tables are calculated and the P x And the remaining pre-computed tables to get the global pre-computed table.

[0061] In some embodiments, when the second partial pre-calculation table is generated by the plurality of first GPU threads, each first GPU thread calculates the second partial pre-calculation table by a fixed-base modular exponentiation method based on the pre-calculation table.

[0062] Here, the fixed basis modular exponentiation operation method based on the pre-calculation table is used to execute the modular multiplication operation method based on the Montgomery algorithm and the Karatsuba algorithm, and is also used to perform fixed basis modular exponentiation operation by querying the pre-calculation table generated in the initialization phase.

[0063] The Karatsuba algorithm is a fast multiplication algorithm, which is mainly used for multiplying two large numbers. The principle is to divide the large number into two parts and then turn it into smaller digits, and then do three multiplications with a small amount of addition and shift operations.

[0064] Exemplarily, the CPU device side calculates the first part of the pre-calculation table, and the multiple first GPU threads calculate the second part of the pre-calculation table based on the fixed base modular exponentiation method of the pre-calculation table as follows:

[0065] (1) CPU-side calculation of pre-calculated table in,

[0066] (2) The GPU device executes ω1-ω2-1 cycles, where each cycle starts Threads for parallel computing pre-computed values, where each thread calculates 2 pre-computed values ​​at a time; in each loop, for each thread z, first calculate According to calculate The P table here precomputes the values ​​in the table.

[0067] S102. According to the global pre-calculation table, the message to be encrypted sent by the CPU device and the homomorphic encryption parameters, a first ciphertext message is generated in parallel by multiple second GPU threads of the GPU device, and the first ciphertext message is sent to the CPU device.

[0068] In an embodiment of the present invention, the CPU device side can obtain the message to be encrypted and generate homomorphic encryption parameters corresponding to the message to be encrypted; and send the message to be encrypted and the homomorphic encryption parameters to the GPU device side.

[0069] In some embodiments, each second GPU thread performs encryption calculations through a fixed-base modular exponentiation method based on a pre-calculated table, a modular multiplication method based on a Montgomery algorithm and a Karatsuba algorithm, and a basic operation method based on assembly instructions of GPU hardware.

[0070] Here, the message to be encrypted may be a sequence of plaintext messages to be encrypted, and the homomorphic encryption parameter may be a sequence of random values. The CPU device may obtain the message to be encrypted by receiving a sequence of plaintext messages input by a user.

[0071] In some embodiments, the GPU device determines multiple parallel first encryption computing tasks based on a global pre-calculation table, messages to be encrypted, or homomorphic encryption parameters; allocates the multiple first encryption computing tasks to multiple second GPU threads; obtains corresponding first encryption computing data by executing the corresponding first encryption computing task through each second GPU thread; determines multiple second encryption computing tasks based on the multiple first encryption computing data corresponding to the multiple second GPU threads, and allocates each second encryption computing task to a second GPU thread; obtains multiple second encryption computing data by executing the corresponding second encryption computing task through each second GPU thread, and obtains a first ciphertext message based on the multiple second encryption computing data.

[0072] For example, the GPU device will split the plaintext sequence M to be encrypted and the random number sequence R to obtain multiple groups of split data, each group of split data includes plaintext data and random values, and distribute these multiple groups of split data to multiple GPU threads for execution, so that multiple GPU threads perform corresponding calculations to obtain multiple first encrypted calculation data.

[0073] For example, M = {m1, m2, ..., m k}, R = {r1, r2, ..., r k}, after the GPU device receives the plaintext message sequence M and the random value sequence R, it first starts 2k GPU threads to calculate the first encrypted calculation data respectively, and the first encrypted calculation data is: After that, k GPU threads are started to calculate the second encrypted calculation data: c1 = c 11 ×c 12 mod n 2 , c2=c 21 ×c 22 mod n 2 , …, ck =c k1 ×c k2 mod n 2 ; Then, we get the ciphertext message sequence C = {c1, c2, ..., c k}.

[0074] In some embodiments, through each second GPU thread, a fixed-base modular exponentiation operation method based on a pre-calculated table, a modular multiplication operation method based on the Montgomery algorithm and the Karatsuba algorithm, and a basic operation method based on the assembly instructions of the GPU hardware are adopted to execute the corresponding first encryption calculation task and calculate the corresponding first encryption calculation data.

[0075] In some embodiments, through each second GPU thread, a fixed-base modular exponentiation operation method based on a pre-calculated table, a modular multiplication operation method based on the Montgomery algorithm and the Karatsuba algorithm, and a basic operation method based on the assembly instructions of the GPU hardware are adopted to execute the corresponding second encryption calculation task and calculate the corresponding second encryption calculation data.

[0076] In an embodiment of the present invention, a basic operation method based on assembly instructions of GPU hardware is used to optimize the bit carry propagation process in addition, subtraction, multiplication and shift operations based on GPU hardware PTX instructions, reduce unnecessary instruction overhead, and is used to quickly calculate addition, subtraction, multiplication and shift operations of large integers.

[0077] In an embodiment of the present invention, a modular multiplication method based on the Montgomery algorithm and the Karatsuba algorithm is used to perform modular multiplication and modular square operations based on the Montgomery algorithm, and to perform multi-precision multiplication operations in modular multiplication and modular square operations based on the Karatsuba algorithm.

[0078] In the embodiment of the present invention, the basic operation method based on the assembly instruction of GPU hardware includes: an addition operation method, a subtraction operation method, a multiplication operation method and a shift operation method based on the assembly instruction of GPU hardware.

[0079] Exemplarily, the modular multiplication method based on the Montgomery algorithm and the Karatsuba algorithm includes the following steps:

[0080] (1) Montgomery multiplication algorithm:

[0081] Input: a, b, n, r, n', where a <n,b<n,r=2 k , n <r,n'=-n -1 modr

[0082] Output: ω = a × b × r -1 (modn)

[0083] Calculation steps: Calculate ω=a×b, m=ω×n, and ω=(ω+m×n) / r;

[0084] If ω<m, then calculate ω=ω-n;

[0085] Output ω.

[0086] (2) Modular multiplication method based on Montgomery algorithm:

[0087] Input: a, b<n, n<2 k , n'=-n -1 modr, r = 2 k ;

[0088] Output: c = a × b mod n;

[0089] The calculation steps are as follows: a' = MontMult(a, r 2 modn);

[0090] b'=MontMult(b,r 2 modn);

[0091] c' = MontMult(a',b');

[0092] c = MontMult(c',1);

[0093] Output c;

[0094] Among them, the above algorithm (1) is the MontMult(.) function of algorithm (2) during the operation process.

[0095] Exemplarily, the GPU device can split the plaintext sequence M to be encrypted and the random number sequence R, and search each part obtained after the split in the pre-calculation table. In this way, the modular exponentiation operation of the original fixed basis can be split into a series of multiplication operations. After that, these multiplication operations are assigned to multiple GPU computing units for execution. Each GPU computing unit executes a GPU thread to call the modular multiplication calculation method based on the Montgomery algorithm and the Karatsuba algorithm and the multiplication operation method in the basic operation method based on the assembly instructions of the GPU hardware to perform multiplication operations.

[0096] It should be noted that, in the present invention, the same letters have different meanings in different algorithms and different methods, and the letters in each algorithm or method are only used to represent a numerical value in the method or algorithm to which it belongs.

[0097] S103 . Generate plaintext messages in parallel through multiple third GPU threads of the GPU device end according to the message to be decrypted and the decryption parameters sent by the CPU device end, and send the plaintext messages to the CPU device end.

[0098] In the embodiment of the present invention, the CPU device side can obtain the message to be decrypted and the decryption parameter, and send the message to be decrypted and the decryption parameter to the GPU device side. The CPU device side can obtain the message to be decrypted and the decryption parameter by receiving the message to be decrypted and the decryption parameter input by the user.

[0099] In some embodiments, each third GPU thread performs decryption calculations through a modular operation method based on Barrett's algorithm, a non-fixed basis modular exponentiation operation method based on a sliding window algorithm, a modular multiplication calculation method based on Montgomery's algorithm and Karatsuba's algorithm, and a basic operation method based on assembly instructions of GPU hardware.

[0100] In some embodiments, the GPU device side can determine multiple parallel first decryption computing tasks based on the message to be decrypted and the decryption parameters; assign the multiple first decryption computing tasks to multiple third GPU threads; execute the corresponding first decryption computing task by each third GPU thread to obtain corresponding first decryption computing data; determine multiple second decryption computing tasks based on the multiple first decryption computing data corresponding to the multiple third GPU threads, and assign each second decryption computing task to a third GPU thread; execute the corresponding second decryption computing task by each third GPU thread to obtain multiple second decryption computing data, and obtain a plaintext message based on the multiple second decryption computing data.

[0101] Here, the Chinese remainder theorem can be used to split the decryption operation process, thereby obtaining multiple parallel first decryption calculation tasks.

[0102] Exemplarily, the GPU device can split the sequence C to be decrypted and the decryption key a to obtain multiple groups of split data, each group of split data includes ciphertext data and key values, and distribute these multiple groups of split data to multiple GPU threads for execution, so that multiple GPU threads perform corresponding calculations to obtain multiple first decryption calculation data.

[0103] For example, the message to be decrypted may be a ciphertext sequence C = {c1, c2, ..., c k}, the decryption parameter is the decryption key α; the GPU device can start 2k GPU threads to calculate the first decryption calculation data respectively, where the first decryption calculation data is: m p1 =L p (c α modp 2 )(modp), m p2 =L p (c α modp 2 )(modp), m pk =L p (c α modp 2 )(modp),m qk =L q (c α modq 2 )(modq); then, start k GPU threads to calculate the second decryption calculation data: m1 = CRT (m p1 ,m q1 )·h(modn),m2=CRT(m p2 ,m q2 )·h(modn),…,m k =CRT(m p2 ,m q2 )·h(modn); then, we get the plaintext message sequence M={m1,m2,...,m k}, CRT(.) represents the decryption function determined according to the Chinese Remainder Theorem.

[0104] In some embodiments, through each third GPU thread, a modular operation method based on Barrett's algorithm, a non-fixed basis modular exponentiation operation method based on a sliding window algorithm, a modular multiplication calculation method based on Montgomery's algorithm and Karatsuba's algorithm, and a basic operation method based on assembly instructions of GPU hardware are adopted to execute the corresponding first decryption calculation task and obtain the corresponding first decryption calculation data.

[0105] In some embodiments, through each third GPU thread, a modular operation method based on Barrett's algorithm, a non-fixed basis modular exponentiation operation method based on a sliding window algorithm, a modular multiplication calculation method based on Montgomery's algorithm and Karatsuba's algorithm, and a basic operation method based on assembly instructions of GPU hardware are adopted to execute the corresponding second decryption calculation task and obtain the corresponding second decryption calculation data.

[0106] Here, when performing decryption operations through each thread, it is first necessary to use the modular operation method based on the Barrett algorithm to perform modular operations, then use the non-fixed basis modular exponentiation operation method based on the sliding window algorithm to perform modular exponentiation operations, and then use the modular multiplication calculation method optimized by the Montgomery algorithm and the Karatsuba algorithm to perform modular multiplication operations, and use the basic operation method based on the assembly instructions of the GPU hardware to perform addition operations.

[0107] Here, the modular operation method based on the Barrett algorithm is used to simplify the modular operation by using the pre-calculation process, and to replace the large integer division operation with the shift operation. The Barrett algorithm, also known as the Barrett Reduction algorithm, uses the shift operation instead of the division operation.

[0108] Exemplarily, the modular operation method based on Barrett's algorithm includes:

[0109] (1) Pre-calculation step

[0110] For modular operations modulo n, precompute the parameters where k = log b n+1.

[0111] (2) Modulo operation steps

[0112] Substitute the μ calculated in step (1) into , calculate q, and use q to calculate c = (amodb k +1 )-(q·nmodb k+1 ), get c;

[0113] If c<0, then calculate c=c+b k+1 ;

[0114] If c≥n, then calculate c=cn.

[0115] In the present invention, a non-fixed basis modular exponentiation method based on a sliding window algorithm is used to generate a local pre-calculation table by performing a pre-calculation window calculation, and execute a modular multiplication calculation method based on the Montgomery algorithm and the Karatsuba algorithm, and perform a non-fixed basis modular exponentiation operation by querying the generated local pre-calculation table.

[0116] Exemplarily, the non-fixed basis modular exponentiation method based on the sliding window algorithm includes:

[0117] (1) Pre-calculation step

[0118] Set t0=1, t1=a, t2=a, c=1;

[0119] The exponent b of the modular exponentiation operation is expressed in its ω1-base representation, that is,

[0120] Calculate t in sequence j =t j-1 t1, where

[0121] Here, the non-fixed basis modular exponentiation operation can be expressed as c=a^b(mod n^2), where b is the exponent of the modular exponentiation operation; and t represents a temporary pre-calculated table that needs to be used in the process of the non-fixed basis modular exponentiation operation method.

[0122] (2) Cycle calculation steps

[0123] In the above step (2), in the first loop, the value of i is l-1, and in the second loop, the value of i is, until the value of i is 0, the loop calculation ends, and the steps of each thread in each loop calculation are as follows:

[0124] a)

[0125] b) Substitute the c calculated in step a) into In the process, c is calculated and the calculated c is used as the input value of step a) in the next cycle calculation;

[0126] (3) At the end of the loop calculation, output c obtained in step b), where c = a b modn.

[0127] S104. According to the second ciphertext message and the third ciphertext message sent by the CPU device end, a homomorphic addition operation is performed in parallel by multiple fourth GPU threads of the GPU device end to generate a fourth ciphertext message, and the fourth ciphertext message is sent to the CPU device end.

[0128] In the embodiment of the present invention, the CPU device side can obtain the second ciphertext message and the third ciphertext message; and send the second ciphertext message and the third ciphertext message to the GPU device side.

[0129] Here, the CPU device side can obtain the second ciphertext message and the third ciphertext message respectively by receiving the second ciphertext message and the third ciphertext message input by the user.

[0130] In some embodiments, each fourth GPU thread performs homomorphic addition operations through a modular multiplication calculation method based on the Montgomery algorithm and the Karatsuba algorithm, and a basic operation method based on assembly instructions of GPU hardware.

[0131] In some embodiments, the GPU device side determines multiple parallel homomorphic addition computing tasks based on the second ciphertext message and the third ciphertext message; distributes the multiple homomorphic addition computing tasks to multiple fourth GPU threads; executes the corresponding homomorphic addition computing tasks through each fourth GPU thread to obtain corresponding homomorphic addition computing data; and obtains the fourth ciphertext message based on the multiple homomorphic addition computing data corresponding to the multiple homomorphic addition computing tasks.

[0132] Here, through each fourth GPU thread, a modular multiplication calculation method based on the Montgomery algorithm and the Karatsuba algorithm, as well as a basic operation method based on the assembly instructions of the GPU hardware are adopted to execute the corresponding homomorphic addition calculation task and obtain the corresponding homomorphic addition calculation data.

[0133] Here, the GPU device can split the ciphertext sequence C1 and the ciphertext sequence C2 to obtain multiple groups of split data, each group of split data includes the ciphertext data in the ciphertext sequence C1 and the ciphertext data in the ciphertext sequence C2, and distribute these multiple groups of split data to multiple GPU threads for execution, so that multiple GPU threads perform corresponding calculations to obtain multiple homomorphic addition calculation data.

[0134] For example, the ciphertext sequence C1 = {c 11 ,c 12 ,...,c 1k}, C2={c 21 ,c 22 ,...,c 2k}, the GPU device can split the ciphertext sequence C1 and the ciphertext sequence C2, and then start k GPU threads to calculate multiple homomorphic addition calculation data: c1'=c 11 ×c 21 modn 2 , c2'=c 12 ×c 22 modn 2 , …, c k '=c 1k ×c 2k modn 2 , and obtain the plaintext sequence C'={c'1,c'2,...,c' k}.

[0135] In the embodiment of the present invention, the first GPU thread, the second GPU thread, the third GPU thread and the fourth GPU thread may be the same GPU thread or different GPU threads, which is not limited in the embodiment of the present invention.

[0136] In an embodiment of the present invention, the calculation, encryption and decryption and other homomorphic operations of the global pre-calculation table are transferred to the GPU for parallel calculation. On the one hand, the global pre-calculation table is generated on the GPU side, which can improve the throughput of subsequent encryption calculations; on the other hand, the GPU has strong computing power, so it can allow more complex encryption calculations, thereby improving the security of the encrypted data; on the other hand, through parallel homomorphic operation operations, the computing efficiency of homomorphic operations can be improved. In other words, since the GPU has more computing units than the CPU, it can efficiently process computationally intensive data in parallel. The present invention considers the characteristics of the GPU multi-core hardware architecture, transfers the calculation, encryption and decryption and other homomorphic operations of the global pre-calculation table to the GPU, and decomposes the calculation, encryption and decryption and other homomorphic operations of the global pre-calculation table, and performs fine-grained concurrent homomorphic operation operations, which not only improves the throughput during calculation, improves the security of the encrypted data, but also greatly improves the efficiency of homomorphic operation operations such as Paillier encryption and decryption, and can provide efficient homomorphic encryption, decryption and other computing services for homomorphic encryption outsourcing computing services in privacy protection scenarios.

[0137] The embodiment of the present invention also provides a GPU-based Paillier homomorphic encryption and decryption calculation method, which is applied to a CPU device end, such as Figure 2 As shown, the method includes:

[0138] S201. Obtain security parameters, random values, and sliding window parameters.

[0139] S202: Generate cryptographic parameters based on security parameters and random values.

[0140] S203: Calculate the first part of the pre-calculation table based on the sliding window parameters.

[0141] S204: Send the password parameters, sliding window parameters and the first part of the pre-calculated table to the GPU device end.

[0142] S205. Obtain the message to be encrypted, and generate homomorphic encryption parameters corresponding to the message to be encrypted.

[0143] S206. Send the message to be encrypted and the homomorphic encryption parameters to the GPU device.

[0144] S207: Obtain the message to be decrypted and the decryption parameters.

[0145] S208: Send the message to be decrypted and the decryption parameters to the GPU device end.

[0146] S209: Obtain a second ciphertext message and a third ciphertext message.

[0147] S210. Send the second ciphertext message and the third ciphertext message to the GPU device end.

[0148] The embodiment of the present invention also provides a GPU-based Paillier homomorphic encryption and decryption computing system, such as Figure 3 As shown, the system includes: a homomorphic operation module 1 and an arithmetic operation module 2; the arithmetic operation module 2 is used to be called by the homomorphic operation module 1; wherein the homomorphic operation module 1 includes:

[0149] The system initialization and pre-calculation module 11 is used to obtain security parameters, random values, and sliding window parameters from the CPU device side, generate cryptographic parameters based on the security parameters and the random values, calculate the first part of the pre-calculation table based on the sliding window parameters, and send the cryptographic parameters, the sliding window parameters, and the first part of the pre-calculation table to the GPU device side; the GPU device side generates the second part of the pre-calculation table in parallel through multiple first GPU threads of the GPU device side according to the cryptographic parameters, the sliding window parameters, and the first part of the pre-calculation table, and obtain the global pre-calculation table according to the second part of the pre-calculation table and the first part of the pre-calculation table;

[0150] The encryption calculation module 12 is used to obtain the message to be encrypted by the CPU device side, generate homomorphic encryption parameters corresponding to the message to be encrypted, and send the message to be encrypted and the homomorphic encryption parameters to the GPU device side; the GPU device side generates a first ciphertext message in parallel through multiple second GPU threads of the GPU device side according to the global pre-calculation table, the message to be encrypted and the homomorphic encryption parameters, and sends the first ciphertext message to the CPU device side;

[0151] The decryption calculation module 13 is used to obtain the message to be decrypted and the decryption parameter by the CPU device side, and send the message to be decrypted and the decryption parameter to the GPU device side; the GPU device side generates a plaintext message in parallel through multiple third GPU threads of the GPU device side according to the message to be decrypted and the decryption parameter, and sends the plaintext message to the CPU device side;

[0152] The homomorphic addition calculation module 14 is used to obtain the second ciphertext message and the third ciphertext message by the CPU device end, and send the second ciphertext message and the third ciphertext message to the GPU device end; the GPU device end performs a homomorphic addition operation in parallel according to the second ciphertext message and the third ciphertext message through multiple fourth GPU threads of the GPU device end to generate a fourth ciphertext message, and send the fourth ciphertext message to the CPU device end;

[0153] Arithmetic operation module 2 includes:

[0154] A non-fixed basis modular exponentiation operation module 21 based on a sliding window method is used to generate a local pre-calculation table by performing a pre-calculation window calculation when a plaintext message is generated in parallel by multiple third GPU threads, and to perform a modular multiplication calculation method based on the Montgomery algorithm and the Karatsuba algorithm by calling a modular multiplication calculation module based on the Montgomery algorithm and the Karatsuba algorithm, and to perform a non-fixed basis modular exponentiation operation by querying the local pre-calculation table;

[0155] A modular operation module 22 based on the Barrett algorithm, used for performing modular processing when a plaintext message is generated in parallel by multiple third GPU threads;

[0156] A fixed-basis modular exponentiation operation module 23 based on a pre-calculation table is used to perform a modular multiplication calculation method based on the Montgomery algorithm and the Karatsuba algorithm by calling a modular multiplication calculation module based on the Montgomery algorithm and the Karatsuba algorithm when generating the second part of the pre-calculation table through multiple first GPU threads; and when generating the first ciphertext message in parallel through multiple second GPU threads, perform a fixed-basis modular exponentiation operation by querying a global pre-calculation table;

[0157] A modular multiplication calculation module 24 based on the Montgomery algorithm and the Karatsuba algorithm, used for performing modular multiplication and modular square operations based on the Montgomery algorithm, and performing multi-precision multiplication operations in modular multiplication and modular square operations based on the Karatsuba algorithm;

[0158] The basic operation module 25 based on the assembly instructions of the GPU hardware is used to perform addition operations, subtraction operations, multiplication operations and shift operations.

[0159] like Figure 3 As shown, the basic operation module 25 based on the assembly instructions of GPU hardware can be called by the non-fixed basis modular exponentiation operation module 21 based on the sliding window method, the modular operation module 22 based on the Barrett algorithm, the fixed basis modular exponentiation operation module 23 based on the pre-calculated table, and the modular multiplication calculation module 24 based on the Montgomery algorithm and the Karatsuba algorithm.

[0160] The present invention aims at the shortcomings of large computational overhead of homomorphic encryption, decryption and homomorphic operation involved in the privacy protection outsourcing calculation process based on homomorphic encryption technology, and proposes a GPU-based Paillier homomorphic encryption and decryption calculation method. The present invention splits the Paillier homomorphic cryptographic algorithm into a homomorphic operation layer and an arithmetic operation layer, and designs optimization schemes to optimize each calculation module: for the homomorphic operation layer, considering the characteristics of the GPU multi-core hardware architecture, selecting a suitable encryption algorithm variant, and decomposing homomorphic operations such as encryption and decryption, designing fine-grained concurrent homomorphic operation operations, greatly improving the efficiency of homomorphic operation calculations; for the arithmetic operation layer, fully considering the characteristics of the GPU with strong computing power but weak logical processing power, optimizing the basic arithmetic operations used in homomorphic operations, and providing efficient computing building blocks for the implementation of the upper homomorphic operation operation layer. The present invention fully considers the hardware characteristics of the GPU, and performs layered and modular optimization on the Paillier homomorphic encryption algorithm, which mainly includes the fine-grained concurrent computing design of the homomorphic operation operation layer and the optimization design of multiple underlying arithmetic operations. These optimization methods use the multi-core characteristics of GPU to optimize the algorithm concurrently and in parallel, greatly improving the efficiency of Paillier encryption, decryption, and homomorphic addition operations. They can provide efficient homomorphic encryption, decryption, and computing services for homomorphic encryption outsourcing computing services in privacy protection scenarios.

[0161] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.

Claims

1. A GPU-based Paillier homomorphic encryption and decryption calculation method, It is characterized in that Applied to GPU devices, including: According to the password parameters, sliding window parameters and the first part pre-calculation table sent by the CPU device end, wherein the first part pre-calculation table is the first part pre-calculation value, the second part pre-calculation table is generated in parallel by multiple first GPU threads of the GPU device end, this step specifically includes: according to the first part pre-calculation value, determining the second part pre-calculation value as the value to be calculated; according to the sliding window parameter, determining the total number of loop calculations and the multiple first GPU threads corresponding to each loop calculation; in each loop calculation, calculating multiple pre-calculation values ​​by the multiple first GPU threads; using the pre-calculation value corresponding to the total number of loop calculations as the second part pre-calculation value, and using the second part pre-calculation value as the second part pre-calculation table; According to the second part pre-calculation table and the first part pre-calculation table, a global pre-calculation table is obtained; the global pre-calculation table is a plurality of rows of pre-calculation values ​​including the first part pre-calculation values ​​and the second part pre-calculation values; Generate a first ciphertext message in parallel through multiple second GPU threads of the GPU device end according to the global pre-calculation table, the message to be encrypted sent by the CPU device end, and the homomorphic encryption parameter, and send the first ciphertext message to the CPU device end; Generate plaintext messages in parallel through multiple third GPU threads of the GPU device end according to the message to be decrypted and the decryption parameter sent by the CPU device end, and send the plaintext messages to the CPU device end; According to the second ciphertext message and the third ciphertext message sent by the CPU device end, a homomorphic addition operation is performed in parallel by multiple fourth GPU threads of the GPU device end to generate a fourth ciphertext message, and the fourth ciphertext message is sent to the CPU device end.

2. According to the GPU-based Paillier homomorphic encryption and decryption calculation method according to claim 1, It is characterized in that The method of generating a first ciphertext message in parallel by using multiple second GPU threads of the GPU device end according to the global pre-calculation table, the message to be encrypted sent by the CPU device end, and the homomorphic encryption parameter includes: Determining a plurality of first encryption computing tasks in parallel according to the global pre-calculation table, the message to be encrypted or the homomorphic encryption parameter; Allocating the plurality of first encryption computing tasks to the plurality of second GPU threads; Executing the corresponding first encryption calculation task through each second GPU thread to obtain corresponding first encryption calculation data; Determine a plurality of second encryption computing tasks according to a plurality of first encryption computing data corresponding to the plurality of second GPU threads, and assign each second encryption computing task to a second GPU thread; By executing the corresponding second encryption computing task through each second GPU thread, a plurality of second encryption computing data are obtained, and the first ciphertext message is obtained according to the plurality of second encryption computing data.

3. According to the GPU-based Paillier homomorphic encryption and decryption calculation method according to claim 2, It is characterized in that The step of executing the corresponding first encryption calculation task by each second GPU thread to obtain the corresponding first encryption calculation data includes: Through each second GPU thread, a fixed-base modular exponentiation operation method based on a pre-calculated table, a modular multiplication operation method based on the Montgomery algorithm and the Karatsuba algorithm, and a basic operation method based on the assembly instructions of the GPU hardware are adopted to execute the corresponding first encryption calculation task and calculate the corresponding first encryption calculation data.

4. The GPU-based Paillier homomorphic encryption and decryption calculation method according to claim 1, It is characterized in that The method of generating plaintext messages in parallel by using a plurality of third GPU threads of the GPU device end according to the message to be decrypted and the decryption parameter sent by the CPU device end includes: Determining a plurality of first decryption computing tasks in parallel according to the message to be decrypted and the decryption parameter; Allocating the plurality of first decryption computing tasks to the plurality of third GPU threads; Executing the corresponding first decryption calculation task through each third GPU thread to obtain corresponding first decryption calculation data; Determine a plurality of second decryption computing tasks according to a plurality of first decryption computing data corresponding to the plurality of third GPU threads, and assign each second decryption computing task to a third GPU thread; By executing the corresponding second decryption computing task through each third GPU thread, a plurality of second decryption computing data are obtained, and the plaintext message is obtained according to the plurality of second decryption computing data.

5. According to the GPU-based Paillier homomorphic encryption and decryption calculation method of claim 4, It is characterized in that The step of executing the corresponding first decryption computing task by each third GPU thread to obtain the corresponding first decryption computing data includes: Through each second GPU thread, a modular operation method based on the Barrett algorithm, a non-fixed basis modular exponentiation operation method based on the sliding window algorithm, a modular multiplication calculation method based on the Montgomery algorithm and the Karatsuba algorithm, and a basic operation method based on the assembly instructions of the GPU hardware are adopted to execute the corresponding first decryption calculation task and obtain the corresponding first decryption calculation data.

6. The GPU-based Paillier homomorphic encryption and decryption computing method according to claim 1, It is characterized in that The method of performing a homomorphic addition operation in parallel by multiple fourth GPU threads of the GPU device end according to the second ciphertext message and the third ciphertext message sent by the CPU device end to generate a fourth ciphertext message includes: Determining a plurality of parallel homomorphic addition computing tasks according to the second ciphertext message and the third ciphertext message; Allocating the plurality of homomorphic addition computing tasks to the plurality of fourth GPU threads; By executing the corresponding homomorphic addition calculation task through each fourth GPU thread, corresponding homomorphic addition calculation data is obtained; The fourth ciphertext message is obtained according to multiple homomorphic addition calculation data corresponding to the multiple homomorphic addition calculation tasks.

7. The GPU-based Paillier homomorphic encryption and decryption calculation method according to claim 6, It is characterized in that The step of executing the corresponding homomorphic addition calculation task by each fourth GPU thread to obtain the corresponding homomorphic addition calculation data includes: Through each fourth GPU thread, a modular multiplication calculation method based on the Montgomery algorithm and the Karatsuba algorithm, as well as a basic operation method based on the assembly instructions of the GPU hardware are adopted to execute the corresponding homomorphic addition calculation task and obtain the corresponding homomorphic addition calculation data.

8. A GPU-based Paillier homomorphic encryption and decryption calculation method, It is characterized in that Applied to CPU device side, including: Get security parameters, random values, and sliding window parameters; Based on the security parameter and the random value, generate a cryptographic parameter; Based on the sliding window parameters, calculate a first part of the pre-calculated table; Sending the password parameter, the sliding window parameter, and the first part of the pre-calculation table to the GPU device end, so that the GPU device end generates a second part of the pre-calculation table in parallel through multiple first GPU threads of the GPU device end according to the password parameter, the sliding window parameter, and the first part of the pre-calculation table, and obtains a global pre-calculation table according to the second part of the pre-calculation table and the first part of the pre-calculation table; Obtaining a message to be encrypted, and generating homomorphic encryption parameters corresponding to the message to be encrypted; Sending the message to be encrypted and the homomorphic encryption parameters to the GPU device end, so that the GPU device end generates a first ciphertext message in parallel through multiple second GPU threads of the GPU device end according to the global pre-calculation table, the message to be encrypted and the homomorphic encryption parameters, and sending the first ciphertext message to the CPU device end; Get the message to be decrypted and the decryption parameters; Sending the message to be decrypted and the decryption parameter to the GPU device end, so that the GPU device end generates a plaintext message in parallel through multiple third GPU threads of the GPU device end according to the message to be decrypted and the decryption parameter, and sends the plaintext message to the CPU device end; Obtaining a second ciphertext message and a third ciphertext message; The second ciphertext message and the third ciphertext message are sent to the GPU device end, so that the GPU device end performs homomorphic addition operations in parallel according to the second ciphertext message and the third ciphertext message through multiple fourth GPU threads of the GPU device end to generate a fourth ciphertext message, and send the fourth ciphertext message to the CPU device end.

9. A GPU-based Paillier homomorphic encryption and decryption computing system. It is characterized in that include: Homomorphic operation module and arithmetic operation module; The arithmetic operation module is used to be called by the homomorphic operation module; The homomorphic operation module comprises: The system initialization and pre-calculation module is used to obtain security parameters, random values, and sliding window parameters from the CPU device side, generate password parameters based on the security parameters and the random values, calculate the first part of the pre-calculation table based on the sliding window parameters, and send the password parameters, the sliding window parameters, and the first part of the pre-calculation table to the GPU device side, wherein the first part of the pre-calculation table is the first part of the pre-calculation value; the GPU device side determines the second part of the pre-calculation value as the value to be calculated based on the first part of the pre-calculation value; the total number of loop calculations and the multiple first GPU threads corresponding to each loop calculation are determined based on the sliding window parameters; in each loop calculation, multiple pre-calculation values ​​are calculated by the multiple first GPU threads; the pre-calculation value corresponding to the total number of loop calculations is used as the second part of the pre-calculation value, the second part of the pre-calculation value is used as the second part of the pre-calculation table, and a global pre-calculation table is obtained based on the second part of the pre-calculation table and the first part of the pre-calculation table; the global pre-calculation table is a multi-row pre-calculation value including the first part of the pre-calculation value and the second part of the pre-calculation value; The encryption calculation module is used to obtain the message to be encrypted by the CPU device end, generate homomorphic encryption parameters corresponding to the message to be encrypted, and send the message to be encrypted and the homomorphic encryption parameters to the GPU device end; the GPU device end generates a first ciphertext message in parallel through multiple second GPU threads of the GPU device end according to the global pre-calculation table, the message to be encrypted and the homomorphic encryption parameters, and sends the first ciphertext message to the CPU device end; The decryption calculation module is used to obtain the message to be decrypted and the decryption parameter by the CPU device end, and send the message to be decrypted and the decryption parameter to the GPU device end; the GPU device end generates a plaintext message in parallel through multiple third GPU threads of the GPU device end according to the message to be decrypted and the decryption parameter, and sends the plaintext message to the CPU device end; A homomorphic addition calculation module is used to obtain a second ciphertext message and a third ciphertext message by the CPU device end, and send the second ciphertext message and the third ciphertext message to the GPU device end; the GPU device end performs a homomorphic addition operation in parallel according to the second ciphertext message and the third ciphertext message through multiple fourth GPU threads of the GPU device end to generate a fourth ciphertext message, and send the fourth ciphertext message to the CPU device end; The arithmetic operation module comprises: A non-fixed basis modular exponentiation operation module based on a sliding window method, used for, when a plaintext message is generated in parallel by the plurality of third GPU threads, generating a local pre-calculation table by performing a pre-calculation window calculation, and executing a modular multiplication calculation method based on the Montgomery algorithm and the Karatsuba algorithm by calling a modular multiplication calculation module based on the Montgomery algorithm and the Karatsuba algorithm, and performing a non-fixed basis modular exponentiation operation by querying the local pre-calculation table; A modular operation module based on the Barrett algorithm, used for performing modular processing when plaintext messages are generated in parallel by the plurality of third GPU threads; A fixed-basis modular exponentiation operation module based on a pre-calculation table is used to execute the modular multiplication calculation method based on the Montgomery algorithm and the Karatsuba algorithm by calling the modular multiplication calculation module based on the Montgomery algorithm and the Karatsuba algorithm when generating the second part of the pre-calculation table through the multiple first GPU threads; and when generating the first ciphertext message in parallel through the multiple second GPU threads, perform a fixed-basis modular exponentiation operation by querying the global pre-calculation table; The modular multiplication calculation module based on the Montgomery algorithm and the Karatsuba algorithm is used for performing modular multiplication and modular square operations based on the Montgomery algorithm, and performing multi-precision multiplication operations in modular multiplication and modular square operations based on the Karatsuba algorithm; A basic operation module based on the assembly instructions of GPU hardware, used to perform addition, subtraction, multiplication and shift operations.