Data processing method and device
By extracting the real vectors in the linear transformation matrix and coding the complex vector product, the problem of high computational complexity of homomorphic encrypted data is solved, and the calculation complexity and efficiency improvement are achieved.
Patent Information
- Application Number
- CN202210770493.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-30
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2042-06-30
AI Technical Summary
When the prior art performs linear transformation calculation of homomorphic encrypted ciphertext data, the calculation complexity is high and it is difficult to effectively reduce it.
By extracting the real vectors that meet the constraints from the linear transformation matrix, dividing them into complex vector packets for complex vector encoding, calculating the homomorphic product of the complex vector and the ciphertext complex vector, obtaining the linear transformation calculation result, reducing the calculation complexity.
Complex multiplication during linear transformation calculation of homomorphic encrypted ciphertext data is realized, which significantly reduces the computational complexity and improves the computational efficiency.
Smart Images

Figure CN115174035B_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to the technical field of data privacy protection, and in particular, to a data processing method and device. Background Art
[0002] With the development of computer technology and network technology, there are more and more ways to spread data, and the speed of data transmission is getting faster and faster, which increases the possibility of data leakage. However, there is a large amount of sensitive data nowadays, such as: business secrets, intellectual property, key business information, business partner information or customer information of enterprises. In order to protect the privacy of data and avoid data leakage, necessary measures are usually taken to ensure that the data is effectively protected and legally used; for example, encryption algorithms are used to encrypt data to ensure the security of the data itself.
[0003] Usually, unencrypted data is called plaintext data, and encrypted data is called ciphertext data. The process of transforming plaintext data into ciphertext data is the encryption process, and the process of inversely transforming ciphertext data into plaintext data is the decryption process. In practical applications, there are many situations where specific calculations need to be performed on plaintext data, corresponding calculation results are obtained, and the calculation results are used for subsequent business processing. In order to increase the speed of data calculation, the data is usually provided to a third party with strong computing power, and the third party performs the data calculation. Therefore, it is hoped that the calculation for plaintext data can be converted into the calculation for ciphertext data to prevent the third party from obtaining the plaintext data, and further realize the privacy protection of the data. Summary of the invention
[0004] One or more embodiments of this specification provide the following technical solutions:
[0005] This specification provides a data processing method, the method comprising:
[0006] Obtain ciphertext data obtained by homomorphically encrypting plaintext data based on a preset homomorphic encryption algorithm, and a linear transformation matrix used to perform linear transformation calculation on the plaintext data; wherein the plaintext data is real number data, and the linear transformation matrix is a real matrix;
[0007] Extracting a plurality of real vectors satisfying constraint conditions from the linear transformation matrix; wherein the constraint conditions include the sum of homomorphic products of the plurality of real vectors and the plaintext data, which is the same as a calculation result of linear transformation calculation of the plaintext data based on the linear transformation matrix;
[0008] Dividing the plurality of real vectors into a plurality of real vector groups for performing complex vector encoding on the plurality of real vectors; wherein the real vector group comprises a first real vector corresponding to the real part of the complex vector and a second real vector corresponding to the imaginary part of the complex vector;
[0009] Performing complex vector encoding on the multiple real vector groups respectively to obtain complex vector sets corresponding to the multiple real vector groups, and performing complex vector encoding on the ciphertext data to obtain ciphertext complex vectors corresponding to the ciphertext data;
[0010] The homomorphic products of the complex vectors in the complex vector set and the ciphertext complex vectors are respectively calculated, and the sum of the real parts of the homomorphic products is calculated to obtain a calculation result of linear transformation calculation performed on the ciphertext data based on the linear transformation matrix.
[0011] This specification also provides a data processing device, the device comprising:
[0012] An acquisition module, which acquires ciphertext data obtained by homomorphically encrypting plaintext data based on a preset homomorphic encryption algorithm, and a linear transformation matrix used to perform linear transformation calculation on the plaintext data; wherein the plaintext data is real number data, and the linear transformation matrix is a real matrix;
[0013] An extraction module is configured to extract a plurality of real vectors satisfying a constraint condition from the linear transformation matrix; wherein the constraint condition includes a sum of homomorphic products of the plurality of real vectors and the plaintext data, which is the same as a calculation result of a linear transformation calculation performed on the plaintext data based on the linear transformation matrix;
[0014] A grouping module, dividing the multiple real vectors into multiple real vector groups for performing complex vector encoding on the multiple real vectors; wherein the real vector group includes a first real vector corresponding to the real part of the complex vector, and a second real vector corresponding to the imaginary part of the complex vector;
[0015] An encoding module performs complex vector encoding on the multiple real vector groups to obtain complex vector sets corresponding to the multiple real vector groups, and performs complex vector encoding on the ciphertext data to obtain ciphertext complex vectors corresponding to the ciphertext data;
[0016] The calculation module calculates the homomorphic products of the complex vectors in the complex vector set and the ciphertext complex vectors respectively, and calculates the sum of the real parts of the homomorphic products to obtain the calculation result of linear transformation calculation of the ciphertext data based on the linear transformation matrix.
[0017] This specification also provides an electronic device, including:
[0018] processor;
[0019] a memory for storing processor-executable instructions;
[0020] The processor implements the steps of any of the above methods by running the executable instructions.
[0021] The present specification also provides a computer-readable storage medium on which computer instructions are stored. When the instructions are executed by a processor, the steps of any of the methods described above are implemented.
[0022] In the above technical scheme, for the ciphertext data obtained by homomorphically encrypting the plaintext data, and the linear transformation matrix used to perform linear transformation calculation on the plaintext data, multiple real vectors can be first extracted from the linear transformation matrix, and the sum of the homomorphic products of these multiple real vectors with the plaintext data is the same as the calculation result of the linear transformation calculation on the plaintext data based on the linear transformation matrix, and then complex vector encoding is performed on the multiple real vector groups divided from the multiple real vectors to obtain a complex vector set corresponding to the multiple real vector groups, and complex vector encoding is performed on the ciphertext data to obtain a ciphertext complex vector corresponding to the ciphertext data, so that the homomorphic products of the complex vectors in the complex vector set and the ciphertext complex vector can be calculated respectively, and the sum of the real parts of the homomorphic products is calculated, and the sum is the calculation result of the linear transformation calculation on the ciphertext data based on the linear transformation matrix.
[0023] Using the above method, when performing linear transformation calculations on the ciphertext data after homomorphic encryption, complex multiplication calculations are performed instead of real multiplication calculations. Since the calculation results of two real multiplication calculations can be obtained through one complex multiplication calculation, the computational complexity of performing linear transformation calculations on the ciphertext data after homomorphic encryption is significantly reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 It is a schematic diagram of an implementation effect of a homomorphic encryption algorithm shown in an exemplary embodiment of this specification.
[0025] Figure 2 It is a flow chart of a data processing method shown in an exemplary embodiment of this specification.
[0026] Figure 3 It is a flowchart of another data processing method shown in an exemplary embodiment of this specification.
[0027] Figure 4 It is a schematic diagram of a hardware structure of a device shown in an exemplary embodiment of this specification.
[0028] Figure 5 It is a block diagram of a data processing device shown as an exemplary embodiment of this specification. DETAILED DESCRIPTION
[0029] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of this specification. Instead, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.
[0030] It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may be combined into a single step for description in other embodiments.
[0031] Homomorphic Encryption (HE) algorithm is an encryption algorithm based on the computational complexity theory of mathematical problems, which satisfies the ciphertext homomorphic operation property.
[0032] Please refer to Figure 1 , Figure 1 It is a schematic diagram of an implementation effect of a homomorphic encryption algorithm shown in an exemplary embodiment of this specification.
[0033] like Figure 1 As shown, when the original plaintext data is homomorphically encrypted to obtain the ciphertext data, a specific calculation can be performed on the ciphertext data to obtain the calculation result in ciphertext form, and the calculation result in ciphertext form is homomorphically decrypted accordingly to obtain the calculation result in decrypted plaintext form. At this time, the calculation result in plaintext form is the same as the calculation result obtained by directly performing the same calculation on the original plaintext data. In this way, the "calculated but invisible" data is achieved.
[0034] For example, assuming that the plaintext data is m, based on a homomorphic encryption algorithm, the plaintext data m is homomorphically encrypted to obtain the ciphertext data c, then for the plaintext data f(m), f(c) is the corresponding ciphertext data. Among them, f is any function belonging to the function family F; the function family F is the homomorphic function family corresponding to the homomorphic encryption algorithm, that is, the set of all functions supported by the homomorphic encryption algorithm that satisfy the ciphertext homomorphic operation property.
[0035] If a homomorphic encryption algorithm supports any form of calculation on ciphertext data, it is called a fully homomorphic encryption (FHE) algorithm; if it supports partial calculations on ciphertext data, such as only addition, only multiplication, or a limited number of additions and multiplications, it is called semi-homomorphic encryption (SWHE) or partially homomorphic encryption (PHE). Generally speaking, since any form of calculation can be constructed through addition and multiplication, if an encryption algorithm satisfies both additive homomorphism and multiplicative homomorphism, it can be considered to satisfy full homomorphism.
[0036] In homomorphic encryption algorithms, plaintext data can be a single plaintext (e.g., a single value) or a plaintext vector. Correspondingly, ciphertext data can be a single ciphertext or a ciphertext vector.
[0037] Homomorphic encryption algorithms usually include key generation (KeyGen) algorithm, encryption (Encrypt) algorithm, decryption (Decrypt) algorithm, homomorphic computation (Evaluate) algorithm, etc. Among them, the key generation algorithm is used to generate public and private keys; the encryption algorithm is used to encrypt plaintext data into ciphertext data based on the public key; the decryption algorithm is used to decrypt ciphertext data into plaintext data based on the private key; the homomorphic computation algorithm is used to specify the set of all functions that satisfy the homomorphic operation properties of ciphertext supported by the homomorphic encryption algorithm.
[0038] In addition, homomorphic encryption algorithms can also include encoding algorithms and decoding algorithms. In this type of homomorphic encryption algorithm, the encoding algorithm is used to transform the plaintext vector into a plaintext polynomial; the encryption algorithm is used to encrypt the plaintext polynomial into a ciphertext polynomial based on the public key; the decryption algorithm is used to decrypt the ciphertext polynomial into a plaintext polynomial based on the private key; the decoding algorithm is used to transform the plaintext polynomial into a plaintext vector.
[0039] Taking the CKKS fully homomorphic encryption algorithm as an example, the CKKS fully homomorphic encryption algorithm is a homomorphic encryption algorithm based on the RLWE (Ring Learning With Errors) problem, which satisfies full homomorphism.
[0040] The CKKS fully homomorphic encryption algorithm includes a key generation algorithm, a coding algorithm, an encryption algorithm, a decryption algorithm, a decoding algorithm, and a homomorphic computing algorithm. Among them, the homomorphic computing algorithm may include homomorphic addition, homomorphic multiplication, and homomorphic rotation transformation algorithms.
[0041] Specifically, the above homomorphic addition can be expressed as: Among them, with the ciphertext vector The corresponding plaintext vector is equal to the ciphertext vector The corresponding plaintext vector and ciphertext vector For example, suppose the plaintext vector Plaintext vector but
[0042] The above homomorphic multiplication can be expressed as: Among them, with the ciphertext vector The corresponding plaintext vector is equal to the ciphertext vector The corresponding plaintext vector and ciphertext vector Multiply the corresponding components in the corresponding plaintext vector. For example, suppose the plaintext vector Plaintext vector but Different from the dot product of vectors, it means multiplying the corresponding components in the vectors.
[0043] The above homomorphic rotation transformation algorithm can be expressed as: Among them, with the ciphertext vector The corresponding plaintext vector is equal to the ciphertext vector The corresponding plaintext vector is a vector after the components in the plaintext vector are cyclically shifted left by i positions. For example, suppose the plaintext vector but Indicates that The components in are circularly shifted left by 1 bit, Indicates that The components in are circularly shifted left by 2 bits, And so on.
[0044] In the CKKS fully homomorphic encryption algorithm, plaintext data is usually a plaintext vector. Encoding is to transform the plaintext vector into a plaintext polynomial, and decoding is to transform the plaintext polynomial into a plaintext vector. Therefore, plaintext vectors and plaintext polynomials are two forms of plaintext data, and they are essentially the same.
[0045] In this specification, a plaintext vector may refer to a plaintext vector or a plaintext polynomial. Correspondingly, a ciphertext vector may refer to a ciphertext vector or a ciphertext polynomial.
[0046] In practical applications, there are situations where it is necessary to perform linear transformation calculations on plaintext data. For plaintext data in vector form, performing linear transformation calculations on it is to calculate the product of a specific matrix and the plaintext vector; for example, assuming that the plaintext data is the plaintext vector Plaintext vector If the dimension is n, then the plaintext data can be linearly transformed based on the n-order matrix M to obtain the calculation result As shown in the following formula (the vector with dimension n is represented as a matrix with n rows and 1 column):
[0047] It should be noted that if plaintext data is homomorphically encrypted based on a homomorphic encryption algorithm to obtain ciphertext data corresponding to the plaintext data, the linear transformation calculation for the plaintext data can be converted into a linear transformation calculation for the ciphertext data based on the homomorphic calculation algorithm in the homomorphic encryption algorithm; for example, assuming that The corresponding ciphertext vector is Then we can first calculate based on the homomorphic computing algorithm in the homomorphic encryption algorithm Based on the homomorphic encryption algorithm, Perform homomorphic decryption and get
[0048] For example, in the scenario of multi-party joint modeling, when models such as LR (Logistic Regression) models perform iterative calculations based on feature data in vector form, there is usually a situation where linear transformation calculations are performed on feature vectors based on matrices that serve as model parameters.
[0049] In order to protect its own data privacy, the data party providing the feature data can homomorphically encrypt the feature data to obtain the corresponding ciphertext vector, and provide the ciphertext vector to the model party providing the model. The model party can input the ciphertext vector into the model, and the model will perform iterative calculation based on the ciphertext vector. In this process, it is necessary to perform linear transformation calculation on the ciphertext vector based on the above matrix.
[0050] Alternatively, in the scenario of Private Information Retrieval (PIR), the user can submit a data query request to the database on the server and complete the data query without leaking the privacy of the data query. That is, during the data query process, the server cannot know the specific data queried by the user.
[0051] The above database may store data in the form of a matrix. When the user needs to query the i-th row of the matrix, a vector for querying data can be constructed. Among them, the i-th component of the vector is 1, and the other components are all 0. The user can homomorphically encrypt the vector to obtain the corresponding ciphertext vector, and provide the ciphertext vector to the server. The server can perform a linear transformation calculation on the ciphertext vector based on the matrix, and return the calculation result to the user. After the user homomorphically decrypts the calculation result, the calculation result of the linear transformation calculation of the constructed vector based on the matrix can be obtained, that is, the i-th row of the matrix.
[0052] Related technologies in computing When , first, the matrix M can be encoded row by row to extract n vectors from the matrix M, expressed as: That is, a row of the matrix M is regarded as a vector.
[0053] Secondly, we can calculate these n vectors and the ciphertext vector separately The homomorphic product of is expressed as: In this case, the homomorphic product is the ciphertext data; the plaintext data corresponding to the homomorphic product is:
[0054] Then, we can analyze these n vectors and the ciphertext vector For each homomorphic product, perform log2 n homomorphic rotation transformations; each cycle shifts left by 2 k bits, and calculate the sum of the homomorphic products before and after the homomorphic rotation transformation (the sum in this specification refers to the homomorphic sum) to perform the next homomorphic rotation transformation on the sum; where 0≤k≤log2 n-1. In this case, the final sum is the ciphertext data; the plaintext data corresponding to the sum is:
[0055] Finally, Z can be extracted i The i-th component of and calculate all Z i In this case, the sum is In this case, the sum is the ciphertext data; the plaintext data corresponding to the sum is:
[0056] Taking n=4 as an example, the calculation in the related technology is The process is described below.
[0057] Assumptions
[0058] First, the matrix M can be encoded row by row to extract 4 vectors from the matrix M, which are:
[0059] Secondly, with vector For example, we can calculate the vector With the ciphertext vector The homomorphic product of is expressed as: In this case, the homomorphic product is the ciphertext data; and the homomorphic product The corresponding plaintext data is:
[0060] Then, continue with the vector For example, we can multiply the homomorphic product Perform a homomorphic rotation transformation. Since log2 4 = 2, it is necessary to perform two homomorphic rotation transformations; when performing the first homomorphic rotation transformation, the circular left shift is 2 0 = 1 bit, and calculate the sum of the homomorphic products before and after the homomorphic rotation transformation. The sum is the ciphertext data, and the plaintext data corresponding to the sum is When performing the second homomorphic rotation transformation, the circular left shift is 2 1 =2 bits, and calculate the sum of the homomorphic products before and after the homomorphic rotation transformation. The sum is the ciphertext data, and the plaintext data corresponding to the sum is
[0061] With vector Similarly, we can use vector Calculate Z2 based on the vector Calculate Z3, based on the vector Calculate Z4.
[0062] Finally, we can extract the first component of Z1, the second component of Z2, the third component of Z3, the fourth component of Z4, and calculate the sum of Z1, Z2, Z3, and Z4. At this point, In this case, with The corresponding plaintext data is:
[0063] It should be noted that the matrix M is a real matrix, that is, all elements in the matrix M (for example: w 1,1 tow n,n ) are all real numbers. Plain text vector is a real vector, i.e., the plaintext vector All components (e.g. x1 to x n ) are all real numbers.
[0064] It can be seen that in the related art, in order to obtain For the ciphertext vector A total of n homomorphic multiplication calculations and n log2 n homomorphic rotation transformations need to be performed. In other words, the computational complexity of linear transformation calculations on homomorphically encrypted ciphertext data is n+n log2 n.
[0065] One or more embodiments of the present specification provide a technical solution for data processing to reduce the computational complexity of linear transformation calculations on homomorphically encrypted ciphertext data.
[0066] In a specific implementation, the ciphertext data and the linear transformation matrix may be obtained to perform a linear transformation calculation on the ciphertext data based on the linear transformation matrix.
[0067] It should be noted that the ciphertext data may be data obtained by homomorphically encrypting the plaintext data based on a preset homomorphic encryption algorithm. Correspondingly, the linear transformation matrix may be a matrix used to perform linear transformation calculations on the plaintext data. The plaintext data may be real number data; and the linear transformation matrix may be a real matrix.
[0068] When the linear transformation matrix is obtained, since the linear transformation matrix is a real matrix, multiple real vectors that meet the constraint conditions can be extracted from the linear transformation matrix. The constraint conditions may include: the sum of the homomorphic products of the multiple real vectors and the plaintext data is the same as the result of the linear transformation calculation of the plaintext data based on the linear transformation matrix.
[0069] When the above-mentioned multiple real vectors are extracted from the above-mentioned linear transformation matrix, the multiple real vectors can be divided into multiple real vector groups for complex vector encoding of the multiple real vectors. Wherein, for any real vector group, and the complex vector obtained by complex vector encoding of the real vector group, the real vector group can include a real vector corresponding to the real part of the complex vector (which can be called a first real vector), and a real vector corresponding to the imaginary part of the complex vector (which can be called a second real vector).
[0070] Correspondingly, the above multiple real vector groups can be subsequently subjected to complex vector encoding to obtain a complex vector set corresponding to the multiple real vector groups, wherein the complex vector set is a set consisting of complex vectors corresponding to the multiple real vector groups.
[0071] When the above ciphertext data is obtained, the ciphertext data may be subjected to complex vector encoding to obtain a complex vector (which may be referred to as a ciphertext complex vector) corresponding to the ciphertext data.
[0072] When the above complex vector set and the above ciphertext complex vector are obtained, the homomorphic products of the complex vectors in the complex vector set and the ciphertext complex vector can be calculated respectively, and the sum of the real parts of all homomorphic products can be calculated. In this case, the sum is the result of the linear transformation calculation of the above ciphertext data based on the above linear transformation matrix.
[0073] In the above technical scheme, for the ciphertext data obtained by homomorphically encrypting the plaintext data, and the linear transformation matrix used to perform linear transformation calculation on the plaintext data, multiple real vectors can be first extracted from the linear transformation matrix, and the sum of the homomorphic products of these multiple real vectors with the plaintext data is the same as the calculation result of the linear transformation calculation on the plaintext data based on the linear transformation matrix, and then complex vector encoding is performed on the multiple real vector groups divided from the multiple real vectors to obtain a complex vector set corresponding to the multiple real vector groups, and complex vector encoding is performed on the ciphertext data to obtain a ciphertext complex vector corresponding to the ciphertext data, so that the homomorphic products of the complex vectors in the complex vector set and the ciphertext complex vector can be calculated respectively, and the sum of the real parts of the homomorphic products is calculated, and the sum is the calculation result of the linear transformation calculation on the ciphertext data based on the linear transformation matrix.
[0074] Using the above method, when performing linear transformation calculations on the ciphertext data after homomorphic encryption, complex multiplication calculations are performed instead of real multiplication calculations. Since the calculation results of two real multiplication calculations can be obtained through one complex multiplication calculation, the computational complexity of performing linear transformation calculations on the ciphertext data after homomorphic encryption is significantly reduced.
[0075] Please refer to Figure 2 , Figure 2 It is a flow chart of a data processing method shown in an exemplary embodiment of this specification.
[0076] The above data processing method may include the following steps:
[0077] Step 202, obtaining ciphertext data obtained by homomorphically encrypting plaintext data based on a preset homomorphic encryption algorithm, and a linear transformation matrix used to perform linear transformation calculation on the plaintext data; wherein the plaintext data is real number data, and the linear transformation matrix is a real matrix;
[0078] Step 204, extracting a plurality of real vectors satisfying a constraint condition from the linear transformation matrix; wherein the constraint condition includes a sum of homomorphic products of the plurality of real vectors and the plaintext data, which is the same as a calculation result of performing a linear transformation calculation on the plaintext data based on the linear transformation matrix;
[0079] Step 206: divide the multiple real vectors into multiple real vector groups for complex vector encoding the multiple real vectors; wherein the real vector group includes a first real vector corresponding to the real part of the complex vector and a second real vector corresponding to the imaginary part of the complex vector;
[0080] Step 208, performing complex vector encoding on the plurality of real vector groups respectively to obtain complex vector sets corresponding to the plurality of real vector groups, and performing complex vector encoding on the ciphertext data to obtain ciphertext complex vectors corresponding to the ciphertext data;
[0081] Step 210, respectively calculating the homomorphic products of the complex vectors in the complex vector set and the ciphertext complex vectors, and calculating the sum of the real parts of the homomorphic products, to obtain a calculation result of performing a linear transformation calculation on the ciphertext data based on the linear transformation matrix.
[0082] In this embodiment, the ciphertext data and the linear transformation matrix may be obtained to perform a linear transformation calculation on the ciphertext data based on the linear transformation matrix.
[0083] It should be noted that, on the one hand, the ciphertext data may be data obtained by homomorphically encrypting the plaintext data based on a preset homomorphic encryption algorithm. Correspondingly, the linear transformation matrix may be a matrix used to perform linear transformation calculations on the plaintext data. The plaintext data may be real number data; and the linear transformation matrix may be a real matrix.
[0084] On the other hand, the plaintext data may be data in vector form, namely, a plaintext vector. Correspondingly, the ciphertext data may be data in vector form, namely, a ciphertext vector.
[0085] In one embodiment shown, the above homomorphic encryption algorithm can be specifically a CKKS fully homomorphic encryption algorithm. Alternatively, the homomorphic encryption algorithm can also be other homomorphic encryption algorithms, which can be pre-set by the user according to actual needs, and this specification does not limit this.
[0086] Taking the aforementioned scenario of multi-party joint modeling as an example, the data party can homomorphically encrypt the plaintext data based on the above homomorphic encryption algorithm to obtain ciphertext data, and provide the ciphertext data to the model party. The model party can input the ciphertext data into the model, and the model will perform linear transformation calculation on the ciphertext data based on the matrix used to perform linear transformation calculation on the plaintext data.
[0087] Alternatively, taking the aforementioned scenario of private information retrieval as an example, the user can homomorphically encrypt the plaintext data based on the aforementioned homomorphic encryption algorithm to obtain ciphertext data, and provide the ciphertext data to the server. The server can use the matrix to be queried stored in the database as a matrix for performing linear transformation calculations on the plaintext data, and perform linear transformation calculations on the ciphertext data.
[0088] Furthermore, the same device may also perform homomorphic encryption on the plaintext data based on the homomorphic encryption algorithm to obtain ciphertext data, and perform linear transformation calculation on the ciphertext data based on the matrix used to perform linear transformation calculation on the plaintext data. This specification does not limit this.
[0089] When the linear transformation matrix is obtained, since the linear transformation matrix is a real matrix, multiple real vectors that meet the constraint conditions can be extracted from the linear transformation matrix. The constraint conditions may include: the sum of the homomorphic products of the multiple real vectors and the plaintext data is the same as the result of the linear transformation calculation of the plaintext data based on the linear transformation matrix.
[0090] It should be noted that, when the above homomorphic encryption algorithm is the CKKS fully homomorphic encryption algorithm, the above homomorphic product can be the product of the corresponding components in the vector; for example: assuming that the plaintext vector Plaintext vector but Different from the dot product of vectors, it means multiplying the corresponding components in the vectors.
[0091] In one embodiment shown, when extracting the multiple real vectors from the linear transformation matrix, the linear transformation matrix can be encoded along the diagonal to extract the multiple real vectors from the linear transformation matrix. In this case, the constraint condition can also include: for any real vector among the multiple real vectors, any two components thereof belong to different rows and columns in the linear transformation matrix.
[0092] Real Matrix For example, by encoding the real matrix along the diagonal, n real vectors can be extracted from the real matrix, which is expressed as: At this time, we need to n-1,i-1 The subscript of is operated modulo n, that is, the integer multiples of n are subtracted and ignored. For example,
[0093] Assume n = 4, then the real matrix By encoding the real matrix along the diagonal, four real vectors can be extracted from the real matrix, which are: Correspondingly, the plaintext vector
[0094] It can be seen that the real vector Any two components in belong to different rows and columns in the real matrix M; and these n real vectors are respectively related to the plaintext vector (Specifically, it can include plaintext vector itself, and the plaintext vector The sum of the homomorphic products of the vector obtained by homomorphic rotation transformation) and the plaintext vector based on the real matrix M The calculation results of linear transformation calculations are the same.
[0095] When the above-mentioned multiple real vectors are extracted from the above-mentioned linear transformation matrix, the multiple real vectors can be divided into multiple real vector groups for complex vector encoding of the multiple real vectors. Wherein, for any real vector group, and the complex vector obtained by complex vector encoding of the real vector group, the real vector group can include a real vector corresponding to the real part of the complex vector (which can be called a first real vector), and a real vector corresponding to the imaginary part of the complex vector (which can be called a second real vector).
[0096] Correspondingly, the above multiple real vector groups can be subsequently subjected to complex vector encoding to obtain a complex vector set corresponding to the multiple real vector groups, wherein the complex vector set is a set consisting of complex vectors corresponding to the multiple real vector groups.
[0097] When the above ciphertext data is obtained, the ciphertext data may be subjected to complex vector encoding to obtain a complex vector (which may be referred to as a ciphertext complex vector) corresponding to the ciphertext data.
[0098] In one embodiment shown, when the above-mentioned multiple real vectors are divided into the above-mentioned multiple real vector groups, the division can be specifically performed according to a preset interval value, so that for any real vector group, the first component of its first real vector and the second component of its second real vector are separated by the number of columns in the above-mentioned linear transformation matrix by the interval value, and the first component and the second component belong to the same row in the linear transformation matrix.
[0099] In the above case, when the above ciphertext data is complex vector encoded, the ciphertext data can be first homomorphically rotated according to the above interval value, and then the ciphertext data is determined as the real part of the ciphertext complex vector corresponding to the ciphertext data, and the ciphertext data after the homomorphic rotation transformation is determined as the imaginary part of the ciphertext complex vector.
[0100] It should be noted that, when the above homomorphic encryption algorithm is the CKKS fully homomorphic encryption algorithm, the above homomorphic rotation transformation can be to cyclically shift the components in the vector to the left; for example: assuming that the plaintext vector but Indicates that The components in are circularly shifted left by 1 bit, Indicates that The components in are circularly shifted left by 2 bits, And so on.
[0101] When the above complex vector set and the above ciphertext complex vector are obtained, the homomorphic products of the complex vectors in the complex vector set and the ciphertext complex vector can be calculated respectively, and the sum of the real parts of all homomorphic products can be calculated. In this case, the sum is the result of the linear transformation calculation of the above ciphertext data based on the above linear transformation matrix.
[0102] In one embodiment shown, for any complex vector in the above set of complex vectors (which may be referred to as a target complex vector), when calculating the homomorphic product of the target complex vector and the above ciphertext complex vector, the homomorphic rotation transformation parameter corresponding to the target complex vector may be determined first, that is, the number of bits of the components in the vector cyclically shifted to the left, and the ciphertext complex vector may be homomorphically rotated based on the homomorphic rotation transformation parameter. Subsequently, the homomorphic product of the target complex vector and the ciphertext complex vector after the homomorphic rotation transformation may be calculated.
[0103] The real matrix M and the plaintext vector The corresponding ciphertext vector For example, we can extract n real vectors from the real matrix M. Two adjacent real vectors in are divided into a real vector group, that is, a real vector group may include: the first real vector and the second real vector In this case, for any real vector group, the first real vector The component belonging to the jth row in the real matrix M is w j,i+j (operate modulo n on i+j), its second real vector The component belonging to the jth row in the real matrix M is w j,i+j+1 (perform modulo n operation on i+j+1); component w j,i+j and the weight w j,i+j+1 In the real matrix M, they belong to two adjacent columns. Therefore, we can consider the component w j,i+j and the weight w j,i+j+1 The number of interval columns in the real matrix M is 1, that is, the above interval value is 1.
[0104] In the above case, the ciphertext vector is quantized according to the above interval value. When performing homomorphic rotation transformation, the ciphertext vector can be The components in are cyclically shifted left by 1 bit. That is, for the ciphertext vector For the corresponding ciphertext complex vector, the real part of the ciphertext complex vector is the ciphertext vector The imaginary part of the ciphertext complex vector is the ciphertext vector The vector after the components in are rotated left by 1.
[0105] Assuming that a, b, c, and d are 4 real numbers, then (a-ic)×(b+id)=(a×b+c×d)+i(a×dc×b). Therefore, a×b+c×d=Real[(a-ic)×(b+id)]. Here, Real means taking the real part of the complex number. That is, through one complex number multiplication calculation, the calculation result of two real number multiplication calculations can be obtained.
[0106] because According to the homomorphic operation properties of the ciphertext of the homomorphic encryption algorithm, If i is replaced by 2i, then
[0107] It should be noted that for homomorphic rotation transformation, it satisfies the following formula: Assume and represents two vectors, then
[0108] According to formula 1, Considered as in Formula 1 Consider 2i as j in formula 1 and 1 as i in formula 1, then in, It can also be written as
[0109] According to formula 2, Considered as in Formula 1 Will Considered as in Formula 1 but
[0110] make but That is, including the first real vector and the second real vector The complex vector corresponding to the real vector grouping is That is, the ciphertext vector The corresponding ciphertext complex vector, where Represents the ciphertext vector The vector whose components in are circularly shifted left by 1. Correspondingly, That is, for the complex vector For , the corresponding homomorphic rotation transformation parameter is 2i.
[0111] Assume n = 4, then by Represents and includes the first real vector and the second real vector The complex vector corresponding to the real vector grouping is Represents and includes the first real vector and the second real vector The complex vector corresponding to the real vector grouping is Representation and ciphertext vector The corresponding ciphertext complex vector Then The corresponding homomorphic rotation transformation parameter is 0, which is the same as The corresponding homomorphic rotation transformation parameter is 2,
[0112] It can be seen that by encoding the real vector group including two real vectors extracted from the above linear transformation matrix into a complex vector, and encoding the above ciphertext data into a ciphertext complex vector, the calculation , a complex multiplication is performed instead of a real multiplication. In this case, you only need to execute Subhomomorphic multiplication and Sub-homomorphic rotation transformation calculation, we can get That is, the computational complexity of linear transformation calculation on homomorphically encrypted ciphertext data is
[0113] In one embodiment shown, based on the homomorphic encryption algorithm, the calculation result of the linear transformation calculation of the ciphertext data based on the linear transformation matrix can be homomorphically decrypted. Due to the homomorphic operation property of the ciphertext of the homomorphic encryption algorithm, the calculation result of the linear transformation calculation of the plaintext data based on the linear transformation matrix can be obtained at this time.
[0114] In the technical solution provided by the above-mentioned embodiment, for the ciphertext data obtained by homomorphically encrypting the plaintext data, and the linear transformation matrix used to perform linear transformation calculation on the plaintext data, multiple real vectors can be first extracted from the linear transformation matrix, and the sum of the homomorphic products of these multiple real vectors with the plaintext data is the same as the calculation result of the linear transformation calculation on the plaintext data based on the linear transformation matrix, and then the multiple real vector groups divided by the multiple real vectors are complex vector encoded to obtain a complex vector set corresponding to the multiple real vector groups, and the ciphertext data is complex vector encoded to obtain a ciphertext complex vector corresponding to the ciphertext data, so that the homomorphic products of the complex vectors in the complex vector set and the ciphertext complex vector can be calculated respectively, and the sum of the real parts of the homomorphic products is calculated, and the sum is the calculation result of the linear transformation calculation on the ciphertext data based on the linear transformation matrix.
[0115] Using the above method, when performing linear transformation calculations on the ciphertext data after homomorphic encryption, complex multiplication calculations are performed instead of real multiplication calculations. Since the calculation results of two real multiplication calculations can be obtained through one complex multiplication calculation, the computational complexity of performing linear transformation calculations on the ciphertext data after homomorphic encryption is significantly reduced.
[0116] Please refer to Figure 3 , Figure 3 It is a flowchart of another data processing method shown in an exemplary embodiment of this specification.
[0117] The above data processing method may include the following steps:
[0118] Step 302, obtaining ciphertext data obtained by homomorphically encrypting plaintext data based on a preset homomorphic encryption algorithm, and a linear transformation matrix used to perform linear transformation calculation on the plaintext data; wherein the plaintext data is real number data, and the linear transformation matrix is a real matrix;
[0119] Step 304, extracting a plurality of real vectors satisfying constraint conditions from the linear transformation matrix; wherein the constraint conditions include the sum of homomorphic products of the plurality of real vectors and the plaintext data, which is the same as the result of linear transformation calculation performed on the plaintext data based on the linear transformation matrix;
[0120] Step 306: divide the multiple real vectors into multiple real vector groups for complex vector encoding the multiple real vectors; wherein the real vector group includes a first real vector corresponding to the real part of the complex vector and a second real vector corresponding to the imaginary part of the complex vector;
[0121] Step 308, performing complex vector encoding on the multiple real vector groups respectively to obtain complex vector sets corresponding to the multiple real vector groups, and performing complex vector encoding on the ciphertext data to obtain ciphertext complex vectors corresponding to the ciphertext data;
[0122] Step 310: for any target complex vector in the set of complex vectors, determine a homomorphic rotation transformation parameter corresponding to the target complex vector, and perform a homomorphic rotation transformation on the ciphertext complex vector based on the homomorphic rotation transformation parameter;
[0123] Step 312: Based on the big-step-small-step algorithm, the homomorphic rotation transformation for the ciphertext complex vector is converted into a homomorphic rotation transformation for the target complex vector, and the homomorphic product of the target complex vector after the homomorphic rotation transformation and the ciphertext complex vector is calculated.
[0124] Step 314, calculate the sum of the real parts of the homomorphic products of the complex vectors in the complex vector set after homomorphic rotation transformation and the ciphertext complex vector, and obtain a calculation result of linear transformation calculation performed on the ciphertext data based on the linear transformation matrix.
[0125] In this embodiment, the specific implementation of steps 302 to 308 may refer to the aforementioned steps 202 to 208, and will not be described in detail in this specification.
[0126] In accordance with calculate When The ciphertext complex vector Perform a homomorphic rotation transformation.
[0127] In practical applications, compared with the homomorphic rotation transformation on ciphertext data, the homomorphic rotation transformation on plaintext data is easier and its computational complexity can be ignored.
[0128] In one embodiment shown, since the complex vectors in the complex vector set correspond to real vectors extracted from the linear transformation matrix, and the linear transformation matrix is substantially plaintext data, the complex vectors are also substantially plaintext data. In this case, in order to further reduce the computational complexity, the homomorphic rotation transformation for the ciphertext complex vectors can be converted into the homomorphic rotation transformation for the complex vectors in the complex vector set.
[0129] Specifically, based on the Baby Step Giant Step (BSGS) algorithm, the homomorphic rotation transformation for the above-mentioned ciphertext complex vector can be converted into the homomorphic rotation transformation for the complex vectors in the above-mentioned complex vector set.
[0130] According to the relevant content of the big-step small-step algorithm, if we set For For example, it can be expressed as: i=n1j+k, 0≤k<n1, 0≤j<n2.
[0131] For example, suppose Then 0 = 2 × 0 + 0, 1 = 2 × 0 + 1, 2 = 2 × 1 + 0, 3 = 2 × 1 + 1. It can be seen that 0 ≤ k < 2, 0 ≤ j < 2.
[0132] therefore,
[0133] It should be noted that for homomorphic rotation transformation, it also satisfies the following formula: Assume and represents two vectors, then in, Represents the vector A vector with the components in cyclically right shifted by i positions.
[0134] According to the above formula 1, Considered as in Formula 1 Consider 2n1j as j in formula 1 and 2k as i in formula 1, then
[0135] According to formula 3, Considered as Will Considered as Considering 2n1j as i in formula 3,
[0136] The above formula 2 can be expanded to Therefore, Considered as but
[0137] That is,
[0138] because It is for the plaintext complex vector The computational complexity of the homomorphic rotation transformation can be ignored. calculate When Homomorphic multiplication calculations and n1+n2 homomorphic rotation transformations.
[0139] In practical applications, we can In this case, in the calculation When Subhomomorphic multiplication and Sub-homomorphic rotation transformation. That is, the computational complexity of linear transformation calculation on the homomorphically encrypted ciphertext data is
[0140] In the technical solution provided by the above-mentioned embodiment, for the ciphertext data obtained by homomorphically encrypting the plaintext data, and the linear transformation matrix used to perform linear transformation calculation on the plaintext data, multiple real vectors can be first extracted from the linear transformation matrix, and the sum of the homomorphic products of the multiple real vectors with the plaintext data is the same as the calculation result of the linear transformation calculation on the plaintext data based on the linear transformation matrix, and then the multiple real vector groups divided by the multiple real vectors are complex vector encoded to obtain a complex vector set corresponding to the multiple real vector groups, and the ciphertext data is complex vector encoded to obtain a ciphertext complex vector corresponding to the ciphertext data, so that after converting the homomorphic rotation transformation for the ciphertext complex vector into the homomorphic rotation transformation for the complex vector in the complex vector set, the homomorphic product of the complex vector in the complex vector set after the homomorphic rotation transformation and the ciphertext complex vector is calculated, and the sum of the real parts of the homomorphic products is calculated, and the sum is the calculation result of the linear transformation calculation on the ciphertext data based on the linear transformation matrix.
[0141] Using the above method, when performing linear transformation calculations on the ciphertext data after homomorphic encryption, complex multiplication calculations are performed instead of real multiplication calculations. Since the calculation results of two real multiplication calculations can be obtained through one complex multiplication calculation, the computational complexity of performing linear transformation calculations on the ciphertext data after homomorphic encryption is significantly reduced.
[0142] In addition, when calculating the homomorphic product of a complex vector in a complex vector set and a ciphertext complex vector, and calculating the sum of the real parts of the homomorphic products, the homomorphic rotation transformation of the ciphertext complex vector in the calculation process can be converted into a homomorphic rotation transformation of the complex vector in the complex vector set. Since the computational complexity of the homomorphic rotation transformation of the plaintext data can be ignored, the computational complexity of the linear transformation calculation of the ciphertext data after homomorphic encryption is further reduced.
[0143] Please refer to Figure 4 , Figure 4 It is a schematic diagram of a hardware structure of a device shown in an exemplary embodiment of this specification.
[0144] like Figure 4As shown, at the hardware level, the above-mentioned device includes a processor 402, an internal bus 404, a network interface 406, a memory 408 and a non-volatile memory 410, and of course may also include hardware required for other services. One or more embodiments of this specification can be implemented based on software, such as the processor 402 reading the corresponding computer program from the non-volatile memory 410 into the memory 408 and then running it. Of course, in addition to the software implementation, one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic module, but can also be hardware or logic devices.
[0145] Please refer to Figure 5 , Figure 5 It is a block diagram of a data processing device shown as an exemplary embodiment of this specification.
[0146] The above data processing device can be applied to Figure 4 The device shown in the figure can realize the technical solution of this specification. The data processing device may include:
[0147] An acquisition module 502 is configured to acquire ciphertext data obtained by homomorphically encrypting plaintext data based on a preset homomorphic encryption algorithm, and a linear transformation matrix used to perform linear transformation calculation on the plaintext data; wherein the plaintext data is real number data, and the linear transformation matrix is a real matrix;
[0148] An extraction module 504 extracts a plurality of real vectors satisfying a constraint condition from the linear transformation matrix; wherein the constraint condition includes a sum of homomorphic products of the plurality of real vectors and the plaintext data, which is the same as a calculation result of performing a linear transformation calculation on the plaintext data based on the linear transformation matrix;
[0149] A grouping module 506 divides the plurality of real vectors into a plurality of real vector groups for performing complex vector encoding on the plurality of real vectors; wherein the real vector group includes a first real vector corresponding to the real part of the complex vector and a second real vector corresponding to the imaginary part of the complex vector;
[0150] The encoding module 508 performs complex vector encoding on the plurality of real vector groups to obtain complex vector sets corresponding to the plurality of real vector groups, and performs complex vector encoding on the ciphertext data to obtain ciphertext complex vectors corresponding to the ciphertext data;
[0151] The calculation module 510 calculates the homomorphic products of the complex vectors in the complex vector set and the ciphertext complex vectors respectively, and calculates the sum of the real parts of the homomorphic products to obtain a calculation result of performing a linear transformation calculation on the ciphertext data based on the linear transformation matrix.
[0152] Optionally, the device further comprises:
[0153] The decryption module, based on the homomorphic encryption algorithm, performs homomorphic decryption on the calculation result of the linear transformation calculation of the ciphertext data based on the linear transformation matrix, and obtains the calculation result of the linear transformation calculation of the plaintext data based on the linear transformation matrix.
[0154] Optionally, the extraction module:
[0155] The linear transformation matrix is encoded along the diagonal to extract multiple real vectors that meet constraints from the linear transformation matrix; wherein the constraints also include any two components of the real vectors belonging to different rows and columns in the linear transformation matrix.
[0156] Optionally, the number of columns between the first component in the first real vector and the second component in the second real vector in the linear transformation matrix is a preset interval value; wherein the first component and the second component belong to the same row in the linear transformation matrix;
[0157] The encoding module:
[0158] Performing a homomorphic rotation transformation on the ciphertext data according to the interval value;
[0159] The ciphertext data is determined as the real part of the ciphertext complex vector, and the ciphertext data after homomorphic rotation transformation is determined as the imaginary part of the ciphertext complex vector.
[0160] Optionally, the computing module:
[0161] For any target complex vector in the set of complex vectors, determine a homomorphic rotation transformation parameter corresponding to the target complex vector, and perform a homomorphic rotation transformation on the ciphertext complex vector based on the homomorphic rotation transformation parameter;
[0162] Calculate the homomorphic product of the target complex vector and the ciphertext complex vector after homomorphic rotation transformation.
[0163] Optionally, the computing module:
[0164] Based on the big-step-small-step algorithm, the homomorphic rotation transformation for the ciphertext complex vector is converted into a homomorphic rotation transformation for the target complex vector, and the homomorphic product of the target complex vector after the homomorphic rotation transformation and the ciphertext complex vector is calculated.
[0165] Optionally, the homomorphic encryption algorithm is the CKKS fully homomorphic encryption algorithm; the homomorphic product is the product of corresponding components in the vector; and the homomorphic rotation transformation is to cyclically left-shift the components in the vector.
[0166] For the device embodiment, it basically corresponds to the method embodiment, so the relevant parts can be referred to the partial description of the method embodiment.
[0167] The device embodiments described above are merely illustrative, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, i.e., they may be located in one place, or may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the technical solution of this specification.
[0168] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.
[0169] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0170] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0171] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0172] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0173] The above is a description of a specific embodiment of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0174] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0175] It should be understood that although the terms first, second, third, etc. may be used to describe various information in one or more embodiments of this specification, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0176] The above description is merely a preferred embodiment of one or more embodiments of the present specification and is not intended to limit one or more embodiments of the present specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present specification shall be included in the scope of protection of one or more embodiments of the present specification.
Claims
1. A data processing method, the method include: Obtain ciphertext data obtained by homomorphically encrypting plaintext data based on a preset homomorphic encryption algorithm, and a linear transformation matrix used to perform linear transformation calculation on the plaintext data; wherein the plaintext data is real number data, and the linear transformation matrix is a real matrix; Extracting a plurality of real vectors satisfying constraint conditions from the linear transformation matrix; wherein the constraint conditions include the sum of homomorphic products of the plurality of real vectors and the plaintext data, which is the same as a calculation result of linear transformation calculation of the plaintext data based on the linear transformation matrix; Dividing the multiple real vectors into multiple real vector groups for complex vector encoding the multiple real vectors; wherein the real vector group includes a first real vector corresponding to the real part of the complex vector, and a second real vector corresponding to the imaginary part of the complex vector; the number of columns between a first component in the first real vector and a second component in the second real vector in the linear transformation matrix is a preset interval value; wherein the first component and the second component belong to the same row in the linear transformation matrix; Performing complex vector encoding on the multiple real vector groups respectively to obtain complex vector sets corresponding to the multiple real vector groups; performing homomorphic rotation transformation on the ciphertext data according to the interval value to determine the ciphertext data as the real part of the ciphertext complex vector, and determining the ciphertext data after the homomorphic rotation transformation as the imaginary part of the ciphertext complex vector; For any target complex vector in the complex vector set, determine the homomorphic rotation transformation parameters corresponding to the target complex vector, and based on the homomorphic rotation transformation parameters, perform a homomorphic rotation transformation on the ciphertext complex vector; calculate the homomorphic product of the target complex vector and the ciphertext complex vector after the homomorphic rotation transformation, and calculate the sum of the real parts of the homomorphic product, to obtain a calculation result of linear transformation calculation of the ciphertext data based on the linear transformation matrix.
2. The method according to claim 1, further comprising: include: Based on the homomorphic encryption algorithm, the calculation result of the linear transformation calculation of the ciphertext data based on the linear transformation matrix is homomorphically decrypted to obtain the calculation result of the linear transformation calculation of the plaintext data based on the linear transformation matrix.
3. The method according to claim 1, wherein a plurality of real vectors satisfying the constraint conditions are extracted from the linear transformation matrix. include: The linear transformation matrix is encoded along the diagonal to extract multiple real vectors that meet constraints from the linear transformation matrix; wherein the constraints also include any two components of the real vectors belonging to different rows and columns in the linear transformation matrix.
4. The method according to claim 1, wherein the step of calculating the homomorphic product of the target complex vector and the ciphertext complex vector after homomorphic rotation transformation is as follows: include: Based on the big-step-small-step algorithm, the homomorphic rotation transformation for the ciphertext complex vector is converted into a homomorphic rotation transformation for the target complex vector, and the homomorphic product of the target complex vector after the homomorphic rotation transformation and the ciphertext complex vector is calculated.
5. According to the method described in any one of claims 1 or 4, the homomorphic encryption algorithm is the CKKS fully homomorphic encryption algorithm; the homomorphic product is the product of corresponding components in the vector; and the homomorphic rotation transformation is to cyclically shift the components in the vector to the left.
6. A data processing device, the device include: An acquisition module, which acquires ciphertext data obtained by homomorphically encrypting plaintext data based on a preset homomorphic encryption algorithm, and a linear transformation matrix used to perform linear transformation calculation on the plaintext data; wherein the plaintext data is real number data, and the linear transformation matrix is a real matrix; An extraction module is configured to extract a plurality of real vectors satisfying a constraint condition from the linear transformation matrix; wherein the constraint condition includes a sum of homomorphic products of the plurality of real vectors and the plaintext data, which is the same as a calculation result of a linear transformation calculation performed on the plaintext data based on the linear transformation matrix; A grouping module, dividing the multiple real vectors into multiple real vector groups for complex vector encoding the multiple real vectors; wherein the real vector group includes a first real vector corresponding to the real part of the complex vector, and a second real vector corresponding to the imaginary part of the complex vector; the number of columns between a first component in the first real vector and a second component in the second real vector in the linear transformation matrix is a preset interval value; wherein the first component and the second component belong to the same row in the linear transformation matrix; an encoding module, performing complex vector encoding on the multiple real vector groups respectively to obtain a set of complex vectors corresponding to the multiple real vector groups; performing a homomorphic rotation transformation on the ciphertext data according to the interval value to determine the ciphertext data as the real part of the ciphertext complex vector, and determining the ciphertext data after the homomorphic rotation transformation as the imaginary part of the ciphertext complex vector; A calculation module determines, for any target complex vector in the complex vector set, a homomorphic rotation transformation parameter corresponding to the target complex vector, and performs a homomorphic rotation transformation on the ciphertext complex vector based on the homomorphic rotation transformation parameter; calculates the homomorphic product of the target complex vector and the ciphertext complex vector after the homomorphic rotation transformation, and calculates the sum of the real parts of the homomorphic product, to obtain a calculation result of performing a linear transformation calculation on the ciphertext data based on the linear transformation matrix.
7. The device according to claim 6, further comprising: include: The decryption module, based on the homomorphic encryption algorithm, performs homomorphic decryption on the calculation result of the linear transformation calculation of the ciphertext data based on the linear transformation matrix, and obtains the calculation result of the linear transformation calculation of the plaintext data based on the linear transformation matrix.
8. The device according to claim 6, wherein the extraction module: Encoding the linear transformation matrix along the diagonal to extract a plurality of real vectors satisfying constraint conditions from the linear transformation matrix; in, The constraint condition also includes that any two components in the real vector belong to different rows and different columns in the linear transformation matrix.
9. The device according to claim 6, wherein the computing module: Based on the big-step-small-step algorithm, the homomorphic rotation transformation for the ciphertext complex vector is converted into a homomorphic rotation transformation for the target complex vector, and the homomorphic product of the target complex vector after the homomorphic rotation transformation and the ciphertext complex vector is calculated.
10. According to the device according to any one of claims 6 or 8, the homomorphic encryption algorithm is the CKKS fully homomorphic encryption algorithm; the homomorphic product is the product of corresponding components in the vector; and the homomorphic rotation transformation is to cyclically shift the components in the vector to the left.
11. An electronic device, include: processor; a memory for storing processor-executable instructions; The processor implements the method according to any one of claims 1 to 5 by running the executable instructions.
12. A computer-readable storage medium having computer instructions stored thereon, wherein the instructions are executed by a processor to implement the method according to any one of claims 1 to 5.
