Data encryption method and device, electronic equipment and readable storage medium
By converting the data to be encrypted into a complex form and performing Walsh transformation, and constructing a ciphertext polynomial in combination with a homomorphic encryption algorithm, the problem of high computational complexity in the prior art is solved, fast and efficient data encryption is achieved and security is improved.
Patent Information
- Application Number
- CN202510564612.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-30
- Publication Date
- 2025-07-25
AI Technical Summary
The existing data encryption process based on CKKS scheme has problems such as computational complexity, high resource consumption and low efficiency, making it difficult to achieve fast and efficient data encryption.
The data to be encrypted is converted into plural forms, split into real and imaginary data, and then Walsh transforms are performed to construct ciphertext polynomials using homomorphic encryption algorithms to simplify processing to realize data encryption.
The encoding and decoding process of homomorphic encryption schemes is simplified through the Walsh transform, improving computational efficiency, reducing computational overhead, and possibly using smaller key sizes at a given security level, improving security.
Smart Images

Figure CN120378085A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data security technologies, and in particular, to a data encryption method, and also relates to a data encryption device, an electronic device, and a computer-readable storage medium. Background Art
[0002] CKKS (Cheon-Kim-Kim-Song, homomorphic encryption) is a fully homomorphic encryption technology that supports floating-point operations. It allows addition and multiplication operations to be performed on ciphertexts without the need to decrypt the data first, and these operations will produce the same results when performed on the decrypted plaintext. Therefore, combined with the CKKS scheme, encrypted data can be processed and analyzed without decryption, thereby realizing the effective utilization of data while ensuring data security. However, the data encryption process based on the CKKS scheme requires the use of FFT (Fast Fourier Transform) and IDFT (Inverse Discrete Fourier Transform), and FFT generally faces problems such as signal length and data padding, periodicity assumptions and spurious frequency components, sampling rate requirements and spectral aliasing, computational complexity and resource consumption, and real-time performance and latency, resulting in a reduction in data encryption efficiency.
[0003] Therefore, how to achieve faster and more efficient data encryption based on homomorphic encryption technology and ensure data security is an urgent problem to be solved by those skilled in the art. Summary of the Invention
[0004] The purpose of the present application is to provide a data encryption method, which can achieve faster and more efficient data encryption based on homomorphic encryption technology and ensure data security; another purpose of the present application is to provide a data encryption device, an electronic device, a computer-readable storage medium, and a computer program product, all of which have the above beneficial effects.
[0005] In a first aspect, the present application provides a data encryption method, including:
[0006] Obtain data to be encrypted, convert each piece of the data to be encrypted into a complex number form to obtain a target complex number;
[0007] For each target complex number, split the target complex number into a real part data and an imaginary part data, and splice the real part data and the imaginary part data of all the target complex numbers into a real number vector;
[0008] Perform Walsh transform on each vector element in the real number vector to obtain a transformed element, and combine all the transformed elements into a transformed vector corresponding to the real number vector;
[0009] Encrypt the transformation vector using a homomorphic encryption algorithm to obtain a ciphertext polynomial, so as to achieve data encryption.
[0010] Optionally, encrypting the transformation vector using a homomorphic encryption algorithm to obtain a ciphertext polynomial includes:
[0011] Using the transformation vector as polynomial coefficients, and processing the polynomial coefficients using a homomorphic encryption algorithm to construct an initial ciphertext polynomial;
[0012] Performing a simplification process on the initial ciphertext polynomial to obtain the ciphertext polynomial.
[0013] Optionally, performing a simplification process on the initial ciphertext polynomial to obtain the ciphertext polynomial includes:
[0014] Determining a target modulus value according to the initial ciphertext polynomial;
[0015] Performing a modulo operation on the initial ciphertext polynomial according to the target modulus value to obtain the ciphertext polynomial.
[0016] Optionally, obtaining data to be encrypted, and converting each of the data to be encrypted into a complex form to obtain a target complex number, includes:
[0017] Obtaining stored data as the data to be encrypted, and determining the data form of the data to be encrypted;
[0018] When the data form of the data to be encrypted is a real form, converting the data to be encrypted into a complex form to obtain the target complex number;
[0019] When the data form of the data to be encrypted is a complex form, using the data to be encrypted as the target complex number.
[0020] Optionally, when the data form of the data to be encrypted is a real form, converting the data to be encrypted into a complex form to obtain the target complex number, includes:
[0021] When the data form of the data to be encrypted is a real form, dividing the data to be encrypted into real part data and imaginary part data alternately according to the arrangement order;
[0022] Combining two adjacent real part data and imaginary part data into the target complex number.
[0023] Optionally, the data encryption method further includes:
[0024] Determining a target ciphertext polynomial, and extracting the polynomial coefficients of the ciphertext polynomial from the ciphertext polynomial;
[0025] For each coefficient element in the polynomial coefficients, perform an inverse Walsh transform on the coefficient element to obtain a transformed coefficient element, and combine all the transformed coefficient elements into a target real vector;
[0026] Determine a target decryption complex number according to each target vector element in the target real vector; wherein, the target decryption complex number includes target real part data and target imaginary part data, the target real part data is the target vector elements with odd serial numbers in the target real vector, the target imaginary part data is the target vector elements with even serial numbers in the target real vector, and the target real part data and the target imaginary part data in one target decryption complex number are two adjacent target vector elements in the target real vector;
[0027] Perform data format conversion on the target decryption complex number to obtain target decryption data corresponding to the target ciphertext polynomial.
[0028] Optionally, the data to be encrypted is the read data of a storage array. After using a homomorphic encryption algorithm to encrypt the transformation vector to obtain a ciphertext polynomial to implement data encryption, it further includes:
[0029] Determine a check data recovery formula corresponding to the storage array;
[0030] Convert the check data recovery formula into a binary logic operation formula;
[0031] Use the binary logic operation formula to calculate the ciphertext polynomial to obtain check data, and write the check data into the check disk of the storage array.
[0032] In a second aspect, the present application also discloses a data encryption device, including:
[0033] An acquisition module, configured to acquire data to be encrypted, convert each piece of the data to be encrypted into a complex number form to obtain a target complex number;
[0034] A splicing module, configured to, for each target complex number, split the target complex number into real part data and imaginary part data, and splice the real part data and the imaginary part data of all the target complex numbers into a real vector;
[0035] A transformation module, configured to perform a Walsh transform on each vector element in the real vector to obtain a transformed element, and combine all the transformed elements into a transformation vector corresponding to the real vector;
[0036] An encryption module, configured to use a homomorphic encryption algorithm to encrypt the transformation vector to obtain a ciphertext polynomial to implement data encryption.
[0037] In a third aspect, the present application also discloses an electronic device, including:
[0038] a memory for storing a computer program;
[0039] a processor for implementing the steps of any of the above data encryption methods when executing the computer program.
[0040] In a fourth aspect, the present application also discloses a computer-readable storage medium having a computer program stored thereon, and the computer program, when executed by a processor, implements the steps of any of the above data encryption methods.
[0041] In a fifth aspect, the present invention also discloses a computer program product including a computer program / instructions, and the computer program / instructions, when executed by a processor, implement the steps of any of the above data encryption methods.
[0042] The present application provides a data encryption method, including: obtaining data to be encrypted, converting each of the data to be encrypted into a complex form to obtain a target complex number; for each target complex number, splitting the target complex number into a real part data and an imaginary part data, and splicing the real part data and the imaginary part data of all the target complex numbers into a real number vector; performing a Walsh transform on each vector element in the real number vector to obtain a transformed element, and combining all the transformed elements into a transformed vector corresponding to the real number vector; and encrypting the transformed vector by using a homomorphic encryption algorithm to obtain a ciphertext polynomial, so as to implement data encryption.
[0043] Applying the technical solution provided by the present application, for the data to be encrypted, first convert it into a complex form to obtain the target complex number. Secondly, by splitting its real part and imaginary part, the real parts and imaginary parts of all target complex numbers are sorted and concatenated in sequence to form a real number vector. Then, by performing Walsh transform on each vector element in the real number vector (i.e., the real part data or imaginary part data of the target complex number), the transform vector of the real number vector can be obtained. Thus, the ciphertext polynomial can be constructed for the transform vector in combination with the homomorphic encryption algorithm to achieve data encryption. It can be seen that this technical solution combines the homomorphic encryption technology with the Walsh transform to achieve the data encryption function, and the Walsh transform can provide a faster calculation speed than the fast Fourier transform. Especially when the processed polynomial has a specific form, this can reduce the calculation overhead in the encoding and decoding processes of the homomorphic encryption scheme. That is to say, the Walsh transform can simplify the algorithm implementation in the encoding and decoding processes of the homomorphic encryption scheme, especially when dealing with arithmetic operations of real numbers and complex numbers, which helps to improve the efficiency and readability of the algorithm. And after the Walsh transform is replaced, it will not directly affect the security of the homomorphic encryption scheme, but a more efficient transform means that at a given security level, a smaller key size may be allowed to be used, thus improving the security to a certain extent. Therefore, this technical solution can achieve faster and more efficient data encryption and further ensure data security.
[0044] In an embodiment of the present application, although the homomorphic encryption technology can process and analyze encrypted data without decryption, the Walsh transform only supports ordinary binary logical operations and does not support complex complex multiplication operations. In the face of some complex calculation scenarios, such as the check data recovery scenario in a storage array, the embodiment of the present application proposes a formula transformation method, that is, converting the check data recovery formula of the storage array into a binary logical operation formula to achieve the check data recovery calculation, which can also handle this complex scenario. Therefore, this technical solution has high applicability.
[0045] The data encryption device, electronic device, computer-readable storage medium, and computer program product provided by the present application also have the above technical effects, and the present application will not elaborate herein. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the prior art and the technical solutions in the embodiments of the present application, the drawings required for description in the prior art and the embodiments of the present application will be briefly introduced below. Of course, the following drawings described for the embodiments of the present application are only a part of the embodiments in the present application. For those of ordinary skill in the art, other drawings can be obtained according to the provided drawings without creative efforts, and the other obtained drawings also fall within the protection scope of the present application.
[0047] Figure 1Schematic flowchart of a data encryption method provided by this application;
[0048] Figure 2 Schematic diagram of a RAID storage array provided by this application;
[0049] Figure 3 Schematic structural diagram of a data encryption device provided by this application;
[0050] Figure 4 Schematic structural diagram of an electronic device provided by this application. Detailed implementation manners
[0051] The core of this application is to provide a data encryption method, which can implement faster and more efficient data encryption based on the homomorphic encryption technology to ensure data security; another core of this application is to provide a data encryption device, an electronic device, a computer-readable storage medium, and a computer program product, all of which have the above beneficial effects.
[0052] In order to describe the technical solutions in the embodiments of this application more clearly and completely, the following will introduce the technical solutions in the embodiments of this application with reference to the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of this application.
[0053] The embodiments of this application provide a data encryption method.
[0054] Please refer to Figure 1 , Figure 1 , which is a schematic flowchart of a data encryption method provided by this application. The data encryption method may include the following S101 to S104.
[0055] S101: Obtain the data to be encrypted, convert each piece of data to be encrypted into a complex number form to obtain a target complex number.
[0056] This step aims to implement the conversion of the data form of the data to be encrypted, that is, convert the data to be encrypted into the data to be encrypted in complex number form, namely the above-mentioned target complex number. Among them, the data to be encrypted can be any form of data to be encrypted, and its content, source, type, quantity, etc. do not affect the implementation of this technical solution.
[0057] In an embodiment of this application, obtaining the data to be encrypted and converting each piece of data to be encrypted into a complex number form to obtain a target complex number may include:
[0058] Obtain the stored data as the data to be encrypted, and determine the data form of the data to be encrypted;
[0059] When the data form of the data to be encrypted is in real number form, convert the data to be encrypted into complex number form to obtain the target complex number;
[0060] When the data form of the data to be encrypted is in complex number form, use the data to be encrypted as the target complex number.
[0061] Specifically, before performing data form conversion on the data to be encrypted, the data form can be judged first. For the data to be encrypted in real number form, the steps of data form conversion can be continued; for the data to be encrypted in complex number form, there is no need to perform data form conversion steps anymore, and the data to be encrypted can be directly used as the target complex number.
[0062] Among them, when the data form of the data to be encrypted is in real number form, converting the data to be encrypted into complex number form to obtain the target complex number may include: when the data form of the data to be encrypted is in real number form, dividing the data to be encrypted into real part data and imaginary part data alternately according to the arrangement order; combining two adjacent real part data and imaginary part data as the target complex number.
[0063] The embodiment of the present application provides an implementation method for converting the data to be encrypted in real number form into complex number form. Assume that the data to be encrypted is "A, B, C, D", then "A" can be used as the real part data, "B" can be used as the imaginary part data, "C" can be used as the real part data, and "D" can be used as the imaginary part data. Thus, the data to be encrypted "A, B, C, D" is converted into complex number form to obtain the target complex numbers "A + Bi, C + Di". Among them, the arrangement order of the data to be encrypted can be the receiving order, reading order, storage order, etc. of the data to be encrypted, and the present application does not limit this.
[0064] S102: For each target complex number, split the target complex number into real part data and imaginary part data, and splice the real part data and imaginary part data of all target complex numbers into a real number vector.
[0065] This step generates a real number vector by processing each target complex number. For each target complex number obtained based on S101, its real part data and imaginary part data can be determined respectively, so that the real part data and imaginary part data of all target complex numbers can be spliced into a real number vector. It should be noted that in the real number vector, the real part data and the imaginary part data are two adjacent vector elements, and the vector elements with odd serial numbers are real part data, and the vector elements with even serial numbers are imaginary part data. Taking the above target complex numbers "A + Bi, C + Di" as an example, the real number vector can be obtained : .
[0066] S103: Perform Walsh transform on each vector element in the real number vector to obtain transformed elements, and combine all the transformed elements to form a transformed vector corresponding to the real number vector.
[0067] This step aims to implement the Walsh transform operation to obtain the transformed vector corresponding to the real number vector. Here, the Walsh transform operation refers to performing the Walsh transform on each vector element in the real number vector to obtain the transformed element corresponding to the vector element, and then combining all the transformed elements to form the transformed vector corresponding to the real number vector. Taking the above real number vector as an example, the vector elements that need to perform the Walsh transform are the four vector elements A, B, C, and D.
[0068] Among them, the full name of the Walsh transform is the Walsh Transform, which is a set of complete orthogonal rectangular functions defined on the semi-open interval [0, 1). This transform has wide applications in signal processing and image processing, especially in the field of digital signal processing. Because its coefficients are all real numbers, it is suitable for the two states in digital logic, with fast calculation speed and less storage space, which is conducive to hardware implementation. It can be understood that the homomorphic encryption scheme is a homomorphic encryption scheme that supports approximate floating-point calculations. It relies on the Fourier transform to process polynomial operations. The Fourier transform is used in the homomorphic encryption scheme to convert the encrypted data to the frequency domain for calculation, and then back to the time domain through the inverse transform. This conversion is a key step in processing complex numbers and polynomial multiplications. The Walsh transform is another orthogonal transform that uses a series of square waves as basis functions and is especially suitable for processing binary data. Therefore, compared with the Fourier transform, when used to implement the homomorphic encryption scheme, the Walsh transform can provide a faster calculation speed than the fast Fourier transform. Especially when the processed polynomial has a specific form, it can effectively reduce the calculation overhead in the encoding and decoding processes of the homomorphic encryption scheme. That is to say, the Walsh transform can simplify the algorithm implementation in the encoding and decoding processes of the homomorphic encryption scheme, especially when dealing with arithmetic operations of real numbers and complex numbers, which helps to improve the efficiency and readability of the algorithm; and after the Walsh transform is replaced, it will not affect the security of the homomorphic encryption scheme, but a more efficient transform means that at a given security level, a smaller key size may be allowed, thus improving security to a certain extent.
[0069] S104: Use the homomorphic encryption algorithm to encrypt the transformed vector to obtain a ciphertext polynomial to achieve data encryption.
[0070] This step aims to combine the homomorphic encryption algorithm to construct a ciphertext polynomial based on the transformed vector, thereby realizing the data encryption function, that is, directly using the homomorphic encryption algorithm to encrypt the transformed vector to obtain the ciphertext polynomial and complete the data encryption.
[0071] In one embodiment of the present application, encrypting the transformation vector using a homomorphic encryption algorithm to obtain a ciphertext polynomial may include:
[0072] Taking the transformation vector as polynomial coefficients and processing the polynomial coefficients using a homomorphic encryption algorithm to construct an initial ciphertext polynomial;
[0073] Performing a simplification process on the initial ciphertext polynomial to obtain the ciphertext polynomial.
[0074] Among them, performing a simplification process on the initial ciphertext polynomial to obtain the ciphertext polynomial may include: determining a target modulus value according to the initial ciphertext polynomial; performing a modulo operation on the initial ciphertext polynomial according to the target modulus value to obtain the ciphertext polynomial.
[0075] In a possible implementation manner, the initial ciphertext polynomial is:
[0076] ;
[0077] Among them, represents the -th transformation vector element in the transformation vector , represents the length of the transformation vector, that is, the number of transformation vector elements, is a formal variable used to represent the unknown in the initial ciphertext polynomial . In polynomial operations, it is mainly used to construct the terms of the initial ciphertext polynomial.
[0078] Furthermore, the target modulus value can be . Therefore, the ciphertext polynomial obtained based on the initial ciphertext polynomial is:
[0079] ;
[0080] It can be understood that through the above simplification method, the ciphertext polynomial can be restricted in the ring , that is, ensuring that the degree of the ciphertext polynomial is less than N, which is convenient for subsequent homomorphic encryption operations. It can be thought that by mapping a complex vector to a polynomial, the algebraic properties of the polynomial can be used for efficient signal processing and data encoding.
[0081] It can be seen that for the data encryption method provided in the embodiments of the present application, for the data to be encrypted, first, it is converted into a complex number form to obtain a target complex number. Secondly, by splitting its real part and imaginary part, the real parts and imaginary parts of all target complex numbers are sorted and concatenated in sequence to form a real number vector. Then, by performing a Walsh transform on each vector element in the real number vector (i.e., the real part data or imaginary part data of the target complex number), a transform vector of the real number vector is obtained. Thus, the ciphertext polynomial can be constructed for the transform vector in combination with the homomorphic encryption algorithm to achieve data encryption. It can be seen that this technical solution combines the homomorphic encryption technology with the Walsh transform to achieve the data encryption function, and the Walsh transform can provide a faster calculation speed than the fast Fourier transform. Especially when the processed polynomial has a specific form, this can reduce the calculation overhead in the encoding and decoding processes of the homomorphic encryption scheme. That is to say, the Walsh transform can simplify the algorithm implementation in the encoding and decoding processes of the homomorphic encryption scheme, especially when dealing with arithmetic operations of real numbers and complex numbers, which helps to improve the efficiency and readability of the algorithm; and after the Walsh transform is replaced, it will not directly affect the security of the homomorphic encryption scheme, but a more efficient transform means that at a given security level, a smaller key size may be allowed to be used, thereby improving the security to a certain extent. Therefore, this technical solution can achieve faster and more efficient data encryption and further ensure data security.
[0082] Based on the above embodiments:
[0083] In an embodiment of the present application, the data to be encrypted may be the read data of the storage array. After encrypting the transform vector by using the homomorphic encryption algorithm to obtain the ciphertext polynomial to achieve data encryption, it may further include:
[0084] Determine the check data recovery formula corresponding to the storage array;
[0085] Convert the check data recovery formula into a binary logic operation formula;
[0086] Use the binary logic operation formula to calculate the ciphertext polynomial to obtain the check data, and write the check data into the check disk of the storage array.
[0087] It can be understood that although the homomorphic encryption technology can process and analyze encrypted data without decryption, the Walsh transform only supports ordinary binary logic operations and does not support complex complex multiplication operations. It is difficult to implement in the face of some complex calculation scenarios, such as the check data recovery scenario in the storage array. In response to this, for the check data recovery scenario in the storage array, the embodiments of the present application propose a formula transformation method, that is, converting the check data recovery formula of the storage array into a binary logic operation formula to implement the check data recovery calculation in the storage array.
[0088] Specifically, the check data recovery formula of the storage array is mainly XOR operation. However, the Walsh transform does not support XOR operation. Therefore, it can be converted into the following binary logic operation formula:
[0089] A ⊕ B = (A + B) - 2 × (A & B);
[0090] Among them, & represents logical AND operation, which can be directly represented by multiplication because in binary, logical AND operation is the multiplication of corresponding bits, and the addition and subtraction within the brackets can be implemented using traditional arithmetic operations.
[0091] Thus, through the above formula conversion, the Walsh transform can also handle complex scenarios such as check data recovery in the storage array, with high applicability.
[0092] In an embodiment of the present application, the data encryption method may further include:
[0093] Determine the target ciphertext polynomial, and extract the polynomial coefficients of the ciphertext polynomial from the ciphertext polynomial;
[0094] For each coefficient element in the polynomial coefficients, perform an inverse Walsh transform on the coefficient element to obtain the transformed coefficient element, and combine all the transformed coefficient elements into a target real vector;
[0095] Determine the target decryption complex number according to each target vector element in the target real vector; among them, the target decryption complex number includes a target real part data and a target imaginary part data. The target real part data is the target vector element with an odd serial number in the target real vector, and the target imaginary part data is the target vector element with an even serial number in the target real vector, and the target real part data and the target imaginary part data in a target decryption complex number are two adjacent target vector elements in the target real vector;
[0096] Perform data format conversion on the target decryption complex number to obtain the target decryption data corresponding to the target ciphertext polynomial.
[0097] The embodiment of the present application further provides a decryption method corresponding to the above data encryption method, which essentially belongs to the inverse operation of the encryption method. For the target ciphertext polynomial, that is, the data to be decrypted, successively perform operations such as polynomial coefficient extraction, inverse Walsh transform of internal elements, splitting and combination of vector elements, and data form conversion on it, and the decryption data corresponding to the target ciphertext polynomial can be obtained.
[0098] Based on the above embodiments, the embodiment of the present application takes the RAID array storage data as an example to provide another data encryption method.
[0099] The implementation processes of the data encryption method and the corresponding data decryption method provided by the embodiments of this application are as follows:
[0100] 1. Encoding:
[0101] Suppose there are N / 2 input complex numbers to be encoded, denoted as vector :
[0102] ;
[0103] Among them, each , represents the complex number space, with a dimension of N / 2, and i takes values from 1 to (N / 2 - 1). N is the degree of the polynomial modulus, which is the modulus used in polynomial operations and is a power of 2. The reason for choosing a power of 2 is that in a computer, binary operations are very efficient, and powers of 2 can simplify the implementation of many algorithms, especially in algorithms involving bit operations and divide-and-conquer strategies.
[0104] The input complex numbers here are the information or data that need to be encrypted and protected in the RAID array. Since the data stored in RAID arrays in different scenarios varies greatly, it may be real numbers or complex numbers. For greater generality, complex numbers are uniformly used here. If the data stored in the RAID array is a real number, it needs to be converted into a complex number, which can be specifically achieved through mathematical transformations such as data chunking and data type conversion.
[0105] Furthermore, these N / 2 complex numbers are concatenated into a real number vector of length N without distinguishing the real and imaginary parts, that is, each complex number is split into two terms, and finally concatenated into a real number vector of length N:
[0106] ;
[0107] Among them, is the real part of the complex number , is the imaginary part of the complex number .
[0108] Perform Walsh transform on each vector element (taking the k-th term as an example) in the real number vector to obtain the k-th transformed element of the transformed vector :
[0109] ;
[0110] Obtain the transformed vector :
[0111] ;
[0112] Among them, represents the binary dot product of n and k.
[0113] 2. Polynomial construction:
[0114] Regarding the transformed vector as the polynomial coefficients, construct the polynomial:
[0115] ;
[0116] Among them, is the k-th element of is a formal variable used to represent the unknowns in the polynomial and is mainly used to construct each term of the polynomial in polynomial operations.
[0117] 3. Polynomial simplification processing:
[0118] Perform the operation of modulo on the polynomial to obtain the reduced polynomial:
[0119] ;
[0120] Thus, through the above simplification processing method, the polynomial can be restricted to the ring that is, ensuring that the degree of the ciphertext polynomial is less than N, which is convenient for subsequent homomorphic encryption operations.
[0121] 4. Decoding:
[0122] Extract the polynomial from the encrypted polynomial, and its coefficients are ;
[0123] Apply the inverse Walsh transform:
[0124] ;
[0125] Obtain the real vector :
[0126] .
[0127] 5. Extract metadata:
[0128] Re-organize the obtained real vector into the original complex vector , where each , and correspond to the 2j-th and 2j + 1-th elements in respectively.
[0129] Finally, taking a typical RADI6 array as an example for illustration, please refer to Figure 2 , Figure 2 which is a schematic diagram of a RAID storage array provided by this application.
[0130] (1) When the encryption algorithm is not adopted:
[0131] "P0, P1, P2, P3" is the first independent parity information, belonging to horizontal parity, where:
[0132] P0 = D0 ⊕ D1 ⊕ D2 ⊕ D3;
[0133] P1 = D4 ⊕ D5 ⊕ D6 ⊕ D7;
[0134] P2 = D8 ⊕ D9 ⊕ D10 ⊕ D11;
[0135] P3 = D12 ⊕ D13 ⊕ D14 ⊕ D15.
[0136] "DP0, DP1, DP2, DP3" is the second independent parity information, belonging to diagonal parity, where:
[0137] DP0 = D0 ⊕ D5 ⊕ D10 ⊕ D15;
[0138] DP1 = D1 ⊕ D6 ⊕ D11 ⊕ P3;
[0139] DP2 = D2 ⊕ D7 ⊕ P2 ⊕ D12;
[0140] DP3 = D3 ⊕ P1 ⊕ D8 ⊕ D13.
[0141] (2) When the encryption algorithm provided by this application is adopted:
[0142] Since the Walsh transform does not support the exclusive OR operation, for this reason, the rule of the exclusive OR operation can be expressed in binary logic as:
[0143] A ⊕ B = (A + B) - 2 × (A & B);
[0144] Then the above parity becomes:
[0145] P0 = ((((D0 + D1) - 2×(D0 & D1)) + D2 - 2×(((D0 + D1) - 2×(D0 &D1)) & D2)) - 2×([([ (D0 + D1) - 2×(D0 & D1) ] + D2 - 2×([ (D0 + D1) - 2×(D0 & D1) ] & D2)) ] & D3);
[0146] P1 = (((D4 + D5) - 2×(D4 & D5)) + D6 - 2×(((D4 + D5) - 2×(D4 &D5)) & D6)) - 2×([([ (D4 + D5) - 2×(D4 & D5) ] + D6 - 2×([ (D4 + D5) - 2×(D4 & D5) ] & D6)) ] & D7);
[0147] P2 = (((D8 + D9) - 2×(D8 & D9)) + D10 - 2×(((D8 + D9) - 2×(D8 &D9)) & D10)) - 2×([([ (D8 + D9) - 2×(D8 & D9) ] + D10 - 2×([ (D8 + D9) - 2×(D8 & D9) ] & D10)) ] & D11);
[0148] P3 = (((D12 + D13) - 2×(D12 & D13)) + D14 - 2×(((D12 + D13) - 2×(D12 & D13)) & D14)) - 2×([([ (D12 + D13) - 2×(D12 & D13) ] + D14 - 2×([(D12 + D13) - 2×(D12 & D13) ] & D14)) ] & D15);
[0149] DP0 = (((D0 + D5) - 2×(D0 & D5)) + D10 - 2×(((D0 + D5) - 2×(D0 &D5)) & D10)) - 2×([([ (D0 + D5) - 2×(D0 & D5) ] + D10 - 2×([ (D0 + D5) - 2×(D0 & D5) ] & D10)) ] & D15);
[0150] DP1 = (((D1 + D6) - 2×(D1 & D6)) + D11 - 2×(((D1 + D6) - 2×(D1 &D6)) & D11)) - 2×([([ (D1 + D6) - 2×(D1 & D6) ] + D11 - 2×([ (D1 + D6) - 2×(D1 & D6) ] & D11)) ] & P3);
[0151] DP2 = (((D2 + D7) - 2×(D2 & D7)) + P2 - 2×(((D2 + D7) - 2×(D2 &D7)) & P2)) - 2×([([ (D2 + D7) - 2×(D2 & D7) ] + P2 - 2×([ (D2 + D7) - 2×(D2 & D7) ] & P2)) ] & D12);
[0152] DP3 = (((D3 + P1) - 2×(D3 & P1)) + D8 - 2×(((D3 + P1) - 2×(D3 &P1)) & D8)) - 2×([([ (D3 + P1) - 2×(D3 & P1) ] + D8 - 2×([ (D3 + P1) - 2×(D3 & P1) ] & D8)) ] & D13).
[0153] Thus, combined with the homomorphic encryption scheme, the encrypted data can be processed and analyzed without decryption. Therefore, when a data failure occurs in RAID6, the data on the failed disk can be repaired in combination with the above formula without decryption, which can ensure data security while realizing the effective utilization of data.
[0154] It can be seen that for the data encryption method provided by the embodiments of this application, for the data to be encrypted, first, it is converted into a complex form to obtain the target complex number. Secondly, by splitting its real part and imaginary part, the real parts and imaginary parts of all target complex numbers are sorted and concatenated in sequence into a real number vector. Then, by performing a Walsh transform on each vector element in the real number vector (i.e., the real part data or imaginary part data of the target complex number), the transform vector of the real number vector can be obtained. Thus, the ciphertext polynomial can be constructed for the transform vector in combination with the homomorphic encryption algorithm to achieve data encryption. It can be seen that this technical solution combines the homomorphic encryption technology with the Walsh transform to achieve the data encryption function, and the Walsh transform can provide a faster calculation speed than the fast Fourier transform. Especially when the processed polynomial has a specific form, this can reduce the computational overhead in the encoding and decoding processes of the homomorphic encryption scheme. That is to say, the Walsh transform can simplify the algorithm implementation in the encoding and decoding processes of the homomorphic encryption scheme, especially when dealing with arithmetic operations of real numbers and complex numbers, which helps to improve the efficiency and readability of the algorithm; and the replacement of the Walsh transform will not directly affect the security of the homomorphic encryption scheme, but a more efficient transform means that at a given security level, a smaller key size may be allowed, thereby improving security to a certain extent. Therefore, this technical solution can achieve faster and more efficient data encryption and further ensure data security.
[0155] An embodiment of the present application provides a data encryption device.
[0156] Please refer to Figure 3 , Figure 3 which is a schematic structural diagram of a data encryption device provided by the present application. The data encryption device may include:
[0157] An acquisition module 1, configured to acquire data to be encrypted, convert each piece of data to be encrypted into a complex form to obtain a target complex number;
[0158] A splicing module 2, configured to, for each target complex number, split the target complex number into real part data and imaginary part data, and splice the real part data and imaginary part data of all target complex numbers into a real number vector;
[0159] A transformation module 3, configured to perform Walsh transformation on each vector element in the real number vector to obtain transformation elements, and combine all the transformation elements into a transformation vector corresponding to the real number vector;
[0160] An encryption module 4, configured to perform encryption processing on the transformation vector by using a homomorphic encryption algorithm to obtain a ciphertext polynomial, so as to implement data encryption.
[0161] It can be seen that for the data to be encrypted, the data encryption device provided by the embodiment of the present application first converts it into a complex form to obtain a target complex number, and then by splitting its real part and imaginary part, the real part and imaginary part of all target complex numbers are sorted and spliced in sequence into a real number vector, and then by performing Walsh transformation on each vector element (i.e., the real part data or imaginary part data of the target complex number) in the real number vector to obtain the transformation vector of the real number vector, so that a ciphertext polynomial can be constructed for the transformation vector in combination with the homomorphic encryption algorithm to implement data encryption. It can be seen that this technical solution combines the homomorphic encryption technology with the Walsh transformation to achieve the data encryption function, and the Walsh transformation can provide a faster calculation speed than the fast Fourier transform. Especially when the processed polynomial has a specific form, this can reduce the calculation overhead in the encoding and decoding processes of the homomorphic encryption scheme. That is to say, the Walsh transformation can simplify the algorithm implementation in the encoding and decoding processes of the homomorphic encryption scheme, especially when dealing with arithmetic operations of real numbers and complex numbers, which helps to improve the efficiency and readability of the algorithm; and after the Walsh transformation is replaced, it will not directly affect the security of the homomorphic encryption scheme, but a more efficient transformation means that at a given security level, a smaller key size may be allowed to be used, thereby improving the security to a certain extent. Therefore, this technical solution can achieve faster and more efficient data encryption and further ensure data security.
[0162] In an embodiment of the present application, the above encryption module 4 may include:
[0163] A first processing unit, configured to use the transformation vector as polynomial coefficients, and process the polynomial coefficients by using a homomorphic encryption algorithm to construct an initial ciphertext polynomial;
[0164] A second processing unit, configured to perform a simplification process on the initial ciphertext polynomial to obtain a ciphertext polynomial.
[0165] In an embodiment of the present application, the above-mentioned second processing unit may specifically be configured to determine a target modulus value according to the initial ciphertext polynomial; perform a modulo operation on the initial ciphertext polynomial according to the target modulus value to obtain a ciphertext polynomial.
[0166] In an embodiment of the present application, the above-mentioned acquisition module 1 may include:
[0167] A determination unit, configured to obtain stored data as data to be encrypted, and determine the data form of the data to be encrypted;
[0168] A first setting unit, configured to convert the data to be encrypted into a complex form to obtain a target complex number when the data form of the data to be encrypted is a real form;
[0169] A second setting unit, configured to use the data to be encrypted as the target complex number when the data form of the data to be encrypted is a complex form.
[0170] In an embodiment of the present application, the above-mentioned first setting unit may specifically be configured to, when the data form of the data to be encrypted is a real form, alternately divide the data to be encrypted into real part data and imaginary part data according to the arrangement order; combine two adjacent real part data and imaginary part data into a target complex number.
[0171] In an embodiment of the present application, the data encryption device may further include a decryption module, configured to determine a target ciphertext polynomial, extract polynomial coefficients of the ciphertext polynomial from the ciphertext polynomial; for each coefficient element in the polynomial coefficients, perform an inverse Walsh transform on the coefficient element to obtain a transformed coefficient element, and combine all the transformed coefficient elements into a target real vector; determine a target decryption complex number according to each target vector element in the target real vector; wherein, the target decryption complex number includes a target real part data and a target imaginary part data, the target real part data is the target vector element with an odd serial number in the target real vector, the target imaginary part data is the target vector element with an even serial number in the target real vector, and the target real part data and the target imaginary part data in a target decryption complex number are two adjacent target vector elements in the target real vector; perform a data format conversion on the target decryption complex number to obtain target decryption data corresponding to the target ciphertext polynomial.
[0172] In one embodiment of the present application, the data to be encrypted is the read data of the storage array. The data encryption device may further include a calculation module, which is configured to determine the check data recovery formula corresponding to the storage array after encrypting the transformation vector using the homomorphic encryption algorithm to obtain the ciphertext polynomial to implement data encryption; convert the check data recovery formula into a binary logic operation formula; calculate the ciphertext polynomial using the binary logic operation formula to obtain the check data, and write the check data into the check disk of the storage array.
[0173] For the introduction of the device provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate here.
[0174] Embodiments of the present application provide an electronic device.
[0175] Please refer to Figure 4 , Figure 4 which is a schematic structural diagram of an electronic device provided by the present application. The electronic device may include:
[0176] A memory 11 for storing computer programs;
[0177] A processor 10, which can implement the steps of any of the above data encryption methods when executing the computer program.
[0178] As Figure 4 shown, it is a schematic diagram of the composition structure of the electronic device. The electronic device may include: a processor 10, a memory 11, a communication interface 12, and a communication bus 13. The processor 10, the memory 11, and the communication interface 12 all complete communication with each other through the communication bus 13.
[0179] In the embodiments of the present application, the processor 10 may be a central processing unit (CPU), an application specific integrated circuit, a digital signal processor, a field programmable gate array, or other programmable logic devices, etc.
[0180] The processor 10 may call the program stored in the memory 11. Specifically, the processor 10 may execute the operations in the embodiments of the data encryption method.
[0181] The memory 11 is used to store one or more programs. The program may include program codes, and the program codes include computer operation instructions. In the embodiments of the present application, the memory 11 stores at least programs for implementing the following functions:
[0182] Obtain the data to be encrypted, convert each data to be encrypted into a complex number form to obtain the target complex number;
[0183] For each target complex number, split the target complex number into real part data and imaginary part data, and splice the real part data and imaginary part data of all target complex numbers into a real number vector;
[0184] Perform Walsh transform on each vector element in the real number vector to obtain transformed elements, and combine all the transformed elements into a transformed vector corresponding to the real number vector;
[0185] Use the homomorphic encryption algorithm to encrypt the transformed vector to obtain a ciphertext polynomial, so as to realize data encryption.
[0186] In a possible implementation, the memory 11 may include a storage program area and a storage data area. Among them, the storage program area may store an operating system, application programs required for at least one function, etc.; the storage data area may store the data created during use.
[0187] In addition, the memory 11 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device or other volatile solid-state storage devices.
[0188] The communication interface 12 may be an interface of a communication module for connecting to other devices or systems.
[0189] Of course, it should be noted that Figure 4 the structure shown does not constitute a limitation on the electronic device in the embodiments of the present application. In actual applications, the electronic device may include more or fewer components than Figure 4 those shown, or combine some components.
[0190] The embodiments of the present application provide a computer-readable storage medium.
[0191] The computer program stored on the computer-readable storage medium provided by the embodiments of the present application can implement the steps of any of the above data encryption methods when executed by a processor.
[0192] Among them, the computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or a data center integrating one or more available media. For example, it may be various media that can store computer program codes, such as magnetic media (such as floppy disks, hard disks, magnetic tapes, etc.), optical media (such as DVDs), or semiconductor media (such as solid-state hard drives).
[0193] For the introduction of the computer-readable storage medium provided by the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate here.
[0194] The embodiments of the present application provide a computer program product.
[0195] The computer program product provided by the embodiments of the present application includes computer programs / instructions. When the computer programs / instructions are executed by a processor, the steps of any of the above data encryption methods can be implemented.
[0196] Specifically, in the above embodiments, all or part of them can be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in the form of a computer program product in whole or in part.
[0197] Among them, the computer program product may include one or more computer programs / instructions. When the computer program / instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application can be generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, server, or data center to another website, computer, server, or data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line, etc.) or a wireless manner (such as infrared, wireless, microwave, etc.).
[0198] For the introduction of the computer program product provided by the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate here.
[0199] The various embodiments in the specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The same or similar parts among the various embodiments can be referred to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description in the method part.
[0200] Those skilled in the art can further realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0201] The steps of the methods or algorithms described in connection with the embodiments disclosed herein may be implemented directly in hardware, in software modules executed by a processor, or in a combination thereof. The software modules may be located in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium well known in the art.
[0202] The technical solutions provided in this application have been introduced in detail above. Specific examples are used herein to illustrate the principles and implementation manners of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application. It should be noted that for those of ordinary skill in the art, without departing from the principle of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the protection scope of this application.
Claims
1. A data encryption method, characterized in that, Including: Obtain the data to be encrypted, convert each piece of the data to be encrypted into a complex number form to obtain a target complex number; For each target complex number, split the target complex number into a real part data and an imaginary part data, and splice the real part data and the imaginary part data of all the target complex numbers into a real number vector; Perform a Walsh transform on each vector element in the real number vector to obtain a transformed element, and combine all the transformed elements into a transformed vector corresponding to the real number vector; Use a homomorphic encryption algorithm to encrypt the transformed vector to obtain a ciphertext polynomial, so as to implement data encryption.
2. The data encryption method according to claim 1, wherein Using a homomorphic encryption algorithm to encrypt the transformed vector to obtain a ciphertext polynomial, including: Take the transformed vector as polynomial coefficients, and use a homomorphic encryption algorithm to process the polynomial coefficients to construct an initial ciphertext polynomial; Perform a simplification process on the initial ciphertext polynomial to obtain the ciphertext polynomial.
3. The data encryption method according to claim 2, wherein Performing a simplification process on the initial ciphertext polynomial to obtain the ciphertext polynomial, including: Determine a target modulus value according to the initial ciphertext polynomial; Perform a modulo operation on the initial ciphertext polynomial according to the target modulus value to obtain the ciphertext polynomial.
4. The data encryption method according to claim 1, wherein Obtain the data to be encrypted, convert each piece of the data to be encrypted into a complex number form to obtain a target complex number, including: Obtain stored data as the data to be encrypted, and determine the data form of the data to be encrypted; When the data form of the data to be encrypted is a real number form, convert the data to be encrypted into a complex number form to obtain the target complex number; When the data form of the data to be encrypted is a complex number form, use the data to be encrypted as the target complex number.
5. The data encryption method according to claim 4, wherein When the data form of the data to be encrypted is a real number form, convert the data to be encrypted into a complex number form to obtain the target complex number, including: When the data form of the data to be encrypted is a real number form, alternately divide the data to be encrypted into real part data and imaginary part data according to the arrangement order; Combine two adjacent pieces of the real part data and the imaginary part data into the target complex number.
6. The data encryption method according to claim 1, characterized in that, Also included: Determine a target ciphertext polynomial, and extract the polynomial coefficients of the ciphertext polynomial from the ciphertext polynomial; For each coefficient element in the polynomial coefficients, perform an inverse Walsh transform on the coefficient element to obtain a transformed coefficient element, and combine all the transformed coefficient elements into a target real number vector; Determine a target decryption complex number according to each target vector element in the target real number vector; wherein, the target decryption complex number includes a target real part data and a target imaginary part data, the target real part data is the target vector element with an odd serial number in the target real number vector, the target imaginary part data is the target vector element with an even serial number in the target real number vector, and the target real part data and the target imaginary part data in one target decryption complex number are two adjacent target vector elements in the target real number vector; Perform a data format conversion on the target decryption complex number to obtain target decryption data corresponding to the target ciphertext polynomial.
7. The data encryption method according to any one of claims 1 to 6, characterized in that, The data to be encrypted is the read data of the storage array. After using the homomorphic encryption algorithm to encrypt the transformation vector to obtain a ciphertext polynomial for data encryption, it further includes: Determine the check data recovery formula corresponding to the storage array; Convert the check data recovery formula into a binary logic operation formula; Use the binary logic operation formula to calculate the ciphertext polynomial to obtain check data, and write the check data into the check disk of the storage array.
8. A data encryption device, characterized in that, It includes: An acquisition module, configured to acquire data to be encrypted, and convert each of the data to be encrypted into a complex number form to obtain a target complex number; A splicing module, configured to, for each target complex number, split the target complex number into real part data and imaginary part data, and splice the real part data and imaginary part data of all the target complex numbers into a real number vector; A transformation module, configured to perform Walsh transformation on each vector element in the real number vector to obtain transformation elements, and combine all the transformation elements into a transformation vector corresponding to the real number vector; An encryption module, configured to use a homomorphic encryption algorithm to encrypt the transformation vector to obtain a ciphertext polynomial to achieve data encryption.
9. An electronic device, characterized in that, It includes: A memory, configured to store a computer program; A processor, configured to implement the steps of the data encryption method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the data encryption method according to any one of claims 1 to 7 are implemented.