Shared resource use conflict detection method and system based on homomorphic encryption
Through the method based on homomorphic encryption, the user's shared resource usage frequency is encrypted and the maximum common divisor is calculated, which solves the problem that it is difficult to efficiently calculate the maximum common divisor on encrypted data in the existing technology, and realizes the premise of protecting user privacy Under, efficiently detect the effect of resource use conflicts.
Patent Information
- Application Number
- CN202411682006.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-11-22
AI Technical Summary
The prior art is difficult to efficiently calculate the maximum common divisor on encrypted data, which makes it difficult to effectively detect and resolve periodic conflicts in resource use while protecting user privacy.
The method based on homomorphic encryption is used to homomorphically encrypt the user's shared resource usage frequency, determine the greatest common divisor through the encrypted ciphertext, and detect resource usage conflicts based on the greatest common divisor. The specific steps include homomorphic encryption of the resource usage frequency of any two users, judging the ciphertext size, forming an array, finding the maximum divisor smaller than the ciphertext a, and calculating the maximum common divisor through iteratively.
It realizes efficient detection of resource usage conflicts without leaking the frequency of user resource usage, improves the rational allocation and utilization of resources, and improves the efficiency of the maximum common divisor calculation and avoids security risks.
Smart Images

Figure CN119483904A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data encryption, and more specifically to a method for reasonably allocating limited resources (such as time, space, personnel or equipment, etc.) under ciphertext to minimize conflicts. Background Art
[0002] In existing resource sharing platforms, power dispatching systems, communication networks, and cloud computing environments, multiple users or entities often need to share limited resources. One of the challenges in this resource sharing mechanism is how to effectively detect and resolve periodic conflicts in resource usage without leaking user privacy, so as to ensure the rational allocation and efficient utilization of resources.
[0003] Traditional resource conflict detection methods usually require users to disclose their resource usage patterns, which may not only leak users' business secrets or personal privacy, but also lead to unfair resource allocation. Especially in the field of cloud computing and encryption technology, protecting the privacy of user data is crucial. Although existing encryption technology can protect the security of data during data transmission and storage, computing on encrypted data is still a technical challenge.
[0004] Especially in scenarios where the greatest common divisor (GCD) needs to be calculated, the calculation of the greatest common divisor has a wide range of applications in many fields, such as resource scheduling, time synchronization, signal processing, etc. However, the existing fully homomorphic encryption algorithm only supports addition and multiplication operations, so it is difficult to directly apply it to GCD calculation in the ciphertext state. The current methods to solve this problem mainly include:
[0005] Adaptation of homomorphic algorithms: By designing special homomorphic algorithms to simulate the traditional GCD algorithm, this method is not efficient in practice because the subtraction converges slowly and may introduce a lot of computational overhead.
[0006] Special homomorphic encryption schemes: These schemes may support more complex calculations, enabling the calculation of GCD directly or indirectly. However, these schemes usually require more computing resources and time, and therefore have shortcomings in efficiency.
[0007] Therefore, in summary, a new method is urgently needed to perform efficient greatest common divisor calculation on encrypted data, so as to effectively detect and resolve periodic conflicts in resource usage while protecting user privacy. Summary of the invention
[0008] In view of this, in order to at least partially solve the above technical problems, the present invention provides a shared resource usage conflict detection method and system based on homomorphic encryption.
[0009] In order to achieve the above object, the present invention adopts the following technical solution:
[0010] On the one hand, the present application discloses a shared resource usage conflict detection method based on homomorphic encryption, including homomorphic encryption of the shared resource usage frequency of each user, determining the greatest common divisor according to the encrypted ciphertext, and detecting the shared resource usage conflict based on the greatest common divisor; wherein the step of determining the greatest common divisor according to the encrypted ciphertext includes:
[0011] S1. Perform homomorphic encryption on the usage frequency of shared resources of any two users to obtain the corresponding ciphertext, assign the larger ciphertext to a, assign the smaller ciphertext to b, and convert the ciphertext b into b*2. i The method is stored in array d;
[0012] S2, respectively determine the size of each element in the ciphertext a and d, obtain an output result of either 0 or 1 and store it in array c;
[0013] S3, subtract the next element in array c from the adjacent previous element, and form array s based on the calculation results;
[0014] S4, multiply the corresponding elements in array s and array d and sum them to obtain the largest divisor that is less than the ciphertext a;
[0015] S5. Subtract the maximum common divisor from the ciphertext a and repeat steps S2-S4 with the ciphertext b until the maximum number of iterations is met, and output the larger value in the last iteration as the greatest common divisor.
[0016] Further, the larger value of ciphertext a and ciphertext b is assigned to ciphertext a, and the smaller value of ciphertext b is assigned to ciphertext b, the steps include:
[0017] Determine the ciphertext value c: When the ciphertext a is less than the ciphertext b, the ciphertext value c is determined to be 1, otherwise the ciphertext value c is determined to be 0;
[0018] According to the ciphertext value c, the ciphertext a and ciphertext b are assigned values by the following formula;
[0019] a=(1-c)*a+c*b
[0020] b=c*a+(1-c)*b.
[0021] Or determine the ciphertext value c: when the ciphertext a is less than the ciphertext b, the ciphertext value c is determined to be 0, otherwise the ciphertext value c is determined to be 1;
[0022] According to the ciphertext value c, the ciphertext a and ciphertext b are assigned values by the following formula;
[0023] a=c*a+(1-c)*b
[0024] b=(1-c)*a+c*b.
[0025] Furthermore, the ciphertext value c is determined as follows:
[0026] A sign function shsign(x) is preset, where x is the input of the sign function, and is used to output 1 when x is less than 0, otherwise output 0; or to output 0 when x is less than 0, otherwise output 1;
[0027] Call the sign function shsign(x), 21 with the difference between ciphertext a and ciphertext b as input to obtain the ciphertext value c.
[0028] Furthermore, in S2, the sign function shsign(x) is used to determine the size of the ciphertext a and each element in the array d, that is, when a≥d[i], output 1, otherwise output 0, or when a≥d[i], output 0, otherwise output 1;
[0029] Furthermore, in the element d[i] of the array d,
[0030]
[0031] In the formula, is the Gaussian floor function.
[0032] Furthermore, in S4, the corresponding elements in array s and array d are multiplied and stored in array t first, and then the elements in array t are added to obtain the largest divisor less than the ciphertext a
[0033] Furthermore, the maximum number of iterations is:
[0034]
[0035] In the formula, is the ceiling function.
[0036] On the other hand, the present application discloses a method for optimizing the use of shared resources based on homomorphic encryption, comprising detecting the use conflict of shared resources using the shared resource use conflict detection method based on homomorphic encryption as described in any one of the above items, and optimizing the use cycle of the shared resources according to the detection result; the steps include:
[0037] When the greatest common divisor is greater than a preset threshold, the user usage frequency is adjusted based on the set neighborhood.
[0038] On the other hand, the present application discloses a shared resource usage conflict detection system based on homomorphic encryption, including a user terminal A, a user terminal B and a server terminal;
[0039] Client A and client B encrypt their respective usage frequencies of shared resources based on fully homomorphic encryption, and send the encrypted ciphertext to the server.
[0040] The server is used to execute the shared resource usage conflict detection method based on homomorphic encryption as described in any of the above items to detect the shared resource usage conflict.
[0041] It can be seen from the above technical solution that the present invention discloses a shared resource usage conflict detection method and system based on homomorphic encryption, which is used to judge the conflict of resource usage without disclosing the resource usage frequency of both parties, thereby providing a basis for both parties to adjust the usage frequency to achieve minimal usage conflict, and helping to improve the reasonable allocation and utilization of resources.
[0042] At the same time, the method for determining the greatest common divisor provided by the present application not only improves the efficiency of solving the problem, but also avoids security risks by fixing the number of iterations; specifically, by selecting the largest divisor b*2 that is just smaller than the ciphertext a i , which is equivalent to performing 2 i The loss is reduced by each update, which greatly improves the efficiency. At the same time, when the end condition of two numbers being equal cannot be judged in fully homomorphic encryption, this application chooses a fixed number of iterations as the end condition and avoids the potential security risks caused by infinite iterations. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0044] Figure 1 A flowchart of the steps of determining the greatest common divisor based on encrypted ciphertext provided by the present invention.
[0045] Figure 2 The present invention provides a schematic diagram of a calculation example. DETAILED DESCRIPTION
[0046] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0047] Embodiment 1
[0048] Specifically, the shared resource usage conflict detection method based on homomorphic encryption disclosed in the present application includes: homomorphically encrypting the shared resource usage frequency of each user, determining the greatest common divisor according to the encrypted ciphertext, and then detecting the shared resource usage conflict based on the greatest common divisor;
[0049] Among them, the steps of determining the greatest common divisor according to the encrypted ciphertext are as follows: Figure 1 As shown, including:
[0050] S1. Perform homomorphic encryption on the usage frequency of shared resources of any two users to obtain the corresponding ciphertext, assign the larger ciphertext to a, assign the smaller ciphertext to b, and convert the ciphertext b into b*2. i The elements are stored in the array d in the form of , i represents the position number of each element in the array;
[0051] S2, respectively determine the size of each element in the ciphertext a and array d, and obtain an output result of either 0 or 1 and store it in array c;
[0052] S3, subtract the next element in array c from the adjacent previous element, and form array s based on the calculation results;
[0053] S4, multiply the corresponding elements in array s and array d and sum them to obtain the largest divisor that is less than the ciphertext a;
[0054] S5. Subtract the maximum common divisor from the ciphertext a and repeat steps S2-S4 with the ciphertext b until the maximum number of iterations is met, and output the larger value in the last iteration as the greatest common divisor.
[0055] The method for solving the fully homomorphic encryption ciphertext disclosed in the embodiment of the present invention not only ensures the efficiency of solving the greatest common divisor, but also overcomes the difficulty of iterative calculation under ciphertext, and helps to improve the security of homomorphic encryption.
[0056] According to an embodiment of the present invention,
[0057] In step S1, the assignment process is as follows: first, the ciphertext value c is determined, that is, when the ciphertext a is less than the ciphertext b, the ciphertext value c is determined to be 1, otherwise the ciphertext value c is determined to be 0;
[0058] Then, according to the ciphertext value c, the ciphertext a and ciphertext b are assigned values using the following formula;
[0059] a=(1-c)*a+c*b
[0060] b=c*a+(1-c)*b.
[0061] Right now
[0062] If a≥b, then c=0, in which case a=(1-c)*a+c*b=a, b=c*a+(1-c)*b=b;
[0063] If a﹤b, then c=1. At this time, a=(1-c)*a+c*b=b, b=c*a+(1-c)*b=a.
[0064] Or determine the ciphertext value c: when the ciphertext a is less than the ciphertext b, the ciphertext value c is determined to be 0, otherwise the ciphertext value c is determined to be 1;
[0065] According to the ciphertext value c, the ciphertext a and ciphertext b are assigned values by the following formula;
[0066] a=c*a+(1-c)*b
[0067] b=(1-c)*a+c*b.
[0068] In the present application, the above method is used to keep a always larger value and b always smaller value.
[0069] In a preferred embodiment, a sign function shsign(x) is preset to realize that when the plaintext value of the ciphertext x is less than 0, the ciphertext of 1 is output, otherwise the ciphertext of 0 is output; or when the plaintext value of the ciphertext x is less than 0, the ciphertext of 0 is output, otherwise the ciphertext of 1 is output;
[0070] Then, by calling the sign function shsign(x), the difference between ciphertext a and ciphertext b is used as input to obtain the ciphertext value c.
[0071] Furthermore, the smaller ciphertext b is converted into b*2 i In this embodiment, in order to ensure b*2 i >max(a,b), so that in array d, in, is a Gaussian floor function. In an exemplary embodiment, the loop condition is set to (i=0; i≤MAX; i++), Get an array d with MAX+1 elements.
[0072] In step S2, the size of the ciphertext a and each element in the array d is determined, and an output result of either 0 or 1 is obtained, that is, when the ciphertext a is greater than or equal to each element in the array d, 1 is output, and when the ciphertext a is greater than or equal to each element in the array d, 0 is output; or when the ciphertext a is greater than or equal to each element in the array d, 0 is output, and when the ciphertext a is greater than or equal to each element in the array d, 0 is output;
[0073] First call the symbol function shsign(x), that is, use ad[i] as the input parameter to get the element c[i] in array c through the function shsign. At this time, the number of elements in array c is the same as that in array d, both containing MAX+1 elements;
[0074] In step S3, in order to obtain the largest b*2 that is just smaller than a i , so that the next element in array c is subtracted from the adjacent previous element, and then array s is formed based on the calculation results, that is, in array s, element s[i]=c[i+1]-c[i]; at this time, the loop condition can be set to (i=0; i≤MAX-1; i++) so that array s has only MAX elements.
[0075] In step S4, the corresponding elements in array s and array d are multiplied and summed to obtain the largest divisor less than the ciphertext a. In this embodiment, the multiplication result is placed in array t, that is, t[i] = s[i]*d[i], and then the items in array t are accumulated to obtain the largest b*2 that is just less than a. i ,
[0076] Further, execute step S5, subtract the maximum divisor from the ciphertext a, and then repeat steps S2-S4 with the ciphertext b until the maximum number of iterations is met, and take the larger value in the last iteration as the greatest common divisor.
[0077] In this application, there are two situations in the first iteration: the first situation is a>a / 2>b, which is reduced to more than half of the original; the other situation is a>b>a / 2, which does not meet the requirement of being reduced to more than half of the original. However, since steps S2-S4 are repeated in each iteration to ensure that a>b, then a / 2>b / 2 must exist, and then a>b>a / 2>b / 2 must exist at this time, so after the second iteration, it can be guaranteed to be reduced to more than half of the original. Therefore, the maximum number of iterations in the present invention is set to:
[0078]
[0079] In the formula, is the ceiling function.
[0080] In one embodiment, the magnitude of the ciphertext is obtained through the client to determine the number of iterations; for example, when a, b < 10 3 When a, b<10, the number of iterations is 2(log21024)=20. 4 , the number of iterations is 2(log216384)=28.
[0081] An exemplary implementation example is Figure 2As shown, a=1023, b=1, the number of iterations is determined to be 20, and i in the array d is 10; if a sign function shsign(x) is defined, it is used to output a ciphertext of 1 when the plaintext value of the ciphertext x is less than 0, otherwise it outputs a ciphertext of 0;
[0082] At this time, after the first iteration, the largest divisor less than a is 512;
[0083] In the second iteration, a is reassigned, that is, a = 1023-512, b = 1; after continuing to find the common divisor according to the above method, the common divisor is 256;
[0084] Consistent with the second iteration process, a is reassigned until the 20th iteration, at which time the larger value of the reassigned a and b is output as the greatest common divisor.
[0085] Embodiment 2
[0086] This embodiment discloses a method for optimizing the use of shared resources based on homomorphic encryption, including detecting the use conflict of shared resources by using the shared resource use conflict detection method based on homomorphic encryption as described in any one of the above items, and optimizing the use cycle of the shared resources according to the detection result; the steps include:
[0087] When the greatest common divisor is greater than a preset threshold, the user usage frequency is adjusted based on the set neighborhood.
[0088] In this embodiment, the size of the greatest common divisor is positively correlated with the conflict, that is, the larger the greatest common divisor, the greater the conflict. Therefore, a threshold value can be preset according to demand during use. When the greatest common divisor is greater than the preset threshold value, the resource usage frequency of the two is adjusted within a certain interval of the neighborhood, so as to optimize resource usage, improve efficiency, and ensure fair allocation of resources. In a preferred embodiment, the preset threshold value is set to 1.
[0089] Embodiment 3
[0090] This embodiment discloses a shared resource usage conflict detection system based on homomorphic encryption, the system comprising a user terminal A, a user terminal B and a server;
[0091] Client A and client B encrypt their respective usage frequencies of shared resources based on fully homomorphic encryption, and send the encrypted ciphertext to the server.
[0092] The server is used to execute the shared resource usage conflict detection method based on homomorphic encryption as described in any of the above items, and detect the shared resource usage conflict based on the encrypted ciphertext.
[0093] In a preferred embodiment,
[0094] Client A sends its resource usage frequency to the server in the form of encrypted ciphertext using fully homomorphic encryption. Client B also encrypts its own resource usage frequency using the public key published by client A, and calculates the greatest common divisor of the two under the ciphertext, or sends the ciphertext to the server to determine the greatest common divisor. The result is then returned to client A.
[0095] After receiving the ciphertext result, user A decrypts it to obtain the greatest common divisor of the frequencies used by both parties, and analyzes the degree of conflict based on the greatest common divisor. If the conflict is large, the frequency used is modified within a certain neighborhood, and the above steps are repeated until it is adjusted to a suitable frequency, so as to optimize resource use, improve efficiency, and ensure fair allocation of resources.
[0096] Compared with the prior art, the present application makes use of the properties of homomorphic encryption to determine resource usage conflicts without disclosing the resource usage frequencies of both parties, thereby providing a basis for both parties to adjust the usage frequencies to achieve minimal usage conflicts, and helping to improve the rational allocation and utilization of resources.
[0097] In particular, in step S1, the present application converts the smaller ciphertext into b*2 i In the form of , the maximum divisor smaller than the ciphertext a can be quickly found in the subsequent steps, which greatly improves the execution efficiency of the algorithm. In addition, the method adopts the strategy of first storing the product and then summing it in step S4, which further optimizes the calculation process and reduces the amount of calculation.
[0098] At the same time, the sign function shsign(x) proposed by this method can determine the size relationship between two numbers in the ciphertext state, ensuring the security of the encryption process. In addition, this method sets a maximum number of iterations during the iteration process to avoid potential security risks caused by infinite iterations.
[0099] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0100] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A shared resource usage conflict detection method based on homomorphic encryption, characterized in that: Homomorphically encrypt the shared resource usage frequency of each user, determine the greatest common divisor according to the encrypted ciphertext, and detect the shared resource usage conflict based on the greatest common divisor; wherein the step of determining the greatest common divisor according to the encrypted ciphertext includes: S1. Perform homomorphic encryption on the shared resource usage frequency of any two users to obtain the corresponding ciphertext, assign the larger ciphertext to a, assign the smaller ciphertext to b, and convert the ciphertext b into b*2 i The elements are stored in the array d in the form of , i represents the position number of each element in the array; S2, respectively determine the size of each element in the ciphertext a and array d, and obtain an output result of either 0 or 1 and store it in array c; S3, subtract the next element in array c from the adjacent previous element, and form array s based on the calculation results; S4, multiply the corresponding elements in array s and array d and sum them to obtain the largest divisor that is less than the ciphertext a; S5. Subtract the maximum common divisor from the ciphertext a and repeat steps S2-S4 with the ciphertext b until the maximum number of iterations is met, and output the larger value in the last iteration as the greatest common divisor.
2. The shared resource usage conflict detection method according to claim 1, characterized in that: Assign the larger ciphertext to a and the smaller ciphertext to b. The steps include: Determine the ciphertext value c: When the ciphertext a is less than the ciphertext b, the ciphertext value c is determined to be 1, otherwise the ciphertext value c is determined to be 0; According to the ciphertext value c, the ciphertext a and ciphertext b are assigned values by the following formula; a=(1-c)*a+c*b b=c*a+(1-c)*b.
3. The shared resource usage conflict detection method according to claim 1, characterized in that: Assign the larger ciphertext to a and the smaller ciphertext to b. The steps include: Determine the ciphertext value c: When the ciphertext a is less than the ciphertext b, the ciphertext value c is determined to be 0, otherwise the ciphertext value c is determined to be 1; According to the ciphertext value c, the ciphertext a and ciphertext b are assigned values by the following formula; a=c*a+(1-c)*b b=(1-c)*a+c*b.
4. The shared resource usage conflict detection method according to claim 2 or 3, characterized in that: The ciphertext value c is determined as follows: A sign function shsign(x) is preset, where x is the input of the sign function, and is used to output 1 when x is less than 0, otherwise output 0; or to output 0 when x is less than 0, otherwise output 1; Call the sign function shsign(x) with the difference between ciphertext a and ciphertext b as input to get the ciphertext value c.
5. The shared resource usage conflict detection method according to claim 4, characterized in that: In S2, the sign function shsign(x) is used to determine the size of each element in the ciphertext a and the array d.
6. The shared resource usage conflict detection method according to claim 1, characterized in that: In the element d[i] of array d, In the formula, is the Gaussian floor function.
7. The shared resource usage conflict detection method according to claim 1, characterized in that: In S4, the corresponding elements in array s and array d are multiplied and stored in array t first, and then the elements in array t are added to obtain the largest divisor that is less than the ciphertext a.
8. The shared resource usage conflict detection method according to claim 1, characterized in that: The maximum number of iterations is: In the formula, is the ceiling function.
9. A method for optimizing the use of shared resources based on homomorphic encryption, characterized in that: Detecting the shared resource usage conflict using the shared resource usage conflict detection method based on homomorphic encryption as described in any one of claims 1 to 8, and optimizing the shared resource usage cycle according to the detection result; the steps include: When the greatest common divisor is greater than a preset threshold, the user usage frequency is adjusted based on the set neighborhood.
10. A shared resource usage conflict detection system based on homomorphic encryption, characterized in that: Including client A, client B and server; Client A and client B perform homomorphic encryption on their respective shared resource usage frequencies and send the encrypted ciphertext to the server. The server is used to execute the shared resource usage conflict detection method based on homomorphic encryption as described in any one of claims 1-8 to detect shared resource usage conflicts.
Citation Information
Patent Citations
Data encryption method and related component
CN115001741A
Ciphertext feature matching method and system based on fully homomorphic encryption and composite polynomial
CN118381598A