CN112580063B - Data processing method and device and data processing device - Google Patents
Data processing method and device and data processing device Download PDFInfo
- Publication number
- CN112580063B CN112580063B CN201910927858.5A CN201910927858A CN112580063B CN 112580063 B CN112580063 B CN 112580063B CN 201910927858 A CN201910927858 A CN 201910927858A CN 112580063 B CN112580063 B CN 112580063B
- Authority
- CN
- China
- Prior art keywords
- calculation
- array
- ciphertext
- result
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/602—Providing cryptographic facilities or services
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Bioethics (AREA)
- General Health & Medical Sciences (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Storage Device Security (AREA)
Abstract
The embodiment of the invention provides a data processing method and device and a device for data processing. The method comprises the following steps: determining a scaling coefficient corresponding to ciphertext data to be calculated; carrying out scaling operation on the ciphertext data according to the scaling coefficient; and performing ciphertext-based calculation on the scaled ciphertext data to obtain a first calculation result. The embodiment of the invention can calculate the data on the basis of the ciphertext data so as to ensure the information safety and improve the calculation efficiency of the ciphertext data.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a data processing method and apparatus, and an apparatus for data processing.
Background
At present, for the consideration of information security, data to be transmitted is usually protected by encryption, for example, in the process of transmitting data between servers, between terminals, and between a terminal and a server, data is encrypted into a ciphertext and then the ciphertext is transmitted, so as to prevent important information from leaking and causing loss to individuals or enterprises.
However, the current encryption protection strategy is usually limited to the process of data transmission or data storage, and when data is calculated, the ciphertext of the data needs to be decrypted to obtain the plaintext of the data, and then corresponding calculation operation is performed on the plaintext. Therefore, hidden danger of information leakage can be brought, and information safety cannot be guaranteed.
Disclosure of Invention
Embodiments of the present invention provide a data processing method and apparatus, and an apparatus for data processing, which can perform calculation on data based on ciphertext data, and can improve the calculation efficiency of ciphertext data on the basis of ensuring information security.
In order to solve the above problem, an embodiment of the present invention discloses a data processing method, where the method includes:
determining a scaling coefficient corresponding to ciphertext data to be calculated;
carrying out scaling operation on the ciphertext data according to the scaling coefficient;
and performing ciphertext-based calculation on the scaled ciphertext data to obtain a first calculation result.
In another aspect, an embodiment of the present invention discloses a data processing apparatus, where the apparatus includes:
the coefficient determining module is used for determining a scaling coefficient corresponding to ciphertext data to be subjected to computation;
the scaling processing module is used for carrying out scaling operation on the ciphertext data according to the scaling coefficient;
and the ciphertext calculation module is used for executing ciphertext-based calculation on the zoomed ciphertext data to obtain a first calculation result.
In yet another aspect, an embodiment of the present invention discloses an apparatus for data processing, including a memory, and one or more programs, where the one or more programs are stored in the memory, and configured to be executed by the one or more processors includes instructions for:
determining a scaling coefficient corresponding to ciphertext data to be subjected to calculation;
carrying out scaling operation on the ciphertext data according to the scaling coefficient;
and executing ciphertext-based calculation on the scaled ciphertext data to obtain a first calculation result.
In yet another aspect, an embodiment of the invention discloses a machine-readable medium having stored thereon instructions, which, when executed by one or more processors, cause an apparatus to perform a data processing method as described in one or more of the preceding.
The embodiment of the invention has the following advantages:
before ciphertext-based calculation is executed, a scaling coefficient corresponding to ciphertext data to be calculated is determined, and then the ciphertext data is scaled according to the scaling coefficient, so that the scaled ciphertext data meets the requirement of the numerical range of the calculation to be executed, and ciphertext-based calculation can be executed on the scaled ciphertext data to obtain a first calculation result. In the process, the ciphertext data does not need to be decrypted to obtain plaintext data, the plaintext of the data is not exposed, and the safety of information can be ensured. In addition, the embodiment of the invention does not need to decrypt the plaintext data to judge whether the ciphertext data meets the requirement of the numerical range of the calculation to be executed, can reduce the operation steps of ciphertext calculation and improve the efficiency of ciphertext calculation.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments of the present invention will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive labor.
FIG. 1 is a flow chart of the steps of one data processing method embodiment of the present invention;
FIG. 2 is a block diagram of an embodiment of a data processing apparatus according to the present invention;
FIG. 3 is a block diagram of an apparatus 800 for data processing of the present invention; and
fig. 4 is a schematic diagram of a server in some embodiments of the invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without inventive step based on the embodiments of the present invention, are within the scope of protection of the present invention.
In this embodiment of the present invention, a device for executing the data processing method may provide a multi-party secure computing service, and the multi-party secure computing may be abstractly understood as: the two parties respectively have respective private data, and under the condition that the respective private data are not leaked, the result about the public function can be calculated; when the whole calculation is finished, only the calculation result is known to both sides, and both sides do not know the corresponding data and the intermediate data in the calculation process. Wherein the common function may implement a variety of computational functions such as addition, subtraction, multiplication, division, and the like; and at least one of the private data of the two parties is the ciphertext, so that the calculation between the ciphertext and the ciphertext can be carried out, and the calculation between the ciphertext and the plaintext can also be carried out. The scheme of the invention is realized on the basis of realizing the calculation based on the ciphertext, and the calculation method based on the ciphertext can refer to the realization scheme introduced in the application number 201910252632 of the applicant, and is not described in detail herein.
Method embodiment
Referring to fig. 1, a flowchart illustrating steps of an embodiment of a data processing method according to the present invention is shown, which may specifically include the following steps:
and 103, performing ciphertext-based calculation on the scaled ciphertext data to obtain a first calculation result.
In the embodiment of the invention, the calculation to be executed may refer to calculation based on a ciphertext, in the calculation process based on the ciphertext, the calculation may be performed by using ciphertext data, and an intermediate result generated in the calculation process and a final calculation result may also be performed by using ciphertext data.
In some examples, the ciphertext data is a private data. Wherein the private data refers to data stored in digitized form and not desired to be revealed, which includes but is not limited to: the information processing method comprises the following steps of personal/enterprise identity information, personal/enterprise account information, personal appearance characteristic information, personal/enterprise consumption information (such as bills), information (such as moving routes, browsing duration and the like) generated by a person/enterprise due to software using behaviors, evaluation information collected by the enterprise and having business value, information obtained by analyzing the enterprise according to at least the information, and the like. The digitized form of the storage is exemplified here as data stored in a computer-readable storage medium with private data labels and/or rights, the properties of which it is not desired to reveal being represented in the labels and/or rights set. Wherein the tag includes, but is not limited to, a flag bit (e.g., boolean value, etc.) marked in the database and corresponding to data stored in the database. The rights include, but are not limited to: the right to read and write data, the right to obtain the private data in the clear, etc.
In an alternative embodiment of the present invention, the ciphertext-based computation may be performed by at least two of four computing nodes, and the performing the ciphertext-based computation on the scaled ciphertext data may include:
and communicating with other computing nodes participating in ciphertext computation based on a multi-party secure computing protocol, and executing the ciphertext computation aiming at the scaled ciphertext data.
In the embodiment of the present invention, a multi-party secure computing task may be allocated to four computing nodes to complete the four computing nodes in cooperation, which are respectively referred to as S1, S2, sa, and Sb. For part of multi-party safe computing tasks, only two computing nodes are needed to complete the tasks in a cooperation mode, only two computing nodes S1 and S2 are needed to participate, and for example, addition computing only needs two computing nodes to perform computing. The scheme of the invention does not limit the number of the computing nodes.
And the computing task is used for carrying out data processing on the ciphertext data. In some examples, the ciphertext data is a private data, and the technician stores in advance a program containing business logic for processing the private data in the task management platform, wherein the business logic describes a process for processing the private data through a computer program language, and the process can comprise one or more computing tasks. The business logic refers to a process that technical personnel performs data processing on private data by using one or more computing tasks and obtains the private data according to a natural rule. For example, one business logic includes: and (3) confirming the evaluation process of the repayment capacity of the user A by utilizing the bank deposit quantity, the bank loan quantity, the bank repayment history record and the like of the user A in the banks B1 and B2. As another example, a business logic comprises: and providing a route prompting process of distance and route information between the P1 and the P2 to the terminal equipment held by the user P1 by using the current position information of the users P1 and P2. The scheme of the invention is suitable for any scene of calculation based on the ciphertext. The method comprises the scenes of fusion calculation and the like of the private data.
In an optional embodiment of the present invention, the ciphertext data is obtained by performing a decentralized processing on plaintext data, where the decentralized processing includes: and carrying out fragmentation processing on the plaintext data to obtain at least two ciphertext fragments, and dispersedly storing the at least two ciphertext fragments in at least two storage nodes.
In order to ensure the security of information, the data participating in the multi-party security computing task may be ciphertext data, and the ciphertext data is obtained by encrypting plaintext data. For example, as for the plaintext data x, ciphertext data x ' is obtained through encryption processing, if the ciphertext data x ' is leaked, x ' may be decrypted to recover the plaintext data x, and the plaintext data x is leaked.
In order to avoid the above situation, the embodiments of the present invention may perform a distributed process on plaintext data. The distributed processing is used for encrypting and storing data in a distributed mode, so that the risk that all ciphertext data are stored in the same computing node to cause data leakage is reduced. Specifically, the plaintext data may be sliced to obtain at least two ciphertext slices.
The embodiment of the invention can utilize the encryption algorithm to carry out the fragmentation processing on the plaintext data to obtain at least two ciphertext fragments. For example, for plaintext data x, an encryption algorithm may be used to perform fragmentation processing on the plaintext data x to obtain two ciphertext fragments x1 and x2, and only by obtaining x1 and x2 at the same time, the plaintext data x may be obtained through decryption.
In practical applications, common calculations using taylor expansion include, but are not limited to: exponential calculations and logarithmic calculations. Exponential calculations can be expressed as exp (x, times) and logarithmic calculations can be expressed as log (x, times). Wherein, times represents the number of terms of Taylor expansion, x represents the data of calculation to be executed, and the numerical range requirements corresponding to x are different for different types of calculation to be executed.
Taking the logarithmic calculation as an example, the requirement data x is within the numerical range (0, 1) required for the logarithmic calculation, and if x =3400, x is not within the numerical range (0, 1) required for the logarithmic calculation, and therefore, the logarithmic calculation cannot be performed. In a ciphertext-based computing scenario, if x is ciphertext data, it cannot be directly determined whether the ciphertext data is within a numerical range required for logarithmic computation, and thus, logarithmic computation cannot be directly performed on the ciphertext data.
In order to solve the above problem, in the embodiment of the present invention, before performing ciphertext-based calculation, a scaling coefficient corresponding to ciphertext data to be calculated is first determined, and then scaling operation is performed on the ciphertext data according to the scaling coefficient, so that the scaled ciphertext data meets a requirement of a numerical range of the calculation to be performed, and further, ciphertext-based calculation may be performed on the scaled ciphertext data to obtain a first calculation result.
In an optional embodiment of the present invention, the determining a scaling factor corresponding to ciphertext data to be calculated may specifically include:
s11, constructing a first array according to a preset array magnitude range; the first array comprises division points for dividing the preset magnitude range into different intervals;
step S12, performing multiplication calculation on the first array and the ciphertext data to obtain a first result;
step S13, converting the result smaller than 1 in the first result into a first ciphertext corresponding to a numerical value 1, and converting the result larger than 1 in the first result into a second ciphertext corresponding to a numerical value 0 to obtain a second array consisting of the first ciphertext and the second ciphertext;
step S14, performing subtraction calculation on the previous element and the adjacent next element in the second array to obtain a third array containing each subtraction calculation difference value;
and S15, performing inner product calculation on the third array and the first array to obtain a scaling coefficient corresponding to the ciphertext data.
Wherein the preset order range refers to the order range supported by the system based on the ciphertext calculation, for example, the order range supported by the system is 10 -9 ~10 9 Then, a first array may be constructed according to the preset magnitude range, where the first array includes partitioning points that partition the preset magnitude range into different intervals.
Specifically, the first array may be formed by taking one order of magnitude from each order of magnitude within the preset order of magnitude range. For example, the first array may be: array1= [ a1, a2 \8230an]In a preset order of magnitude range 10 -9 ~10 9 For example, then array1= [10 = -9 ,10 -8 ,10 -7 …10 8 ,10 9 ]. In an embodiment of the invention, the order of magnitude range supported by the system is clear data.
It should be noted that different first arrays may be constructed according to the type of calculation to be performed. For example, the data to be calculated is x (ciphertext of unknown magnitude), and the magnitude range supported by the system is 10 -9 ~10 9 If x is to be logarithmically calculated, then since log (x + y) = logx + logy, and log10 x = xlog 10, then the first array may be constructed as array1= [10 = -9 ,10 -8 ,10 -7 …10 8 ,10 9 ]. If x is to be exponentially calculated, since e (x + y) = e x ×e y Thus, a first array may be constructed as array1= [ e ] -22 ,e -21 ,e -20 ,…e 20 ,e 21 ,e 22 ]。
Then, step S12 is executed to perform multiplication on the first array and the ciphertext data to obtain a first result. Assuming that the ciphertext data is x, performing a multiplication operation on the first array1 and the ciphertext data x, that is, performing a ciphertext-based multiplication operation on each element in the first array1 and the ciphertext data x to obtain a first result.
Step S13 is executed next, the result smaller than 1 in the first result is converted into a first ciphertext corresponding to a value 1, and the result larger than 1 in the first result is converted into a second ciphertext corresponding to a value 0, so as to obtain a second array composed of the first ciphertext and the second ciphertext.
Specifically, cipher-text-based multiplication calculation is performed on each element in the first array1 and cipher-text data x, privacy comparison is performed on each product with 1, if the current product is smaller than 1, the current product is converted into a first cipher-text corresponding to a numerical value 1, if the current product is larger than 1, the current product is converted into a second cipher-text corresponding to a numerical value 0, and finally, a second array consisting of the first cipher-text and the second cipher-text can be obtained.
In an optional embodiment of the present invention, before converting the result smaller than 1 in the first result into the first ciphertext corresponding to the value 1 and converting the result larger than 1 in the first result into the second ciphertext corresponding to the value 0, in step S13, the method may further include:
and carrying out privacy comparison on the result value in the first result and the value 1 to obtain a privacy comparison result.
The privacy comparison refers to comparing the sizes of two ciphertext data, and the ciphertext data is not required to be restored into plaintext data in the comparison process.
In an optional embodiment of the present invention, the performing privacy comparison on the result value in the first result and the value 1 to obtain a privacy comparison result specifically may include:
s21, performing subtraction calculation on the result numerical value and the numerical value 1 to obtain a subtraction calculation result;
step S22, performing bit extraction calculation on the subtraction calculation result to obtain a bit extraction calculation result;
and S23, extracting a calculation result according to the bit, and determining a privacy comparison result of the result value and the value 1.
The compute nodes in embodiments of the present invention may be used to perform compute tasks based on input data, including but not limited to: digital computation processes such as addition, subtraction, multiplication and division, and logical computation of AND, OR and NOT, etc. The input data may be ciphertext fragments obtained from each storage node.
In the embodiment of the present invention, the comparison calculation task of the two input data A1 and A3 may be converted into the subtraction calculation task of (A1-A3) and the bit extraction calculation task of extracting the highest value in the calculation result of the binary representation (A1-A3).
For example, a part of the four computing nodes may execute a subtraction computing task to obtain subtraction computing results held by the part of the four computing nodes, and then use the subtraction computing results held by the part of the four computing nodes as input data of the bit extraction computing task to perform highest bit extraction by using data exchanged once (k = 1) bit positions to obtain a bit extraction computing result. The result of the bit extraction calculation can be used as the result of the privacy comparison of A1 and A3.
The bit extraction calculation process may specifically be as follows: the four computing nodes obtain respective supported computing results by utilizing data interaction of k rounds of 1-bit replacement data, wherein the computing results are used for extracting binary bits in the input data X; and k is the binary digit number to be extracted corresponding to the input data X in the calculation task. Here, the four computing nodes generate intermediate data (1 bit) including a random number capable of canceling 1 bit by performing bit computation locally, and obtain a computation result through data interaction of the intermediate data of k rounds.
It should be noted that the subtraction calculation and the bit extraction calculation are both performed on the basis of ciphertext data, and both the obtained subtraction calculation result and the obtained bit extraction calculation result are ciphertext data, so that no plaintext data appears in the privacy comparison process, and the information security can be ensured.
The second array is composed of a first ciphertext with a value of 1 and a second ciphertext with a value of 0, in the second array, it is necessary to determine an element in array1 corresponding to the ciphertext of value 1 adjacent to value 0, and in order to further determine which element in the second array is the ciphertext of value 1 adjacent to value 0, step S14 and step S15 may be executed.
The elements of the second array2 only include the value 0 or the value 1, and the first half and the second half of the second array2 are both 1 and 0. To obtain the position of the last value 1 in the second array2, i.e. the position of the value 1 adjacent to the value 0, the previous element in the second array2 and the adjacent next element may be subtracted to obtain a third array3. The third array3 only contains one element with a value of 1, and the values of the other elements are all 0.
Specifically, an inner product calculation may be performed on the third array and the first array to obtain an inner product calculation result, and the inner product calculation result may be used as a scaling coefficient corresponding to the ciphertext data.
After obtaining the third array3, an inner product calculation may be performed on the third array3 and the first array1 to obtain an inner product calculation result. Because the inner product operation of the two arrays is to multiply the numerical values of the corresponding positions of the two arrays and then sum, and the numerical value of only one position in the third array3 is 1, and the numerical values of the other positions are all 0, the inner product calculation result obtained after the inner product calculation is performed on the first array1 and the third array3 is the element of the corresponding position of the numerical value 1 in the third array3 in the first array1, that is, the scaling coefficient required to be determined.
In an optional embodiment of the present invention, the performing, according to the scaling coefficient, a scaling operation on the ciphertext data may specifically include: and performing multiplication calculation on the scaling coefficient corresponding to the ciphertext data and the ciphertext data.
In an application example of the present invention, it is assumed that logx calculation needs to be performed, where x is ciphertext data of a value 13. According to the above steps S11 to S15, the scaling factor corresponding to the ciphertext data may be determined. Specifically, assume that the order of magnitude range supported by the system is 10 -3 ~10 3 Then step S11 is executed to construct a first array1= [10 = -3 ,10 -2 ,10 -1 ,10 0 ,10 1 ,10 2 ,10 3 ](ii) a By performing steps S12 and S13, a second array2= [1, 0 ] can be obtained](ii) a Step S14 is executed to obtain a third array3= [0,1,0](ii) a Step S15 is executed, and the scaling factor corresponding to the ciphertext data is obtained as follows: array3 · array =10 -2 (ii) a The ciphertext data may be scaled by multiplying the scaling factor with the ciphertext data, specifically, by 13 × 10 -2 =0.13, the ciphertext data of which the scaled ciphertext data is 0.13 is obtained, and the numerical range requirement of logarithmic calculation (0) can be met<0.13<1) Therefore, the logarithm calculation may be performed on the scaled ciphertext data to obtain a first calculation result.
It should be noted that, in the above example, the ciphertext data may be scaled into the interval (0, 1), but the embodiment of the present invention does not limit the specific scope of scaling, and in practical applications, the ciphertext data may be scaled down or enlarged, and may be scaled down or enlarged to any interval. For example, for data x, embodiments of the present invention may scale it to intervals (0, 1), and since 0-2x-2, may scale x to intervals (0, 2).
In an optional embodiment of the present invention, after performing ciphertext-based computation on the scaled ciphertext data to obtain the first computation result, the method may further include: and executing compensation operation on the first calculation result to obtain a second calculation result.
After the first calculation result is calculated, a compensation operation may be performed on the first calculation result to obtain a second calculation result, which is a final result calculated by using the taylor expansion method.
In an optional embodiment of the present invention, the performing a compensation operation on the first calculation result to obtain a second calculation result specifically may include:
s31, arranging the elements in the first array according to a reverse order, and constructing a fourth array;
step S32, performing inner product calculation on the third array and the fourth array to obtain a compensation factor;
and S33, performing corresponding calculation on the first calculation result and the compensation factor according to the type of the calculation to be performed to obtain a second calculation result.
In the process of performing compensation operation on the first calculation result, a compensation factor is calculated according to the first array and the third array obtained in the process of determining the scaling coefficient, and then corresponding calculation can be performed on the first calculation result and the compensation factor according to the type of calculation to be performed to obtain a second calculation result.
Specifically, after the step S11 is performed to construct the first array, the elements in the first array may be arranged in the reverse order to construct the fourth array. For example, the first array1= [ a0, a1, a2 \8230aa ], and the fourth array4= [ a0', a1', a2' \8230, and an ' ], wherein a0' = an, a1' = a (n-1) \8230andan ' = a0. And performing inner product calculation on the third array3 and the fourth array4 to obtain a compensation factor, wherein a second calculation result can be calculated by using the compensation factor.
In an optional embodiment of the present invention, the performing, according to the type of the calculation to be performed, corresponding calculations on the first calculation result and the compensation factor to obtain a second calculation result includes:
if the type of the calculation to be executed is a first type, performing addition calculation on the first calculation result and the compensation factor to obtain a second calculation result; or
And if the type of the calculation to be executed is a second type, performing multiplication calculation on the first calculation result and the compensation factor to obtain a second calculation result.
Since different calculation types have different calculation characteristics, the embodiment of the present invention determines a specific manner of calculating the second calculation result according to the type of calculation to be performed. In particular, for the first type of computation, such as logarithmic computation, because logx × 10 -2 ×10 2 =logx×10 -2 +log10 2 Thus, the first calculation result and the compensation factor may be added to obtain the second calculation result. For the second type of calculation, e.g. exponential calculation, since e x ×e y =e x+y Therefore, a multiplication calculation may be performed on the first calculation result and the compensation factor to obtain a second calculation result.
In the embodiment of the invention, in order to improve the efficiency of calculation, different compensation factor determination schemes can be set for different types of calculation. Specifically, after the fourth array is built in step S31, it may also be determined whether to perform further preprocessing operations on the built fourth array according to the type of calculation to be performed. In an optional embodiment of the present invention, after the constructing the fourth array, the method may further include:
s41, determining the type of the calculation to be executed;
step S42, if the type of the calculation to be executed is a first type, preprocessing elements in the fourth array to obtain a preprocessed fourth array;
the performing inner product calculation on the third array and the fourth array to obtain a compensation factor may specifically include: and executing inner product calculation on the third array and the preprocessed fourth array to obtain a compensation factor.
In a preferred embodiment of the present invention, for the first type of calculation, after the fourth array is constructed in step S31, a further preprocessing operation may be performed on the constructed fourth array, and an inner product calculation may be performed on the third array and the preprocessed fourth array to obtain the compensation factor.
For the calculation of the non-first type, for example, for the calculation of the second type, after the fourth array is constructed in step S31, the inner product calculation may be directly performed on the third array and the fourth array without performing a further preprocessing operation on the constructed fourth array, so as to obtain the compensation factor.
In an optional embodiment of the present invention, the preprocessing the elements in the fourth array to obtain a preprocessed fourth array specifically may include:
step S51, sequentially executing the calculation operation corresponding to the calculation to be executed on each element in the fourth array to obtain the calculation result of each element in the fourth array;
and S52, taking an array formed by the calculation results of all the elements in the fourth array as the preprocessed fourth array.
In an application example of the present invention, the logx calculation is still used as an example, where x is ciphertext data of a value 13. According to the above steps S11 to S15, the scaling factor corresponding to the ciphertext data may be determined. Specifically, assume that the order of magnitude range supported by the system is 10 -3 ~10 3 Then step S11 is executed to construct a first array1= [10 = -3 ,10 -2 ,10 -1 ,10 0 ,10 1 ,10 2 ,10 3 ]And a fourth array4= [10 ] is constructed from the first array 3 ,10 2 ,10 1 ,10 0 ,10 -1 ,10 -2 ,10 -3 ](ii) a Since the logarithm calculation is of the first type, the fourth array may be preprocessed to obtain a preprocessed fourth array4= [ log10 ] 3 ,log10 2 ,log10 1 ,log10 0 ,log10 -1 ,log10 -2 ,log10 -3 ](ii) a By performing steps S12 and S13, a second array2= [1, 0 ] can be obtained](ii) a Step S14 is executed to obtain a third array3= [0,1,0](ii) a Step S15 is executed, and the scaling factor corresponding to the ciphertext data is obtained as follows: array3. Array1= [0,1,0 = [0,1,0,0,0 ]]·[10 -3 ,10 -2 ,10 -1 ,10 0 ,10 1 ,10 2 ,10 3 ]=10 -2 (ii) a And performing multiplication operation on the scaling coefficient and the ciphertext data to scale the ciphertext data to obtain the ciphertext data of which the scaled ciphertext data is a numerical value of 0.13. Performing a logarithmic calculation on the scaled ciphertext data may result in a first result R1= log0.13. Performing inner product calculation on the third array3 and the preprocessed fourth array4, a compensation factor R2, R2= array3 · array4= [0,1,0 can be obtained]·[log10 3 ,log10 2 ,log10 1 ,log10 0 ,log10 -1 ,log10 -2 ,log10 -3 ]=log10 2 . Since the type of logarithmic calculation is the first type, performing an addition calculation on the first calculation result and the compensation factor may result in a second calculation result, in particular, the second result R = R1+ R2= log0.13+ log10 2 。
In another application example of the present invention, taking exponent calculation as an example, assume that the data x to be subjected to calculation is ciphertext with a value of 3.4, and the exponent calculation limits the value range of x to-1<x<1, in a computing scene based on a ciphertext, the order of magnitude of x cannot be obtained, so that whether x is within the numerical range required by the exponent computing cannot be determined, and therefore the following operation needs to be performed. Assume that the order of magnitude range supported by the system is 10 -5 ~10 5 Then construct the first array1= [ e ] -5 ,e -4 ,e -3 ,e -2 ,e -1 ,e 0 ,e 1 ,e 2 ,e 3 ,e 4 ,e 5 ]And constructing a fourth array4= [ e ] 5 ,e 4 ,e 3 ,e 2 ,e 1 ,e 0 ,e -1 ,e -2 ,e -3 ,e -4 ,e -5 ]<xnotran>, S12 ~ S4 , array2= [1,1,0,0,0,0,0,0,0,0,0 </xnotran>]And a third array3= [0,1,0,0,0]. Thus, a scaling factor of: <xnotran> array3 · array1= [0,1,0,0,0,0,0,0,0,0,0 </xnotran>]·[e -5 ,e -4 ,e -3 ,e -2 ,e -1 ,e 0 ,e 1 ,e 2 ,e 3 ,e 4 ,e 5 ]=e -4 According to a scaling factor e -4 Perform a scaling operation on data x: e.g. of the type 3.4 ·e -4 =e -0.6 Due to-1<-0.6<1, therefore, the scaled ciphertext data (ciphertext with a value of 0.6) can meet the value range requirement of exponential calculation. Performing an exponential calculation on the scaled ciphertext data may result in a first result R1= e -0.6 . <xnotran> , , array3 array4 , R2, R2= array3 · array4= [0,1,0,0,0,0,0,0,0,0,0 </xnotran>]·[e 5 ,e 4 ,e 3 ,e 2 ,e 1 ,e 0 ,e -1 ,e -2 ,e -3 ,e -4 ,e -5 ]=e 4 . Since the type of logarithmic calculation is of the second type, performing a multiplication calculation on the first calculation result and the compensation factor may result in a second calculation result, in particular, the second result R = R1 × R2= e -0.6 ×e 4 。
It should be noted that, for the first type of calculation, after the fourth array is built in step S31, a further preprocessing operation is performed on the built fourth array, which is only a preferred solution of the embodiment of the present invention.
To sum up, before performing ciphertext-based calculation, in the embodiments of the present invention, a scaling coefficient corresponding to ciphertext data to be calculated is first determined, and then the ciphertext data is scaled according to the scaling coefficient, so that the scaled ciphertext data meets the requirement of the numerical range of the calculation to be performed, and further, ciphertext-based calculation may be performed on the scaled ciphertext data to obtain a first calculation result. In the process, the ciphertext data does not need to be decrypted to obtain plaintext data, the plaintext of the data is not exposed, and the safety of information can be ensured. In addition, the embodiment of the invention does not need to decrypt the plaintext data to judge whether the ciphertext data meets the requirement of the numerical range of the calculation to be executed, can reduce the operation steps of ciphertext calculation and improve the efficiency of ciphertext calculation.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Device embodiment
Referring to fig. 2, a block diagram of a data processing apparatus according to an embodiment of the present invention is shown, where the apparatus may specifically include:
a coefficient determining module 201, configured to determine a scaling coefficient corresponding to ciphertext data to be subjected to computation;
a scaling module 202, configured to perform scaling operation on the ciphertext data according to the scaling coefficient;
and the ciphertext calculation module 203 is configured to perform ciphertext-based calculation on the scaled ciphertext data to obtain a first calculation result.
Optionally, the coefficient determining module 201 may specifically include:
the first construction submodule is used for constructing a first array according to the preset magnitude range; the first array comprises division points for dividing the preset magnitude range into different intervals;
the first calculation submodule is used for performing multiplication calculation on the first array and the ciphertext data to obtain a first result;
a result conversion submodule, configured to convert a result smaller than 1 in the first result into a first ciphertext corresponding to a value 1, and convert a result larger than 1 in the first result into a second ciphertext corresponding to a value 0, so as to obtain a second array consisting of the first ciphertext and the second ciphertext;
the second calculation submodule is used for performing subtraction calculation on a previous element and an adjacent next element in the second array to obtain a third array containing each subtraction calculation difference value;
and the coefficient determining submodule is used for executing inner product calculation on the third array and the first array to obtain a scaling coefficient corresponding to the ciphertext data.
Optionally, the apparatus may further include:
and the compensation processing module is used for executing compensation operation on the first calculation result to obtain a second calculation result.
Optionally, the compensation processing module may specifically include:
the second construction submodule is used for arranging the elements in the first array according to a reverse order and constructing a fourth array;
the factor determination submodule is used for executing inner product calculation on the third array and the fourth array to obtain a compensation factor;
and the compensation calculation sub-module is used for performing corresponding calculation on the first calculation result and the compensation factor according to the type of the calculation to be performed to obtain a second calculation result.
Optionally, the compensation calculating sub-module may specifically include:
the first compensation calculation unit is used for performing addition calculation on the first calculation result and the compensation factor to obtain a second calculation result if the type of the calculation to be performed is a first type; or
And the second compensation calculating unit is used for executing multiplication calculation on the first calculation result and the compensation factor to obtain a second calculation result if the type of the calculation to be executed is a second type.
Optionally, the apparatus may further include:
the type determining module is used for determining the type of the calculation to be executed;
the preprocessing module is used for preprocessing the elements in the fourth array to obtain a preprocessed fourth array if the type of the calculation to be executed is a first type;
the factor determination submodule is specifically configured to perform inner product calculation on the third array and the preprocessed fourth array to obtain a compensation factor.
Optionally, the preprocessing module may specifically include:
the third calculation submodule is used for sequentially executing the calculation operation corresponding to the calculation to be executed on each element in the fourth array to obtain the calculation result of each element in the fourth array;
and the array determining submodule is used for taking an array formed by the calculation results of all the elements in the fourth array as the preprocessed fourth array.
Optionally, at least two of the four computing nodes execute the ciphertext-based computation, and the ciphertext computation module is specifically configured to communicate with other computing nodes participating in ciphertext computation based on a multi-party secure computation protocol, and execute the ciphertext computation on the scaled ciphertext data.
Optionally, the ciphertext data is obtained by performing decentralized processing on plaintext data, and the apparatus may further include: and the distributed processing module is used for carrying out fragmentation processing on the plaintext data to obtain at least two ciphertext fragments.
For the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and reference may be made to the partial description of the method embodiment for relevant points.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
An embodiment of the present invention provides an apparatus for data processing, comprising a memory, and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs configured to be executed by the one or more processors include instructions for: determining a scaling coefficient corresponding to ciphertext data to be calculated; carrying out scaling operation on the ciphertext data according to the scaling coefficient; and performing ciphertext-based calculation on the scaled ciphertext data to obtain a first calculation result.
Fig. 3 is a block diagram illustrating an apparatus 800 for data processing in accordance with an example embodiment. For example, the apparatus 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 3, the apparatus 800 may include one or more of the following components: processing component 802, memory 804, power component 806, multimedia component 808, audio component 810, input/output (I/O) interface 812, sensor component 814, and communication component 816.
The processing component 802 generally controls overall operation of the device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing elements 802 may include one or more processors 820 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operation at the device 800. Examples of such data include instructions for any application or method operating on device 800, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 804 may be implemented by any type or combination of volatile or non-volatile memory devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The multimedia component 808 includes a screen that provides an output interface between the device 800 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front facing camera and/or a rear facing camera. The front-facing camera and/or the rear-facing camera may receive external multimedia data when the device 800 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the apparatus 800 is in an operational mode, such as a call mode, a recording mode, and a voice information processing mode. The received audio signal may further be stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 814 includes one or more sensors for providing various aspects of state assessment for the device 800. For example, the sensor assembly 814 may detect the open/closed state of the device 800, the relative positioning of the components, such as a display and keypad of the apparatus 800, the sensor assembly 814 may also detect a change in position of the apparatus 800 or a component of the apparatus 800, the presence or absence of user contact with the apparatus 800, orientation or acceleration/deceleration of the apparatus 800, and a change in temperature of the apparatus 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate communication between the apparatus 800 and other devices in a wired or wireless manner. The device 800 may access a wireless network based on a communication standard, such as WiFi,2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on radio frequency information processing (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium comprising instructions, such as the memory 804 comprising instructions, executable by the processor 820 of the device 800 to perform the above-described method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Fig. 4 is a schematic diagram of a server in some embodiments of the invention. The server 1900 may vary widely by configuration or performance and may include one or more Central Processing Units (CPUs) 1922 (e.g., one or more processors) and memory 1932, one or more storage media 1930 (e.g., one or more mass storage devices) storing applications 1942 or data 1944. Memory 1932 and storage medium 1930 can be, among other things, transient or persistent storage. The program stored in the storage medium 1930 may include one or more modules (not shown), each of which may include a series of instructions operating on a server. Still further, a central processor 1922 may be provided in communication with the storage medium 1930 to execute a series of instruction operations in the storage medium 1930 on the server 1900.
The server 1900 may also include one or more power supplies 1926, one or more wired or wireless network interfaces 1950, one or more input/output interfaces 1958, one or more keyboards 1956, and/or one or more operating systems 1941, such as Windows Server, mac OS XTM, unixTM, linuxTM, freeBSDTM, and so forth.
A non-transitory computer-readable storage medium in which instructions, when executed by a processor of an apparatus (server or terminal), enable the apparatus to perform the data processing method shown in fig. 1.
A non-transitory computer readable storage medium in which instructions, when executed by a processor of an apparatus (server or terminal), enable the apparatus to perform a data processing method, the method comprising: determining a scaling coefficient corresponding to ciphertext data to be calculated; carrying out scaling operation on the ciphertext data according to the scaling coefficient; and executing ciphertext-based calculation on the scaled ciphertext data to obtain a first calculation result.
The embodiment of the invention discloses A1 and a data processing method, which comprises the following steps:
determining a scaling coefficient corresponding to ciphertext data to be calculated;
carrying out scaling operation on the ciphertext data according to the scaling coefficient;
and executing ciphertext-based calculation on the scaled ciphertext data to obtain a first calculation result.
A2, according to the method of A1, the determining a scaling factor corresponding to ciphertext data to be calculated includes:
constructing a first array according to a preset magnitude range; the first array comprises division points for dividing the preset numerical range into different intervals;
performing multiplication calculation on the first array and the ciphertext data to obtain a first result;
converting a result smaller than 1 in the first result into a first ciphertext corresponding to a numerical value 1, and converting a result larger than 1 in the first result into a second ciphertext corresponding to a numerical value 0 to obtain a second array consisting of the first ciphertext and the second ciphertext;
performing subtraction calculation on the previous element and the adjacent next element in the second array to obtain a third array containing each subtraction calculation difference value;
and executing inner product calculation on the third array and the first array to obtain a scaling coefficient corresponding to the ciphertext data.
A3, according to the method described in A2, after performing ciphertext-based calculation on the scaled ciphertext data to obtain a first calculation result, the method further includes:
and executing compensation operation on the first calculation result to obtain a second calculation result.
A4, according to the method described in A3, performing a compensation operation on the first calculation result to obtain a second calculation result, including:
arranging the elements in the first array according to a reverse order to construct a fourth array;
performing inner product calculation on the third array and the fourth array to obtain a compensation factor;
and according to the type of the calculation to be executed, executing corresponding calculation on the first calculation result and the compensation factor to obtain a second calculation result.
According to the method of A4, according to the type of the calculation to be performed, the corresponding calculation is performed on the first calculation result and the compensation factor to obtain a second calculation result, and the method includes:
if the type of the calculation to be executed is a first type, performing addition calculation on the first calculation result and the compensation factor to obtain a second calculation result; or
And if the type of the calculation to be executed is a second type, executing multiplication calculation on the first calculation result and the compensation factor to obtain a second calculation result.
A6, after the method of A4 is constructed, the method further includes:
determining a type of the computation to be performed;
if the type of the calculation to be executed is a first type, preprocessing elements in the fourth array to obtain a preprocessed fourth array;
performing inner product calculation on the third array and the fourth array to obtain a compensation factor, including:
and executing inner product calculation on the third array and the preprocessed fourth array to obtain a compensation factor.
A7, according to the method of A6, the preprocessing the elements in the fourth array to obtain a preprocessed fourth array includes:
sequentially executing the calculation operation corresponding to the calculation to be executed on each element in the fourth array to obtain the calculation result of each element in the fourth array;
and taking an array formed by the calculation results of each element in the fourth array as a preprocessed fourth array.
A8, performing the ciphertext-based computation by at least two of four computing nodes according to the method of any one of A1 to A7, wherein performing the ciphertext-based computation on the scaled ciphertext data includes:
and communicating with other computing nodes participating in ciphertext computation based on a multi-party secure computing protocol, and executing the ciphertext computation aiming at the scaled ciphertext data.
A9, according to any one of the methods A1 to A7, the ciphertext data is obtained by performing dispersion processing on plaintext data, and the dispersion processing includes: and carrying out fragmentation processing on the plaintext data to obtain at least two ciphertext fragments.
The embodiment of the invention discloses B10, a data processing device, comprising:
the coefficient determining module is used for determining a scaling coefficient corresponding to ciphertext data to be calculated;
the scaling processing module is used for carrying out scaling operation on the ciphertext data according to the scaling coefficient;
and the ciphertext calculation module is used for performing ciphertext-based calculation on the zoomed ciphertext data to obtain a first calculation result.
B11, according to the apparatus in B10, the coefficient determining module includes:
the first construction submodule is used for constructing a first array according to the preset magnitude range; the first array comprises division points for dividing the preset magnitude range into different intervals;
the first calculation submodule is used for performing multiplication calculation on the first array and the ciphertext data to obtain a first result;
a result conversion submodule, configured to convert a result smaller than 1 in the first result into a first ciphertext corresponding to a value 1, and convert a result larger than 1 in the first result into a second ciphertext corresponding to a value 0, so as to obtain a second array consisting of the first ciphertext and the second ciphertext;
the second calculation submodule is used for performing subtraction calculation on a previous element and an adjacent next element in the second array to obtain a third array containing each subtraction calculation difference value;
and the coefficient determining submodule is used for executing inner product calculation on the third array and the first array to obtain a scaling coefficient corresponding to the ciphertext data.
B12, the device according to B11, further comprising:
and the compensation processing module is used for executing compensation operation on the first calculation result to obtain a second calculation result.
B13, the apparatus according to B12, wherein the compensation processing module includes:
the second construction submodule is used for arranging the elements in the first array according to a reverse order and constructing a fourth array;
the factor determination submodule is used for executing inner product calculation on the third array and the fourth array to obtain a compensation factor;
and the compensation calculation sub-module is used for performing corresponding calculation on the first calculation result and the compensation factor according to the type of the calculation to be performed to obtain a second calculation result.
B14, according to the apparatus in B13, the compensation calculating sub-module includes:
the first compensation calculating unit is used for performing addition calculation on the first calculation result and the compensation factor to obtain a second calculation result if the type of the calculation to be performed is a first type; or
And the second compensation calculating unit is used for executing multiplication calculation on the first calculation result and the compensation factor to obtain a second calculation result if the type of the calculation to be executed is a second type.
B15, the device according to B13, the device further comprises:
the type determining module is used for determining the type of the calculation to be executed;
the preprocessing module is used for preprocessing the elements in the fourth array to obtain a preprocessed fourth array if the type of the calculation to be executed is a first type;
the factor determining submodule is specifically configured to perform inner product calculation on the third array and the preprocessed fourth array to obtain a compensation factor.
B16, the device according to B15, the preprocessing module comprises:
the third calculation submodule is used for sequentially executing the calculation operation corresponding to the calculation to be executed on each element in the fourth array to obtain the calculation result of each element in the fourth array;
and the array determining submodule is used for taking an array formed by the calculation results of each element in the fourth array as the preprocessed fourth array.
B17, according to the apparatus described in any one of B10 to B16, the ciphertext-based computation is performed by at least two of the four compute nodes, and the ciphertext computation module is specifically configured to communicate with other compute nodes participating in ciphertext computation based on a multi-party secure computation protocol, and perform the ciphertext computation on the scaled ciphertext data.
B18, the apparatus according to any one of B10 to B16, wherein the ciphertext data is obtained by performing a hash process on plaintext data, and the apparatus further includes: and the distributed processing module is used for carrying out fragmentation processing on the plaintext data to obtain at least two ciphertext fragments.
The embodiment of the invention discloses C19, a device for data processing, comprising a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs are configured to be executed by the one or more processors and comprise instructions for:
determining a scaling coefficient corresponding to ciphertext data to be subjected to calculation;
carrying out scaling operation on the ciphertext data according to the scaling coefficient;
and performing ciphertext-based calculation on the scaled ciphertext data to obtain a first calculation result.
C20, according to the apparatus in C19, the determining a scaling factor corresponding to ciphertext data to be calculated includes:
constructing a first array according to a preset magnitude range; the first array comprises division points for dividing the preset numerical range into different intervals;
performing multiplication calculation on the first array and the ciphertext data to obtain a first result;
converting a result smaller than 1 in the first result into a first ciphertext corresponding to a numerical value 1, and converting a result larger than 1 in the first result into a second ciphertext corresponding to a numerical value 0, so as to obtain a second array consisting of the first ciphertext and the second ciphertext;
performing subtraction calculation on the previous element and the adjacent next element in the second array to obtain a third array containing each subtraction calculation difference value;
and executing inner product calculation on the third array and the first array to obtain a scaling coefficient corresponding to the ciphertext data.
C21, the device of C20, the device also configured to execute the one or more programs by one or more processors including instructions for:
and executing compensation operation on the first calculation result to obtain a second calculation result.
C22, according to the apparatus of C21, performing a compensation operation on the first calculation result to obtain a second calculation result, including:
arranging the elements in the first array according to a reverse order to construct a fourth array;
performing inner product calculation on the third array and the fourth array to obtain a compensation factor;
and according to the type of the calculation to be executed, executing corresponding calculation on the first calculation result and the compensation factor to obtain a second calculation result.
C23, according to the apparatus of C22, performing corresponding calculation on the first calculation result and the compensation factor according to the type of the calculation to be performed to obtain a second calculation result, including:
if the type of the calculation to be executed is a first type, performing addition calculation on the first calculation result and the compensation factor to obtain a second calculation result; or
And if the type of the calculation to be executed is a second type, executing multiplication calculation on the first calculation result and the compensation factor to obtain a second calculation result.
C24, the device of C22, the device also configured to execute the one or more programs by the one or more processors including instructions for:
determining a type of the calculation to be performed;
if the type of the calculation to be executed is a first type, preprocessing elements in the fourth array to obtain a preprocessed fourth array;
performing inner product calculation on the third array and the fourth array to obtain a compensation factor, including:
and executing inner product calculation on the third array and the preprocessed fourth array to obtain a compensation factor.
C25, according to the apparatus described in C24, the preprocessing the elements in the fourth array to obtain a preprocessed fourth array, including:
sequentially executing the calculation operation corresponding to the calculation to be executed on each element in the fourth array to obtain the calculation result of each element in the fourth array;
and taking an array formed by the calculation results of each element in the fourth array as a preprocessed fourth array.
C26, the apparatus according to any one of C19 to C25, wherein the ciphertext-based computation is performed by at least two of four computing nodes, and the performing the ciphertext-based computation on the scaled ciphertext data includes:
and communicating with other computing nodes participating in ciphertext computation based on a multi-party secure computing protocol, and executing the ciphertext computation aiming at the scaled ciphertext data.
C27, the apparatus according to any one of C19 to C25, wherein the ciphertext data is obtained by performing a hash process on plaintext data, and the hash process includes: and carrying out fragmentation processing on the plaintext data to obtain at least two ciphertext fragments.
The embodiment of the invention discloses a D28 machine readable medium, which stores instructions that when executed by one or more processors, make the device execute the data processing method as described in one or more of A1 to A9.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. The invention is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It will be understood that the invention is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.
The data processing method, the data processing apparatus and the apparatus for data processing provided by the present invention are described in detail above, and specific examples are applied herein to illustrate the principles and embodiments of the present invention, and the description of the above embodiments is only used to help understand the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, the specific embodiments and the application range may be changed, and in summary, the content of the present specification should not be construed as a limitation to the present invention.
Claims (25)
1. A method of data processing, the method comprising:
determining a scaling coefficient corresponding to ciphertext data to be subjected to calculation;
carrying out scaling operation on the ciphertext data according to the scaling coefficient;
performing ciphertext-based calculation on the scaled ciphertext data to obtain a first calculation result;
the determining a scaling factor corresponding to ciphertext data to be subjected to computation includes:
constructing a first array according to a preset magnitude range; the first array comprises division points for dividing the preset magnitude range into different intervals;
performing multiplication calculation on the first array and the ciphertext data to obtain a first result;
converting a result smaller than 1 in the first result into a first ciphertext corresponding to a numerical value 1, and converting a result larger than 1 in the first result into a second ciphertext corresponding to a numerical value 0, so as to obtain a second array consisting of the first ciphertext and the second ciphertext;
performing subtraction calculation on the previous element and the adjacent next element in the second array to obtain a third array containing each subtraction calculation difference value;
and executing inner product calculation on the third array and the first array to obtain a scaling coefficient corresponding to the ciphertext data.
2. The method of claim 1, wherein after performing the ciphertext-based computation on the scaled ciphertext data to obtain the first computation result, the method further comprises:
and executing compensation operation on the first calculation result to obtain a second calculation result.
3. The method of claim 2, wherein performing a compensation operation on the first calculation result to obtain a second calculation result comprises:
arranging the elements in the first array according to a reverse order to construct a fourth array;
performing inner product calculation on the third array and the fourth array to obtain a compensation factor;
and according to the type of the calculation to be executed, executing corresponding calculation on the first calculation result and the compensation factor to obtain a second calculation result.
4. The method according to claim 3, wherein the performing corresponding calculations on the first calculation result and the compensation factor according to the type of the calculation to be performed to obtain a second calculation result comprises:
if the type of the calculation to be executed is a first type, performing addition calculation on the first calculation result and the compensation factor to obtain a second calculation result; or alternatively
And if the type of the calculation to be executed is a second type, performing multiplication calculation on the first calculation result and the compensation factor to obtain a second calculation result.
5. The method of claim 3, wherein after the building the fourth array, the method further comprises:
determining a type of the computation to be performed;
if the type of the calculation to be executed is a first type, preprocessing elements in the fourth array to obtain a preprocessed fourth array;
the performing inner product calculation on the third array and the fourth array to obtain a compensation factor includes:
and executing inner product calculation on the third array and the preprocessed fourth array to obtain a compensation factor.
6. The method of claim 5, wherein the preprocessing the elements in the fourth array to obtain a preprocessed fourth array comprises:
sequentially executing the calculation operation corresponding to the calculation to be executed on each element in the fourth array to obtain the calculation result of each element in the fourth array;
and taking an array formed by the calculation results of each element in the fourth array as a preprocessed fourth array.
7. The method of any of claims 1 to 6, wherein the ciphertext-based computation is performed by at least two of four compute nodes, and wherein performing the ciphertext-based computation on the scaled ciphertext data comprises:
and communicating with other computing nodes participating in ciphertext computation based on a multi-party secure computing protocol, and executing the ciphertext computation aiming at the scaled ciphertext data.
8. The method according to any one of claims 1 to 6, wherein the ciphertext data is obtained by performing a scatter process on plaintext data, the scatter process including: and carrying out fragmentation processing on the plaintext data to obtain at least two ciphertext fragments.
9. A data processing apparatus, characterized in that the apparatus comprises:
the coefficient determining module is used for determining a scaling coefficient corresponding to ciphertext data to be calculated;
the scaling processing module is used for carrying out scaling operation on the ciphertext data according to the scaling coefficient;
the ciphertext calculation module is used for performing ciphertext-based calculation on the zoomed ciphertext data to obtain a first calculation result;
the coefficient determination module comprises:
the first construction submodule is used for constructing a first array according to the preset magnitude range; the first array comprises division points for dividing the preset magnitude range into different intervals;
the first calculation submodule is used for performing multiplication calculation on the first array and the ciphertext data to obtain a first result;
a result conversion submodule, configured to convert a result smaller than 1 in the first result into a first ciphertext corresponding to a value 1, and convert a result larger than 1 in the first result into a second ciphertext corresponding to a value 0, so as to obtain a second array consisting of the first ciphertext and the second ciphertext;
the second calculation submodule is used for performing subtraction calculation on a previous element and an adjacent next element in the second array to obtain a third array containing each subtraction calculation difference value;
and the coefficient determining submodule is used for executing inner product calculation on the third array and the first array to obtain a scaling coefficient corresponding to the ciphertext data.
10. The apparatus of claim 9, further comprising:
and the compensation processing module is used for executing compensation operation on the first calculation result to obtain a second calculation result.
11. The apparatus of claim 10, wherein the compensation processing module comprises:
the second construction submodule is used for arranging the elements in the first array according to a reverse order and constructing a fourth array;
the factor determining submodule is used for executing inner product calculation on the third array and the fourth array to obtain a compensation factor;
and the compensation calculation sub-module is used for performing corresponding calculation on the first calculation result and the compensation factor according to the type of the calculation to be performed to obtain a second calculation result.
12. The apparatus of claim 11, wherein the compensation calculation sub-module comprises:
the first compensation calculation unit is used for performing addition calculation on the first calculation result and the compensation factor to obtain a second calculation result if the type of the calculation to be performed is a first type; or
And the second compensation calculating unit is used for executing multiplication calculation on the first calculation result and the compensation factor to obtain a second calculation result if the type of the calculation to be executed is a second type.
13. The apparatus of claim 11, further comprising:
the type determining module is used for determining the type of the calculation to be executed;
the preprocessing module is used for preprocessing the elements in the fourth array to obtain a preprocessed fourth array if the type of the calculation to be executed is a first type;
the factor determination submodule is specifically configured to perform inner product calculation on the third array and the preprocessed fourth array to obtain a compensation factor.
14. The apparatus of claim 13, wherein the preprocessing module comprises:
the third calculation submodule is used for sequentially executing the calculation operation corresponding to the calculation to be executed on each element in the fourth array to obtain the calculation result of each element in the fourth array;
and the array determining submodule is used for taking an array formed by the calculation results of each element in the fourth array as the preprocessed fourth array.
15. The apparatus according to any of the claims 9 to 14, wherein the ciphertext-based computation is performed by at least two of four computing nodes, and wherein the ciphertext computation module, in particular for performing the ciphertext computation on the scaled ciphertext data based on a multiparty secure computing protocol in communication with other computing nodes participating in the ciphertext computation.
16. The apparatus according to any one of claims 9 to 14, wherein the ciphertext data is obtained by performing a hash process on plaintext data, the apparatus further comprising: and the distributed processing module is used for carrying out fragmentation processing on the plaintext data to obtain at least two ciphertext fragments.
17. An apparatus for data processing, comprising a memory, and one or more programs, wherein the one or more programs are stored in the memory, and wherein execution of the one or more programs by one or more processors comprises instructions for:
determining a scaling coefficient corresponding to ciphertext data to be calculated;
carrying out scaling operation on the ciphertext data according to the scaling coefficient;
performing ciphertext-based calculation on the scaled ciphertext data to obtain a first calculation result;
the determining a scaling factor corresponding to ciphertext data to be calculated includes:
constructing a first array according to a preset magnitude range; the first array comprises division points for dividing the preset numerical range into different intervals;
performing multiplication calculation on the first array and the ciphertext data to obtain a first result;
converting a result smaller than 1 in the first result into a first ciphertext corresponding to a numerical value 1, and converting a result larger than 1 in the first result into a second ciphertext corresponding to a numerical value 0, so as to obtain a second array consisting of the first ciphertext and the second ciphertext;
performing subtraction calculation on the previous element and the adjacent next element in the second array to obtain a third array containing each subtraction calculation difference value;
and executing inner product calculation on the third array and the first array to obtain a scaling coefficient corresponding to the ciphertext data.
18. The apparatus of claim 17, wherein the apparatus is also configured to execute the one or more programs by one or more processors includes instructions for:
and executing compensation operation on the first calculation result to obtain a second calculation result.
19. The apparatus of claim 18, wherein performing the compensation operation on the first calculation result to obtain a second calculation result comprises:
arranging the elements in the first array according to a reverse order to construct a fourth array;
performing inner product calculation on the third array and the fourth array to obtain a compensation factor;
and according to the type of the calculation to be executed, executing corresponding calculation on the first calculation result and the compensation factor to obtain a second calculation result.
20. The apparatus of claim 19, wherein the performing corresponding calculations on the first calculation result and the compensation factor according to the type of the calculation to be performed to obtain a second calculation result comprises:
if the type of the calculation to be executed is a first type, performing addition calculation on the first calculation result and the compensation factor to obtain a second calculation result; or alternatively
And if the type of the calculation to be executed is a second type, executing multiplication calculation on the first calculation result and the compensation factor to obtain a second calculation result.
21. The device of claim 19, wherein the device is also configured to execute the one or more programs by one or more processors includes instructions for:
determining a type of the calculation to be performed;
if the type of the calculation to be executed is a first type, preprocessing elements in the fourth array to obtain a preprocessed fourth array;
the performing inner product calculation on the third array and the fourth array to obtain a compensation factor includes:
and executing inner product calculation on the third array and the preprocessed fourth array to obtain a compensation factor.
22. The apparatus of claim 21, wherein the preprocessing the elements in the fourth array to obtain a preprocessed fourth array comprises:
sequentially executing the calculation operation corresponding to the calculation to be executed on each element in the fourth array to obtain the calculation result of each element in the fourth array;
and taking an array formed by the calculation results of each element in the fourth array as a preprocessed fourth array.
23. The apparatus of any of claims 17 to 22, wherein the ciphertext-based computation is performed by at least two of four compute nodes, and wherein performing the ciphertext-based computation on the scaled ciphertext data comprises:
and communicating with other computing nodes participating in ciphertext computation based on a multi-party secure computing protocol, and executing the ciphertext computation aiming at the scaled ciphertext data.
24. The apparatus according to any one of claims 17 to 22, wherein the ciphertext data is obtained by performing a hash process on plaintext data, the hash process including: and carrying out fragmentation processing on the plaintext data to obtain at least two ciphertext fragments.
25. A machine-readable medium having stored thereon instructions which, when executed by one or more processors, cause an apparatus to perform a data processing method as claimed in one or more of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910927858.5A CN112580063B (en) | 2019-09-27 | 2019-09-27 | Data processing method and device and data processing device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910927858.5A CN112580063B (en) | 2019-09-27 | 2019-09-27 | Data processing method and device and data processing device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112580063A CN112580063A (en) | 2021-03-30 |
CN112580063B true CN112580063B (en) | 2023-01-13 |
Family
ID=75110134
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910927858.5A Active CN112580063B (en) | 2019-09-27 | 2019-09-27 | Data processing method and device and data processing device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112580063B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103986574A (en) * | 2014-05-16 | 2014-08-13 | 北京航空航天大学 | Hierarchical identity-based broadcast encryption method |
CN104268825A (en) * | 2014-09-28 | 2015-01-07 | 西安交通大学 | Image encryption and ciphertext processing method |
CN107317666A (en) * | 2017-05-25 | 2017-11-03 | 南京邮电大学 | A kind of parallel full homomorphism encipher-decipher method for supporting floating-point operation |
CN110214433A (en) * | 2017-12-15 | 2019-09-06 | 首尔大学校产学协力团 | It carries out the terminal installation of homomorphic cryptography, handle the server unit and its method of ciphertext |
-
2019
- 2019-09-27 CN CN201910927858.5A patent/CN112580063B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103986574A (en) * | 2014-05-16 | 2014-08-13 | 北京航空航天大学 | Hierarchical identity-based broadcast encryption method |
CN104268825A (en) * | 2014-09-28 | 2015-01-07 | 西安交通大学 | Image encryption and ciphertext processing method |
CN107317666A (en) * | 2017-05-25 | 2017-11-03 | 南京邮电大学 | A kind of parallel full homomorphism encipher-decipher method for supporting floating-point operation |
CN110214433A (en) * | 2017-12-15 | 2019-09-06 | 首尔大学校产学协力团 | It carries out the terminal installation of homomorphic cryptography, handle the server unit and its method of ciphertext |
Also Published As
Publication number | Publication date |
---|---|
CN112580063A (en) | 2021-03-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113315631B (en) | Data processing method and device and data processing device | |
CN114840568B (en) | Ciphertext sorting method and device and ciphertext sorting device | |
CN111859035B (en) | Data processing method and device | |
CN113449325B (en) | Data processing method and device and data processing device | |
CN115396100B (en) | Careless random disorganizing method and system based on secret sharing | |
CN114969830B (en) | Privacy intersection method, system and readable storage medium | |
CN112861175A (en) | Data processing method and device and data processing device | |
CN112667674B (en) | Data processing method and device and data processing device | |
CN112487415B (en) | Method and device for detecting security of computing task | |
CN112307056A (en) | Data processing method and device and data processing device | |
CN113094744A (en) | Information processing method, service platform, device for information processing and multi-party secure computing system | |
CN114884645A (en) | Privacy calculation method and device and readable storage medium | |
CN112464257B (en) | Data detection method and device for data detection | |
CN112580064B (en) | Data processing method and device and data processing device | |
CN112583764B (en) | Data processing method and device and data processing device | |
CN112580063B (en) | Data processing method and device and data processing device | |
CN112163046A (en) | Block chain-based equipment data storage method, device and system | |
CN114885038B (en) | Encryption protocol conversion method, result acquisition node and privacy calculation node | |
CN113779500B (en) | Data processing method and device for data processing | |
CN114448631B (en) | Multi-party security computing method, system and device for multi-party security computing | |
CN112685747B (en) | Data processing method and device and data processing device | |
CN112468290B (en) | Data processing method and device and data processing device | |
CN112668036B (en) | Data processing method and device and data processing device | |
CN113779501A (en) | Data processing method and device and data processing device | |
CN112668015B (en) | Data processing method and device and data processing device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |