Data processing method and related device

By performing modular arithmetic on encrypted data using an approximation algorithm, the problem of high computational load and transmission overhead for encrypted data is solved, achieving more efficient computation and data transmission.

CN121456889APending Publication Date: 2026-02-03HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411049123.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-31
Publication Date
2026-02-03

AI Technical Summary

Technical Problem

During data processing, using encrypted data increases the device's computational load, increases data transmission overhead, and the size of intermediate results of encrypted data is larger than the input data, resulting in a waste of computing and transmission resources.

Method used

An approximation algorithm is used to solve for the approximate value of the reduction factor in the modular operation. The encrypted data is reduced by reducing the data size, and the computational load and transmission overhead are reduced.

Benefits of technology

Modular operations are used to reduce encrypted data, thereby reducing the computational load on devices and the overhead of data transmission, and improving computational efficiency and data handling efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121456889A_ABST
    Figure CN121456889A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data processing method and a related device, which are used for reducing intermediate data generated by performing operation on encrypted data based on modular operation and reducing the size of the encrypted data, so that the operation load of equipment is reduced, the data handling efficiency is improved, and the overall operation efficiency is improved. The method comprises the following steps: operating first ciphertext data and second ciphertext data by adopting an approximate operation algorithm to obtain a target reduction multiple which is used for replacing a reduction multiple obtained by operating the first ciphertext data and the second ciphertext data based on multiplication, the reduction multiple is used for controlling the numerical value of an output result obtained by performing modular operation based on data; and performing modular operation on the first ciphertext data and the second ciphertext data according to the target reduction multiple to obtain target ciphertext data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data analysis, and more particularly to a data processing method and related apparatus. Background Technology

[0002] With the development of social informatization and digitalization, the application and circulation of data are becoming more frequent. Based on the current large demand for data applications, users need to perform calculations on the data they possess or that is managed by them. In some important production and research scenarios, data processing requires relatively advanced and powerful hardware resources, while users often lack sufficient software / hardware computing capabilities. In such cases, users can upload their data to the cloud via data transmission channels such as the internet, where the cloud performs the data processing and returns the results to the user.

[0003] Currently, to prevent data from being eavesdropped on or stolen by malicious third parties during data transmission, the data can be encrypted and transmitted to the cloud. The cloud can then directly process the encrypted data and return the ciphertext of the calculation result expected by the user.

[0004] However, since processing encrypted data generates a large amount of intermediate data, which is also encrypted, and the size of this intermediate data is greater than or equal to the encrypted data input for processing, processing encrypted data requires more computing and storage resources than processing unencrypted data, thus increasing the computational load on the device. Furthermore, the data transfer overhead between various components of the computing device, as well as between the client and the cloud, is also greater. Summary of the Invention

[0005] This application provides a data processing method and related apparatus for reducing intermediate data generated by performing modular arithmetic on encrypted data, thereby reducing the size of the encrypted data, reducing the computational load on the device, improving data handling efficiency, and increasing overall computational efficiency.

[0006] Firstly, this application provides a data processing method in which a communication connection exists between a client and a server. A user can transmit encrypted data to the server via the client, and the server then performs calculations on the encrypted data and sends the result back to the client. Firstly, the server can perform approximate calculations on the first and second ciphertext data within the encrypted data to obtain a target reduction factor. This target reduction factor is used to replace the reduction factor obtained by performing multiplication operations on the first and second ciphertext data. This reduction factor controls the numerical value of the output result obtained by modulo operations on the data. After obtaining the target reduction factor, a modulo operation can be performed on the first and second ciphertext data to obtain the target ciphertext data.

[0007] In this embodiment, modular arithmetic can be used to perform operations on encrypted data. Specifically, an approximation algorithm can be employed to first obtain an approximate value of the reduction factor in the modular arithmetic, i.e., the target reduction factor, thereby improving the computational efficiency of the reduction factor and consequently improving the computational efficiency of the modular arithmetic. Furthermore, using modular arithmetic to operate on encrypted data can reduce its size, thereby reducing the storage load on the encrypted data and the overhead of data transmission between the client and server.

[0008] In one possible implementation, the aforementioned operation of the first ciphertext data and the second ciphertext data using an approximation algorithm to obtain the target reduction factor may include: performing an operation on the second ciphertext data, the modulus, and a preset constant to obtain the third ciphertext data; and performing an operation on the first ciphertext data and the third ciphertext data using an approximation algorithm to obtain the target reduction factor.

[0009] In this embodiment, an approximation algorithm can be used to obtain a target reduction factor based on the encrypted data. This target reduction factor can be used instead of the reduction factor obtained by conventional multiplication, so that subsequent modulo operations can be performed on the encrypted data based on the target reduction factor to reduce the size of the encrypted data.

[0010] In one possible implementation, the aforementioned approximation algorithm used to perform calculations on the first and third ciphertext data to obtain the target reduction factor may include: when the first and / or third ciphertext data do not meet preset conditions, dividing the first and / or third ciphertext data according to a fixed number of bits to obtain the divided first and third ciphertext data. The divided first ciphertext data includes a first high-order bit portion and a first low-order bit portion, and the divided third ciphertext data includes a second high-order bit portion and a second low-order bit portion. The fixed number of bits is obtained based on the maximum number of bits supported by the device using saturation calculation; and performing calculations using an approximation algorithm based on the divided first and third ciphertext data to obtain the target reduction factor.

[0011] In one possible implementation, the aforementioned calculation based on the divided first ciphertext data and the divided third ciphertext data, using an approximation algorithm to obtain the target reduction factor, may include: performing calculations on the first high-order part and the second high-order part to obtain high-order ciphertext data; determining the data carry based on the first high-order part, the first low-order part, the second high-order part, and the second low-order part; and obtaining the target reduction factor based on the high-order ciphertext data and the data carry.

[0012] In this embodiment, based on the divided encrypted data, only the operation results between the high-order bits and the effective carry between the high-order and low-order bits are needed to obtain an approximate value of the reduction factor, while ignoring the operation between the low-order bits of the encrypted data. Since only the operation between the high-order bits and the effective carry need to be considered, the calculation efficiency of the reduction factor can be improved.

[0013] In one possible implementation, the aforementioned determination of data carry based on the first high-order portion, the first low-order portion, the second high-order portion, and the second low-order portion may include: determining a first data carry based on the result of an operation performed on the first high-order portion and the second low-order portion using an approximation algorithm; determining a second data carry based on the result of an operation performed on the first low-order portion and the second high-order portion using an approximation algorithm; and obtaining the data carry based on the first data carry and the second data carry.

[0014] In one possible implementation, the aforementioned process of obtaining the target reduction factor based on the high-order ciphertext data and the data carry may include: adding the high-order ciphertext data and the data carry to obtain a temporary reduction factor; and taking a preset number of bits of data starting from the least significant bit of the temporary reduction factor as the target reduction factor, wherein the preset number of bits is obtained based on a fixed number of bits.

[0015] In one possible implementation, the aforementioned modulo operation on the first ciphertext data and the second ciphertext data based on the target reduction factor to obtain the target ciphertext data may include: performing a modulo operation on the target reduction factor, the first ciphertext data, the second ciphertext data, and the modulus to obtain temporary ciphertext data; and taking a preset number of bits of data starting from the least significant bit of the temporary ciphertext data as the target ciphertext data.

[0016] Secondly, this application provides a data processing apparatus, comprising: a first calculation module, configured to perform an approximation calculation algorithm on first encrypted data and second encrypted data to obtain a target reduction factor, the target reduction factor being used to replace the reduction factor obtained by performing a multiplication operation on the first encrypted data and second encrypted data, the reduction factor being used to control the numerical value of the output result obtained by performing a modulo operation on the data; and a second calculation module, configured to perform a modulo operation on the first encrypted data and second encrypted data according to the target reduction factor to obtain the target encrypted data.

[0017] In one possible implementation, the aforementioned first calculation module is specifically used to: perform calculations on the second ciphertext data, the modulus, and a preset constant to obtain the third ciphertext data; and use an approximation calculation algorithm to perform calculations on the first ciphertext data and the third ciphertext data to obtain the target reduction factor.

[0018] In one possible implementation, the aforementioned first calculation module is specifically used to: when the first ciphertext data and / or the third ciphertext data do not meet the preset conditions, divide the first ciphertext data and / or the third ciphertext data according to a fixed number of bits to obtain the divided first ciphertext data and the divided third ciphertext data. The divided first ciphertext data includes a first high-order part and a first low-order part, and the divided third ciphertext data includes a second high-order part and a second low-order part. The fixed number of bits is obtained according to the maximum number of bits supported by the device using saturation calculation; and perform calculations using an approximation calculation algorithm based on the divided first ciphertext data and the divided third ciphertext data to obtain the target reduction factor.

[0019] In one possible implementation, the aforementioned first calculation module is specifically used to: perform calculations on the first high-order part and the second high-order part to obtain high-order ciphertext data; determine the data carry based on the first high-order part, the first low-order part, the second high-order part, and the second low-order part; and obtain the target reduction factor based on the high-order ciphertext data and the data carry.

[0020] In one possible implementation, the aforementioned first calculation module is specifically used to: determine a first data carry based on the calculation result of the operation on the first high-order part and the second low-order part based on the approximate calculation algorithm; determine a second data carry based on the calculation result of the operation on the first low-order part and the second high-order part based on the approximate calculation algorithm; and obtain the data carry based on the first data carry and the second data carry.

[0021] In one possible implementation, the aforementioned first arithmetic module is specifically used to: add the high-order ciphertext data to the data carry to obtain a temporary reduction factor; and take a preset number of bits of data starting from the least significant bit of the temporary reduction factor as the target reduction factor, wherein the preset number of bits is obtained based on a fixed number of bits.

[0022] In one possible implementation, the aforementioned second calculation module is specifically used to: perform a modulo operation on the target reduction factor, the first ciphertext data, the second ciphertext data, and the modulus to obtain temporary ciphertext data; and take a preset number of bits of data starting from the least significant bit of the temporary ciphertext data as the target ciphertext data.

[0023] Thirdly, this application provides a data processing apparatus, which includes: a processor, a memory, an input / output device, and a bus; the memory stores computer instructions; when the processor executes the computer instructions in the memory, the memory stores computer instructions; when the processor executes the computer instructions in the memory, it is used to implement a method as described in the first aspect or any possible implementation of the first aspect.

[0024] Fourthly, embodiments of this application provide a computer-readable storage medium. The computer-readable storage medium stores computer instructions; when the computer instructions are executed on a computer, the computer causes the computer to perform the method as described in the first aspect or any possible implementation thereof.

[0025] Fifthly, embodiments of this application provide a computer program product. This computer program product includes a computer program or instructions that, when executed on a computer, cause the computer to perform the method described in the first aspect or any possible implementation thereof.

[0026] The technical effects of the second to fifth aspects or any of the possible implementations thereof can be found in the first aspect or the technical effects of the relevant possible implementations thereof, and will not be repeated here. Attached Figure Description

[0027] Figure 1 A schematic diagram of a system architecture is provided for this application;

[0028] Figure 2 A flowchart illustrating a data processing method provided in this application;

[0029] Figure 3 This is a diagram illustrating conventional multiplication.

[0030] Figure 4 This is a diagram illustrating the division of encrypted data.

[0031] Figure 5 A schematic diagram illustrating the calculation process of xt / β;

[0032] Figure 6 A flowchart illustrating the process of finding approximate values ​​using an approximation algorithm;

[0033] Figure 7 The computational process of using an approximation algorithm to perform approximate calculations on the input data;

[0034] Figure 8 The calculation process of solving target ciphertext data based on encrypted data;

[0035] Figure 9 A comparison chart with the classic Shoup modular multiplication method;

[0036] Figure 10 A schematic diagram of the structure of a data processing device provided in this application;

[0037] Figure 11 A schematic diagram of another data processing device provided in this application. Detailed Implementation

[0038] The following will describe the technical solutions in the embodiments of the present application in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present application.

[0039] For ease of understanding, some concepts related to the present application will be introduced first.

[0040] 1. Approximate computing

[0041] Approximate computing is an evaluation strategy that returns a possibly inaccurate result, or the calculation process does not guarantee the accuracy of the result. It is usually used in applications where an approximate result is sufficient to meet its purpose. Its basic idea is to reduce the amount of calculation or improve the solution speed by simplifying the problem model, adopting approximate algorithms or numerical methods, while ensuring that the quality of the solution (i.e., the precision or accuracy of the solution) is within an acceptable range.

[0042] 2. Saturation arithmetic

[0043] Saturation arithmetic is a mathematical operation method mainly used to handle the situation where the operation result exceeds a predetermined range (i.e., the upper limit or the lower limit). Its core idea is to limit the result to this maximum or minimum value when the operation result exceeds the preset maximum or minimum value, rather than allowing it to continue to overflow. For example, when the operation range is [0, 100], 30 + 80 = 100 instead of 110, and 2 - 5 = 0 instead of -3.

[0044] 3. Modulo operation

[0045] Given integers a and q (q ≥ 1), calculate a ÷ q (which can also be written as a / q). If the remainder is equal to r (0 ≤ r < q), then r is called the remainder of a divided by q, and q is called the modulus. The calculation process to find r can be written as r ≡ a mod q (or written as r = a % q), where mod and % are modulo operators, and this calculation process is called modulo operation, or simply modulo arithmetic.

[0046] 4. Modular multiplication

[0047] Given integers a, b and q (q ≥ 1), calculate a * b mod q (which can also be written as ab mod q, a * b % q, ab % q), and this calculation process is called modular multiplication operation, or modular multiplication.

[0048] 5. Fully homomorphic encryption

[0049] Homomorphic encryption is a form of encryption that allows specific algebraic operations on ciphertext to produce an encrypted result, and decrypting the ciphertext yields the same result as performing the same operations on the plaintext. In other words, this technology allows for operations such as retrieval and comparison within encrypted data to obtain correct results without decryption during the entire process. Its significance lies in fundamentally solving the confidentiality problem when entrusting data and its operations to third parties, such as in various cloud computing applications.

[0050] With the widespread adoption of informatization and digitalization across society, data, as a new type of production material, has generated substantial demand for applications. Users typically need to perform calculations on data they possess or that is managed by them. Since data processing requires advanced and powerful hardware resources, and users often lack sufficient software / hardware computing capabilities, they can transmit data to the cloud via data transmission channels and then obtain the calculation results sent from the cloud. However, due to the potential risk of data leakage during transmission, data can be encrypted before transmission and processing to ensure security. However, processing encrypted data requires more computing resources, resulting in a greater computational load, and involves significant data scheduling between various components of the computing device and between the edge and cloud sides.

[0051] Currently, modular arithmetic includes operations such as modulo, modular addition, and modular multiplication, which can be used to calculate congruence relationships between integers. Modulo operations can be performed on ciphertext data to reduce its size. In data outsourcing scenarios, multiplying variables by constants is the most common and primary operation in ciphertext computation. Therefore, existing modular multiplication methods such as Barrett reduction, Montgomery's ModMul, and Shoup's ModMul can be used to reduce ciphertext data. Among these, Shoup's ModMul employs a non-strict evaluation strategy, which is superior to other methods, and therefore can be used for data reduction in ciphertext.

[0052] However, when using Shoup modular multiplication to reduce ciphertext data, it is necessary to first calculate the reduction factor. To further improve computational efficiency, this application proposes a data processing method. First, an approximate operation algorithm is used to solve for the approximate value of the reduction factor. Then, based on the approximate value of the reduction factor, modular operations are performed between the ciphertext data to obtain the target ciphertext data. The data size of the target ciphertext data is smaller than that of directly performing addition or multiplication operations on the ciphertext data, thereby reducing the data size of the ciphertext data, thus reducing the computational load and data scheduling.

[0053] The following section introduces some possible system architectures provided in this application.

[0054] See Figure 1 This application provides a system architecture 100. System architecture 100 includes a client 110 and a server 120. A communication connection exists between the client 110 and the server 120. The number of clients 110 establishing communication connections with the server 120 can be one or more, and is not limited here. Users can encrypt data on the client 110 and send the encrypted data to the server 120 via a data transmission channel such as the Internet. The server in the server 120 performs calculations on the encrypted data and sends the result back to the client 110. Users can decrypt the result on the client 110 to obtain the desired data. This process can also be seen as the user outsourcing data processing to the server, and can be called data outsourcing. The server in the server 120 can use the data processing method proposed in the embodiments of this application to perform calculations on the encrypted data, thereby reducing the computational load.

[0055] Server 110 is used to implement human-computer interaction and can be deployed on terminal devices, such as personal computers, smartphones, tablets, mobile laptops, etc., without limitation. Server 120 can be deployed in the cloud and may include one or more servers, and may also include one or more computing devices. The servers may be cloud servers, central servers, edge servers, or local servers in local data centers, etc., without limitation. The computing devices may be devices with strong computing capabilities or servers, without limitation.

[0056] It is worth noting that, Figure 1 The system architecture shown is merely an example and is not intended to limit its specific implementation to this example. For instance, in other possible system architectures, the system may include multiple clients, from which the server can obtain data, perform calculations, and send the results back to the corresponding clients. Furthermore, in other possible system architectures, the server may not be deployed in the cloud.

[0057] The method flow provided in this application will be described below in conjunction with the aforementioned system architecture.

[0058] See Figure 2 This application provides a flowchart of a data processing method, as described below.

[0059] Step 201: The server uses an approximation algorithm to calculate the target reduction factor by comparing the first ciphertext data with the second ciphertext data.

[0060] In this embodiment, the user can encrypt data on the client side and then transmit the encrypted data to the server. The server then performs calculations on the acquired encrypted data to ensure data privacy and security. Furthermore, to reduce the computational load when processing encrypted data, modular arithmetic can be used to reduce the encrypted data. Modular arithmetic includes operations such as modulo, modular addition, and modular multiplication. For example, modular multiplication can be performed on encrypted data, and the remainder can represent the product value between encrypted data. The size of the remainder is smaller than the size of the product value between encrypted data, thereby reducing the size of the encrypted data calculation result. This reduces the load on the device for subsequent calculations on the encrypted data, improves data transfer efficiency, and enhances overall computational performance.

[0061] Furthermore, since linear operations, such as addition and multiplication, constitute a large proportion of operations on encrypted data, and addition results in a relatively small increase in data size, this application primarily considers the data size expansion caused by multiplication between two encrypted data items. Performing conventional multiplication on encrypted data typically outputs a result twice the size of the input, such as... Figure 3 As shown. In this embodiment of the application, the intermediate data generated by the operation on the encrypted data can be reduced using Barrett reduction, Montgomery's modmul, and Shoup's modmul. Since Shoup's modmul uses non-strict evaluation, the encrypted data can be reduced based on Shoup's modmul.

[0062] Specifically, when β is a power of 2, q is the modulus and q < β / 2, integers x, y ∈ [0, q) are the input, y is a known number, and the remainder r = xy mod q, the formula for calculating the Shoup modular multiplication can be:

[0063]

[0064] Where l is the reduction factor, which can be used to control the numerical value of the output result obtained by performing a modular operation on the data. The reduction factor can control the size of the result of the modular operation. The smaller the reduction factor, the greater the redundancy factor of the output result.

[0065] Based on this, the server can first determine the reduction factor in Shoop modular multiplication based on the encrypted data. Furthermore, to improve the performance of Shoop modular multiplication and increase the efficiency of data reduction calculations based on Shoop modular multiplication, an approximation algorithm can be used to obtain an approximate value of the reduction factor, i.e., the target reduction factor.

[0066] Specifically, the server can use an approximation algorithm to calculate a target reduction factor based on the first and second ciphertext data in the encrypted data. This target reduction factor is used to replace the reduction factor obtained by multiplying the first and second ciphertext data, where the target reduction factor is an approximation of the reduction factor.

[0067] In this process, after obtaining the first encrypted data x and the second encrypted data y, the server can obtain the third encrypted data t based on the second encrypted data y, the modulus q, and the preset constant β. Subsequently, an approximation algorithm is used to perform calculations on the first encrypted data x and the third encrypted data t to obtain the target reduction factor.

[0068] In this embodiment, saturation operation instructions can be used for computation. Since saturation operation has overflow truncation characteristics, when the data exceeds the upper and / or lower limit of the number of bits supported by the saturation operation instruction, the excess data will be truncated and discarded. In shoup ​​modular multiplication, the high-order bits exceeding the device's representation capacity will be truncated and discarded, and the operation will be performed using the remaining number of bits to limit the data size, thereby reducing the data size and storage load. Before performing operations on encrypted data, the encrypted data can be divided according to a fixed number of bits so that the result of the operation on the encrypted data can satisfy the saturation operation instructions as much as possible. The fixed number of bits can be obtained based on the maximum number of bits supported by the device using the saturation operation instructions. This fixed number of bits is less than or equal to the maximum number of bits supported by the device. For example, if the maximum number of bits supported by the device is 32, the fixed number of bits can be a reasonable value such as 14 or 15. Specific limitations are not specified here, and the setting of the fixed number of bits needs to be determined based on the specific computational situation.

[0069] Optionally, when the first ciphertext data and / or the third ciphertext data do not meet the preset conditions, the first ciphertext data and / or the third ciphertext data can be divided according to a fixed number of bits to obtain the divided first ciphertext data and the divided third ciphertext data. For example, Figure 4 A diagram illustrating the division of encrypted data, as shown below. Figure 4 As shown, x is a 27-bit integer with a fixed bit depth of 14. Based on this fixed bit depth, x is divided into a high-order part and a low-order part, with the low-order part consisting of 14 bits and the high-order part consisting of 13 bits. Subsequently, based on the first and third ciphertext data after the division, an approximation algorithm can be used to calculate the target reduction factor.

[0070] The approximation algorithm is used to calculate the approximate value of the reduction factor based on the first and second ciphertext data. Since the effective data in Shoup modular multiplication only occupies a small portion of the high-order bits of the product xt / β, effectively only the high-order bits of xt are retained, when solving for the approximate value of the reduction factor, only the high-order bits of the encrypted data can be precisely calculated, and the effective carry-over to the high-order bits can be determined, ignoring the calculations in the low-order bits. This reduces the computational load on the device, thereby reducing the computational resources consumed and improving computational efficiency.

[0071] Figure 5 The calculation process for xt / β is as follows: Figure 5 As we can see, since β is a power of 2, xt / β is equivalent to shifting xt to the right by log2β bits, which means that the lower log2β bits of xt are discarded. The true value of xt / β is only the higher bits of xt. The lower log2β bits of xt do not need to be strictly calculated. That is, the lower log2β bits of xt only need to be calculated to determine the carry-over to the higher bits.

[0072] Based on this, the operation process of the approximation algorithm can be understood as follows: based on the high-order and low-order parts of the encrypted data, using saturation operation and bit operation, conventional multiplication is used to solve the problem between the high-order parts of the encrypted data, while the operation between the low-order and high-order parts only requires calculating the valid carry-up. No further operation is performed between the low-order parts of the encrypted data. Then, based on the operation result between the high-order parts and the carry-up obtained from the low-order and high-order parts, the target reduction factor, i.e., the approximate value of the reduction factor, is determined.

[0073] In this embodiment, an approximate value of the reduction factor (also called the target reduction factor) can be obtained using an approximation algorithm. This target reduction factor can be used to replace the original reduction factor. By dividing the encrypted data into high-order and low-order parts based on a fixed number of bits, the target reduction factor can be obtained only based on the calculation results between the high-order parts and the valid carry between the high-order and low-order parts. Calculations between the low-order parts of the encrypted data can be ignored, thereby reducing the computational load on the device and improving computational efficiency.

[0074] Specifically, the first high-order part of the first ciphertext data and the second high-order part of the third ciphertext data can be processed to obtain the high-order ciphertext data; then, the carry-over can be determined based on the first high-order part and the first low-order part of the first ciphertext data and the second high-order part and the second low-order part of the third ciphertext data; and the target reduction factor can be obtained based on the high-order ciphertext data and the carry-over.

[0075] For example, Figure 6 This is a flowchart illustrating the process of solving for approximate values ​​using an approximation algorithm. Figure 6It can be seen that, firstly, based on the number of bits in the input data x (first ciphertext data) and t (third ciphertext data), when the number of bits in the input data does not meet the preset condition, the input data can be divided into a high-order part x according to a fixed number of bits. high and t high and the lower part x low and t low Then calculate prodapprox(x) respectively. low , t high ), prodapprox(x high , t low And solving for x using conventional multiplication operations. high *t high Here, `prodapprox` is an approximate calculator. This calculator processes input data by determining whether it meets preset conditions. When the input data meets the conditions, it performs calculations based on conventional multiplication. When the input data does not meet the conditions, it further divides the data into segments with a fixed number of bits. The higher-order bits of the divided data are then multiplied using conventional multiplication, and the approximate calculator is called to perform calculations between the higher and lower-order bits, ignoring the calculations between the lower-order bits. According to `prodapprox(x)`... low , t high ), prodapprox(x high , t low Determine the valid carry, and combine it with x. high *t high The calculation results in an approximate value of x*t.

[0076] Among them, for prodapprox(x) low , t high To perform calculations, an approximate calculation algorithm is used to calculate x. low and t high When performing calculations, you can first determine x. low and t high Does the preset condition meet, when x low and t high If the preset conditions are not met, x can continue to be adjusted according to a fixed number of bits. low and t high Divide into, and obtain and And based on the approximate calculation algorithm, it is possible to... and Perform regular multiplication on the higher-order parts (i.e., the partitioned portion) and calculate prodapprox. and prodapprox And continue to judge and If a preset condition is met, the data partitioning stops, and regular multiplication is performed on the data that meets the preset condition. When x... low and t high When the preset conditions are met, conventional multiplication can be used on x. low and t high The calculation is then performed. Finally, the results of the multiplication of all the higher-order parts during the approximation process are combined with the results of the calculation based on the data that finally meets the preset conditions to obtain the final approximate result.

[0077] The approximation calculation process based on the approximation algorithm is as follows: Figure 7 As shown, Figure 7 This refers to the process of using an approximation algorithm to perform approximate calculations on the input data. Figure 7 In this context, the maximum value of data that a device can represent is 2. base -1. Based on this, the preset condition can be set to the bit length of the input data being less than or equal to base / 2, or it can be set to be less than or equal to other reasonable values. The specifics are not limited here.

[0078] Optionally, a first data carry can be determined based on the result of the operation on the first high-order part and the second low-order part; a second data carry can be determined based on the result of the operation on the first low-order part and the second high-order part; and then, a data carry can be determined based on the first data carry and the second data carry.

[0079] Optionally, the obtained high-order ciphertext data and the data carry can be added to obtain a temporary reduction factor. At this time, the temporary reduction factor may exceed the fixed number of bits. Based on the saturation operation instruction, after obtaining the temporary reduction factor, a preset number of bits can be taken from the least significant bit of the temporary reduction factor as the target reduction factor. The preset number of bits is obtained based on the fixed number of bits. For example, if the fixed number of bits is 14, the preset number of bits can be 28.

[0080] Step 202: Based on the target reduction factor, the server performs a modulo operation on the first ciphertext data and the second ciphertext data to obtain the target ciphertext data.

[0081] After obtaining the target reduction factor, the server can perform a modular operation on the first and second ciphertext data based on the calculation formula of the Shoup modular multiplication operation to obtain the target ciphertext data.

[0082] In this embodiment, a Shoup modular multiplication operation can be performed on the first and second ciphertext data based on a target reduction factor, replacing the conventional multiplication operation on the first and second ciphertext data. Since the Shoup modular multiplication operation can reduce the data based on a reduction factor, the data size of the result (i.e., the target ciphertext data) is smaller than the result obtained based on conventional multiplication, thereby reducing storage load and the load on data handling.

[0083] Optionally, temporary ciphertext data can be obtained by performing a modular multiplication operation on the target reduction factor, the first ciphertext data, the second ciphertext data, and the modulus. A preset number of bits are then taken from the least significant bit of the temporary ciphertext data as the target ciphertext data. Alternatively, the temporary ciphertext data can be processed according to the maximum number of bits supported by the device, discarding any portion exceeding the maximum number of bits, thus retaining the data within the maximum bit range as the target ciphertext data. Specific details are not limited here.

[0084] The target reduction factor, the first ciphertext data, the second ciphertext data, and the modulus can be substituted into the calculation formula of the Shoup modular multiplication operation. Based on the calculation result obtained from the calculation formula, the data with a preset number of bits from the least significant bit is taken as the final result.

[0085] For example, the input first ciphertext data x, the second ciphertext data y, and the third ciphertext data t obtained from the second ciphertext data are all 27-bit integers, with a fixed number of bits radix = 14 and β = 2. 56 Given a base of 31 and a modulus q of 134217727 (28 bits), the largest available data type is int32_t. First, analysis shows that the product of x and t exceeds the upper limit of the largest data type. Therefore, x and t can be split into fixed 14-bit portions, and the approximate carry value ca can be obtained by calling the prodapprox operation, combined with x. high *t high The value is taken from the lower 28 significant bits to obtain an approximate reduction factor (target reduction factor) l′. Then, based on the target reduction factor l′, it is substituted into the calculation formula of the Shoup modular multiplication algorithm to calculate x. low The lower 28 significant bits of *y and l′*q are each subtracted and then output. The specific calculation process is as follows: Figure 8 As shown. It should be understood that when performing Shoup modular multiplication based on the target reduction factor, the data can be processed according to the maximum number of bits supported by the device, for x low The results of the operations *y and l′*q do not have to be calculated using the method of taking the lower preset number of bits; no specific restrictions are imposed here.

[0086] Figure 9 This is a comparison chart showing the results of this scheme and the classic Shoup modular multiplication method. (By...) Figure 9 As can be seen, compared with the classic Shoup modular multiplication calculator, the data processing method proposed in this application reduces the running time of encrypted data by about 5%. In terms of resource overhead, the number of registers used in the data processing method proposed in this application can be reduced by about 50% compared with the classic Shoup modular multiplication calculator.

[0087] The method flow provided in this application has been described above. The apparatus provided in this application will now be described based on the aforementioned method flow.

[0088] See Figure 10 The present application provides a schematic diagram of the structure of a data processing device, as shown below.

[0089] The first calculation module 1001 is used to perform approximate calculation algorithms on the first ciphertext data and the second ciphertext data to obtain a target reduction factor. The target reduction factor is used to replace the reduction factor obtained by performing multiplication operations on the first ciphertext data and the second ciphertext data. The reduction factor is used to control the numerical value of the output result obtained by performing modulo operations on the data.

[0090] The second operation module 1002 is used to perform a modulo operation on the first ciphertext data and the second ciphertext data according to the target reduction factor to obtain the target ciphertext data.

[0091] In one possible implementation, the aforementioned first calculation module 1001 is specifically used to: perform calculations on the second encrypted data, the modulus, and a preset constant to obtain the third encrypted data; and use an approximation calculation algorithm to perform calculations on the first encrypted data and the third encrypted data to obtain a target reduction factor.

[0092] In one possible implementation, the aforementioned first calculation module 1001 is specifically used to: when the first ciphertext data and / or the third ciphertext data do not meet the preset conditions, divide the first ciphertext data and / or the third ciphertext data according to a fixed number of bits to obtain the divided first ciphertext data and the divided third ciphertext data. The divided first ciphertext data includes a first high-order part and a first low-order part, and the divided third ciphertext data includes a second high-order part and a second low-order part. The fixed number of bits is obtained according to the maximum number of bits supported by the device using saturation calculation; and perform calculations using an approximation calculation algorithm based on the divided first ciphertext data and the divided third ciphertext data to obtain the target reduction factor.

[0093] In one possible implementation, the aforementioned first calculation module 1001 is specifically used to: perform calculations on the first high-order part and the second high-order part to obtain high-order ciphertext data; determine the data carry based on the first high-order part, the first low-order part, the second high-order part, and the second low-order part; and obtain the target reduction factor based on the high-order ciphertext data and the data carry.

[0094] In one possible implementation, the aforementioned first calculation module 1001 is specifically used to: determine a first data carry based on the calculation result of the operation on the first high-order part and the second low-order part based on the approximate calculation algorithm; determine a second data carry based on the calculation result of the operation on the first low-order part and the second high-order part based on the approximate calculation algorithm; and obtain the data carry based on the first data carry and the second data carry.

[0095] In one possible implementation, the aforementioned first arithmetic module 1001 is specifically used to: add the high-order ciphertext data to the data carry to obtain a temporary reduction factor; and take a preset number of bits of data starting from the least significant bit of the temporary reduction factor as the target reduction factor, wherein the preset number of bits is obtained based on a fixed number of bits.

[0096] In one possible implementation, the aforementioned second calculation module 1002 is specifically used to: perform a modulo operation on the target reduction factor, the first ciphertext data, the second ciphertext data, and the modulus to obtain temporary ciphertext data; and take a preset number of bits of data starting from the least significant bit of the temporary ciphertext data as the target ciphertext data.

[0097] See Figure 11 The following is a schematic diagram of another data processing device provided in this application.

[0098] The data processing device 1100 may include one or more central processing units (CPUs) 1101 and a memory 1105, wherein the memory 1105 stores one or more applications or data.

[0099] The memory 1105 can be volatile or persistent storage. The program stored in the memory 1105 can include one or more modules, each module including a series of instruction operations on the server. Furthermore, the central processing unit 1101 can be configured to communicate with the memory 1105 and execute the series of instruction operations in the memory 1105 on the data processing device 1100.

[0100] The data processing device 1100 may also include one or more power supplies 1102, one or more wired or wireless network interfaces 1103, one or more input / output interfaces 1104, and / or one or more operating systems, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.

[0101] The central processing unit 1101 can perform the operations performed by the data processing device in the aforementioned embodiment, which will not be described in detail here.

[0102] This application also provides a computer program product containing instructions. The computer program product may be a software or program product containing instructions, capable of running on a computing device or stored on any usable medium. When the computer program product is run on at least one computing device, it causes the at least one computing device to perform the method provided in this application.

[0103] This application also provides a computer program product containing instructions. The computer program product may be a software or program product containing instructions, capable of running on a computing device or stored on any usable medium. When the computer program product is run on at least one computing device, it causes the at least one computing device to perform the method provided in this application.

[0104] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.

[0105] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, the specific working process of the systems, devices and units described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0106] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

[0107] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0108] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0109] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0110] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0111] Finally, it should be noted that the above are only specific embodiments of this application, but the protection scope of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the protection scope of this application.

Claims

1. A data processing method, characterized in that, include: An approximation algorithm is used to perform calculations on the first ciphertext data and the second ciphertext data to obtain a target reduction factor. The target reduction factor is used to replace the reduction factor obtained by performing calculations on the first ciphertext data and the second ciphertext data based on multiplication. The reduction factor is used to control the numerical value of the output result obtained by performing modulo operations on the data. Based on the target reduction factor, a modulo operation is performed on the first ciphertext data and the second ciphertext data to obtain the target ciphertext data.

2. The method according to claim 1, characterized in that, The step of performing an approximation calculation algorithm on the first ciphertext data and the second ciphertext data to obtain the target reduction factor includes: The third ciphertext data is obtained by performing calculations on the second ciphertext data, the modulus, and a preset constant. The approximation algorithm is used to perform calculations on the first ciphertext data and the third ciphertext data to obtain the target reduction factor.

3. The method according to claim 2, characterized in that, The step of using the approximation algorithm to perform calculations on the first ciphertext data and the third ciphertext data to obtain the target reduction factor includes: When the first ciphertext data and / or the third ciphertext data do not meet the preset conditions, the first ciphertext data and / or the third ciphertext data are divided according to a fixed number of bits to obtain the divided first ciphertext data and the divided third ciphertext data. The divided first ciphertext data includes a first high-order part and a first low-order part, and the divided third ciphertext data includes a second high-order part and a second low-order part. The fixed number of bits is obtained according to the maximum number of bits supported by the device using saturation operation. Based on the first and third ciphertext data after the division, the approximation algorithm is used to calculate the target reduction factor.

4. The method according to claim 3, characterized in that, The step of performing the approximation calculation algorithm based on the first and third ciphertext data after partitioning to obtain the target reduction factor includes: The multiplication operation is performed on the first high-order part and the second high-order part to obtain the high-order ciphertext data; Based on the first high-order portion and the first low-order portion, as well as the second high-order portion and the second low-order portion, determine the data carry; The target reduction factor is obtained by combining the high-order ciphertext data with the data carry-over.

5. The method according to claim 4, characterized in that, The step of determining the data carry based on the first high-order portion and the first low-order portion, as well as the second high-order portion and the second low-order portion, includes: The first data carry is determined based on the result of the operation on the first high-order part and the second low-order part based on the approximate operation algorithm. The second data carry is determined based on the result of the operation performed on the first low-order part and the second high-order part using the approximate operation algorithm. The data carry is obtained based on the first data carry and the second data carry.

6. The method according to claim 4 or 5, characterized in that, The step of obtaining the target reduction factor by carrying over the high-order ciphertext data and the data includes: Add the high-order ciphertext data to the data carry to obtain a temporary reduction factor; The target reduction factor is the number of bits to be taken from the least significant bit of the temporary reduction factor, whereby the preset number of bits is obtained based on the fixed number of bits.

7. The method according to any one of claims 1 to 6, characterized in that, The step of performing a modulo operation on the first ciphertext data and the second ciphertext data according to the target reduction factor to obtain the target ciphertext data includes: The modulo operation is performed on the target reduction factor, the first ciphertext data, the second ciphertext data, and the modulus to obtain temporary ciphertext data; The target ciphertext data is obtained by taking the data of the preset number of bits starting from the least significant bit of the temporary ciphertext data.

8. A data processing apparatus, characterized in that, include: The first calculation module is used to perform approximate calculations on the first ciphertext data and the second ciphertext data using an approximation calculation algorithm to obtain a target reduction factor. The target reduction factor is used to replace the reduction factor obtained by performing multiplication operations on the first ciphertext data and the second ciphertext data. The reduction factor is used to control the numerical value of the output result obtained by performing modulo operations on the data. The second calculation module is used to perform a modulo operation on the first ciphertext data and the second ciphertext data according to the target reduction factor to obtain the target ciphertext data.

9. The apparatus according to claim 8, characterized in that, The first arithmetic module is specifically used for: The third ciphertext data is obtained by performing calculations on the second ciphertext data, the modulus, and a preset constant. The approximation algorithm is used to perform calculations on the first ciphertext data and the third ciphertext data to obtain the target reduction factor.

10. The apparatus according to claim 9, characterized in that, The first arithmetic module is specifically used for: When the first ciphertext data and / or the third ciphertext data do not meet the preset conditions, the first ciphertext data and / or the third ciphertext data are divided according to a fixed number of bits to obtain the divided first ciphertext data and the divided third ciphertext data. The divided first ciphertext data includes a first high-order part and a first low-order part, and the divided third ciphertext data includes a second high-order part and a second low-order part. The fixed number of bits is obtained according to the maximum number of bits supported by the device using saturation operation. Based on the first and third ciphertext data after the division, the approximation algorithm is used to calculate the target reduction factor.

11. The apparatus according to claim 10, characterized in that, The first arithmetic module is specifically used for: The multiplication operation is performed on the first high-order part and the second high-order part to obtain the high-order ciphertext data; Based on the first high-order portion and the first low-order portion, as well as the second high-order portion and the second low-order portion, determine the data carry; The target reduction factor is obtained by combining the high-order ciphertext data with the data carry-over.

12. The apparatus according to claim 11, characterized in that, The first arithmetic module is specifically used for: The first data carry is determined based on the result of the operation on the first high-order part and the second low-order part based on the approximate operation algorithm. The second data carry is determined based on the result of the operation performed on the first low-order part and the second high-order part using the approximate operation algorithm. The data carry is obtained based on the first data carry and the second data carry.

13. The apparatus according to claim 11 or 12, characterized in that, The first arithmetic module is specifically used for: Add the high-order ciphertext data to the data carry to obtain a temporary reduction factor; The target reduction factor is the number of bits to be taken from the least significant bit of the temporary reduction factor, whereby the preset number of bits is obtained based on the fixed number of bits.

14. The apparatus according to any one of claims 8 to 13, characterized in that, The second calculation module is specifically used for: The modulo operation is performed on the target reduction factor, the first ciphertext data, the second ciphertext data, and the modulus to obtain temporary ciphertext data; The target ciphertext data is obtained by taking the data of the preset number of bits starting from the least significant bit of the temporary ciphertext data.

15. A data processing apparatus, characterized in that, include: A processor and a memory, wherein the processor is coupled to the memory; The memory is used to store programs; The processor is configured to execute a program in the memory, such that the method as described in any one of claims 1 to 7 is performed.

16. A computer-readable storage medium comprising instructions that, when executed on a computer, cause the computer to perform the method as claimed in any one of claims 1 to 7.

17. A computer program product comprising instructions that, when run on a computer, cause the computer to perform the method as described in any one of claims 1 to 7.