A homomorphic encryption-based shared resource usage conflict detection method and system
By encrypting resource usage frequency using homomorphic encryption and determining the greatest common divisor by using symbolic functions to judge the numerical value, the privacy protection and efficient calculation problems of resource usage conflict detection in resource sharing platforms are solved, thus realizing the rational allocation and utilization of resources.
Patent Information
- Application Number
- CN202411682006.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2026-01-13
- Estimated Expiration
- 2044-11-22
AI Technical Summary
In existing resource-sharing platforms, there are challenges in effectively detecting and resolving periodic conflicts in resource usage without compromising user privacy, especially in efficiently calculating the greatest common divisor on encrypted data.
A homomorphic encryption-based method is used to encrypt the frequency of user-shared resource usage. Collisions are detected by determining the greatest common divisor of the encrypted ciphertext, and a fixed number of iterations are set during the iteration process to avoid security risks. The sign function is used to determine the numerical value and optimize the frequency of resource usage.
It enables efficient conflict detection without revealing resource usage frequency, improves the fairness and efficiency of resource allocation, avoids security risks caused by infinite iteration, and improves computational efficiency and security.
Smart Images

Figure CN119483904B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data encryption technology, and more specifically to a method for rationally allocating limited resources (such as time, space, personnel, or equipment) under encrypted conditions to minimize conflicts. Background Technology
[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 compromising user privacy, in order to ensure the rational allocation and efficient utilization of resources.
[0003] Traditional resource conflict detection methods typically require users to disclose their resource usage patterns, which may not only leak users' trade secrets or personal privacy but also lead to unfair resource allocation. Protecting user data privacy is particularly crucial in the fields of cloud computing and encryption. While existing encryption technologies can protect data security during transmission and storage, performing computations on encrypted data remains a significant technical challenge.
[0004] Especially in scenarios requiring the computation of the greatest common divisor (GCD), GCD calculation has wide applications in many fields, such as resource scheduling, time synchronization, and signal processing. However, existing fully homomorphic encryption algorithms, which only support addition and multiplication operations, are difficult to directly apply to GCD computation in ciphertext states. Current methods for addressing this problem mainly include:
[0005] Homomorphic algorithm adaptation: The traditional GCD algorithm can be simulated by designing special homomorphic algorithms, but this method is not efficient in practice because the subtraction convergence speed is slow and may introduce a lot of computational overhead.
[0006] Special homomorphic encryption schemes: These schemes may support more complex computations, enabling the direct or indirect implementation of GCD computations. However, these schemes typically require more computational resources and time, thus suffering from efficiency drawbacks.
[0007] Therefore, in summary, there is an urgent need for a new method to efficiently calculate the greatest common divisor of encrypted data, thereby effectively detecting and resolving 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-mentioned technical problems, the present invention provides a method and system for detecting shared resource usage conflicts based on homomorphic encryption.
[0009] To achieve the above objectives, the present invention adopts the following technical solution:
[0010] On one hand, this application discloses a method for detecting shared resource usage conflicts based on homomorphic encryption, including homomorphically encrypting the usage frequency of shared resources for each user, determining the greatest common divisor (GCD) based on the encrypted ciphertext, and detecting shared resource usage conflicts based on the GCD; wherein, the step of determining the GCD based on the encrypted ciphertext includes:
[0011] S1. Homomorphically encrypt the shared resource usage frequencies of any two users to obtain corresponding ciphertexts. Assign the larger ciphertext to 'a', and the smaller ciphertext to 'b'. Then multiply ciphertext b by b*2. i The data is stored in array d in a specific manner;
[0012] S2. Determine the size of each element in ciphertexts a and d respectively, and store the output results (either 0 or 1) in array c.
[0013] S3. Subtract each subsequent element of array c from its adjacent preceding 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 less than the ciphertext a;
[0015] S5. Subtract the greatest common divisor from ciphertext a and repeat steps S2-S4 with ciphertext b until the maximum number of iterations is met. Output the larger value in the last iteration as the greatest common divisor.
[0016] Further, assign the larger value of ciphertext a to ciphertext a and the smaller value to ciphertext b. The steps include:
[0017] Determine the ciphertext value c: If ciphertext a is less than ciphertext b, determine the ciphertext value c as 1; otherwise, determine the ciphertext value c as 0.
[0018] Based on the ciphertext value c, assign values to ciphertext a and ciphertext b using the following formula;
[0019] a = (1-c)*a + c*b
[0020] b = c*a + (1-c)*b.
[0021] Alternatively, determine the ciphertext value c: if ciphertext a is less than ciphertext b, determine the ciphertext value c as 0; otherwise, determine the ciphertext value c as 1.
[0022] Based on the ciphertext value c, assign values to ciphertext a and ciphertext b using 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 default sign function shsign(x) is provided, where x is the input of the sign function. It is used to output 1 when x is less than 0, and 0 otherwise; or to output 0 when x is less than 0, and 1 otherwise.
[0027] Call the symbol function shsign(x), taking 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 array d,
[0030]
[0031] In the formula, This is the Gaussian floor function.
[0032] Furthermore, in S4, the corresponding elements in arrays s and d are multiplied and stored in array t first. Then, the elements in array t are added together to obtain the largest divisor less than the ciphertext a.
[0033] Furthermore, the maximum number of iterations is:
[0034]
[0035] In the formula, This is the floor function.
[0036] On the other hand, this application discloses a method for optimizing the use of shared resources based on homomorphic encryption, including detecting usage conflicts of shared resources using the homomorphic encryption-based shared resource usage conflict detection method described in any one of the above claims, and optimizing the usage cycle of shared resources based on the detection results; the steps include:
[0037] When the greatest common divisor is greater than a preset threshold, the user's usage frequency is adjusted based on the set neighborhood.
[0038] On the other hand, this application discloses a shared resource usage conflict detection system based on homomorphic encryption, including user A, user B and server;
[0039] User A and User B each encrypt their usage frequency of the shared resource 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 above, and to detect usage conflicts of shared resources.
[0041] As can be seen from the above technical solutions, the present invention discloses a method and system for detecting shared resource usage conflicts based on homomorphic encryption, which is used to determine the conflict situation 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 the minimum usage conflict, and helping to improve the rational allocation and utilization of resources.
[0042] Meanwhile, the method for determining the greatest common divisor provided in this application not only improves the solution efficiency but also avoids security risks by fixing the number of iterations; specifically, it finds the largest divisor b*2 that is exactly less than the ciphertext a. i This is equivalent to performing 2 in just 1 time. i The process of iteration reduces the loss and greatly improves efficiency. At the same time, when faced with the problem that it is impossible to determine the end condition of two numbers being equal 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 iteration. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0044] Figure 1 The flowchart provided by the present invention illustrates the steps for determining the greatest common divisor based on encrypted ciphertext.
[0045] Figure 2 This is a schematic diagram of a calculation example provided by the present invention. Detailed Implementation
[0046] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0047] Example 1
[0048] Specifically, the shared resource usage conflict detection method based on homomorphic encryption disclosed in this application includes: homomorphically encrypting the resource usage frequency of each user's shared resources, determining the greatest common divisor based on the encrypted ciphertext, and then detecting the shared resource usage conflict based on the greatest common divisor;
[0049] Among them, the step of determining the greatest common divisor based on the encrypted ciphertext is as follows: Figure 1 As shown, it includes:
[0050] S1. Homomorphically encrypt the shared resource usage frequencies of any two users to obtain corresponding ciphertexts. Assign the larger ciphertext to 'a', and the smaller ciphertext to 'b'. Then multiply ciphertext b by b*2. i The elements are stored in array d in a specific way, where i represents the position number of each element in the array;
[0051] S2. Determine the size of each element in the ciphertext a and array d respectively, and store the output result (either 0 or 1) in array c.
[0052] S3. Subtract each subsequent element of array c from its adjacent preceding 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 less than the ciphertext a;
[0054] S5. Subtract the greatest common divisor from ciphertext a and repeat steps S2-S4 with 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 fully homomorphic encryption ciphertext solution method disclosed in this invention not only guarantees 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 the embodiments of the present invention,
[0057] In step S1, the assignment process is as follows: First, determine the ciphertext value c, that is, if the ciphertext a is less than the ciphertext b, determine the ciphertext value c as 1, otherwise determine the ciphertext value c as 0;
[0058] Then, based on the ciphertext value c, assign values to ciphertext a and ciphertext b 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 this case, a=(1-c)*a+c*b=a, b=c*a+(1-c)*b=b;
[0063] If a < b, then c = 1. In this case, a = (1-c)*a + c*b = b, and b = c*a + (1-c)*b = a.
[0064] Alternatively, determine the ciphertext value c: if ciphertext a is less than ciphertext b, determine the ciphertext value c as 0; otherwise, determine the ciphertext value c as 1.
[0065] Based on the ciphertext value c, assign values to ciphertext a and ciphertext b using the following formula;
[0066] a = c*a + (1-c)*b
[0067] b = (1-c)*a + c*b.
[0068] In this application, the above method is used to ensure that a always maintains a large value and b always maintains a small value.
[0069] In a preferred embodiment, a preset symbol function shsign(x) is used to output ciphertext 1 when the plaintext value of ciphertext x is less than 0, and output ciphertext 0 otherwise; or to output ciphertext 0 when the plaintext value of ciphertext x is less than 0, and output ciphertext 1 otherwise.
[0070] Then, by calling the symbol function shsign(x), the ciphertext value c is obtained by taking the difference between ciphertext a and ciphertext b as input.
[0071] Furthermore, the smaller ciphertext b is divided into b*2 i The data is stored in array d in a specific manner. In this embodiment, to ensure that b*2... i >max(a,b) makes array d contain, in, This is a Gaussian floor function. In one 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 is compared with the size of each element in array d, and the output result is either 0 or 1. That is, when the ciphertext a is greater than or equal to each element in array d, the output is 1, and when the ciphertext a is greater than or equal to each element in array d, the output is 0; or when the ciphertext a is greater than or equal to each element in array d, the output is 0.
[0073] The symbol function shsign(x) is called first, that is, ad[i] is used as the input parameter to obtain the element c[i] in array c through the function shsign. At this time, the number of elements in array c and array d is the same, both containing MAX+1 elements;
[0074] In step S3, in order to obtain the largest b*2 that is just less than a i This involves subtracting each subsequent element from its preceding adjacent element in array c, and then forming array s based on the calculation results. In array s, element s[i] = c[i+1] - c[i]. The loop condition can be set to (i = 0; i ≤ MAX - 1; i++) to ensure that array s has only MAX elements.
[0075] In step S4, the corresponding elements in arrays s and d are multiplied and summed to obtain the largest divisor less than the ciphertext a. In this embodiment, the result of the multiplication is placed in array t, i.e., t[i] = s[i] * d[i]. Then, the terms of array t are summed to obtain the largest divisor b * 2 that is just less than a. i ,
[0076] Further, in step S5, after subtracting the greatest common divisor from ciphertext a, steps S2-S4 are repeated with ciphertext b until the maximum number of iterations is met, and the larger value in the last iteration is taken as the greatest common divisor.
[0077] In this application, there are two scenarios for the first iteration: the first is a > a / 2 > b, which reduces the size to more than half of the original; the second is a > b > a / 2, which does not satisfy the requirement of reducing the size to more than half of the original. However, since steps S2-S4 are repeated in each iteration, ensuring a > b, then a / 2 > b / 2 must exist. Therefore, a > b > a / 2 > b / 2, and thus, the second iteration will guarantee a reduction to more than half of the original size. Therefore, the maximum number of iterations is set to:
[0078]
[0079] In the formula, This is the floor function.
[0080] In one embodiment, the order of magnitude of the ciphertext is obtained through the client to determine the number of iterations; for example, when a,b < 10 3 When the iteration count is 2(log₂1024) = 20, and a, b < 10, the iteration count is 2(log₂1024) = 20. 4 At that time, the number of iterations is 2(log216384) = 28.
[0081] An exemplary implementation is as follows: Figure 2As shown, where a = 1023, b = 1, the number of iterations is determined to be 20, and i in array d is 10; if a symbol function shsign(x) is defined to output ciphertext 1 when the plaintext value of ciphertext x is less than 0, otherwise output ciphertext 0;
[0082] After the first iteration, the largest divisor less than a is 512.
[0083] In the second iteration, a is reassigned, i.e., a = 1023 - 512, b = 1; after continuing to find the common divisor in the same way, the common divisor is 256;
[0084] Consistent with the second iteration, a is reassigned until the 20th iteration. At this point, the larger of the reassigned a and b is output as the greatest common divisor.
[0085] Example 2
[0086] This embodiment discloses a method for optimizing the use of shared resources based on homomorphic encryption, including detecting usage conflicts of shared resources using the homomorphic encryption-based shared resource usage conflict detection method described above, and optimizing the usage cycle of shared resources based on the detection results; the steps include:
[0087] When the greatest common divisor is greater than a preset threshold, the user's usage frequency is adjusted based on the set neighborhood.
[0088] In this embodiment, the magnitude of the greatest common divisor (GCD) is positively correlated with the conflict; that is, the larger the GCD, the greater the conflict. Therefore, a preset threshold can be set according to needs. When the GCD is greater than the preset threshold, the resource usage frequencies of the two are adjusted within a certain range to optimize resource usage, improve efficiency, and ensure fair resource allocation. In a preferred embodiment, the preset threshold is set to 1.
[0089] Example 3
[0090] This embodiment discloses a shared resource usage conflict detection system based on homomorphic encryption. The system includes a user terminal A, a user terminal B, and a server.
[0091] User A and User B each encrypt their usage frequency of the shared resource 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 above, and to detect the usage conflict of shared resources based on the encrypted ciphertext.
[0093] In a preferred embodiment,
[0094] User A sends its resource usage frequency in encrypted ciphertext using fully homomorphic encryption to the server; User B uses the public key published by User A to encrypt its own resource usage frequency, and calculates the greatest common divisor of the two in the ciphertext, or sends the ciphertext to the server to determine the greatest common divisor; then the result is returned to User A.
[0095] User A receives the ciphertext result, decrypts it to obtain the greatest common divisor of the usage frequencies of the two parties, analyzes the degree of conflict based on the greatest common divisor, and if the conflict is large, modifies the usage frequency within a certain neighborhood and repeats the above steps 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 existing technologies, this application cleverly utilizes the properties of homomorphic encryption to determine resource usage conflicts without revealing the frequency of resource usage by both parties. This provides a basis for both parties to adjust their usage frequency to minimize conflicts, which helps to improve the rational allocation and utilization of resources.
[0097] Specifically in step S1, this application uses b*2 to convert smaller ciphertext into b*2 i The product is stored in array d[i] in a way that allows for quick finding of the largest divisor less than the ciphertext a in subsequent steps, greatly improving the algorithm's execution efficiency. Furthermore, this method employs a strategy of prioritizing the storage of products before summing in step S4, further optimizing the calculation process and reducing the computational load.
[0098] Meanwhile, the proposed symbol function shsign(x) can determine the size relationship between two numbers in the ciphertext state, ensuring the security of the encryption process. Furthermore, this method sets a maximum number of iterations during the iteration process to avoid potential security risks caused by infinite iteration.
[0099] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.
[0100] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those 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 invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A homomorphic encryption-based shared resource usage conflict detection method, characterized by, The homomorphic encryption is performed on the shared resource usage frequency of each user, the greatest common divisor is determined according to the encrypted ciphertext, and the shared resource usage conflict is detected based on the greatest common divisor; wherein the step of determining the greatest common divisor according to the encrypted ciphertext comprises: S1, homomorphic encryption is performed on the sharing resource usage frequency of any two users to obtain corresponding ciphertexts, a larger ciphertext is assigned to a, a smaller ciphertext is assigned to b, and the ciphertext b is stored in an array d in the form of b*2 i , i represents the position number of each element in the array. S2, respectively judging the size of the ciphertext a and each element in the array d, and storing the non-0 or 1 output result in the array c; S3, making the difference between the last element in the array c and the adjacent previous element, and forming the array s based on the calculation result; S4, multiplying the array s and the corresponding elements in the array d and then summing up to obtain the greatest divisor less than the ciphertext a; S5, repeatedly performing steps S2-S4 on the ciphertext a minus the greatest divisor and the ciphertext b until the maximum iteration number is met, and outputting the larger value in the last iteration as the greatest common divisor.
2. The shared resource usage conflict detection method of claim 1, wherein, The larger ciphertext is assigned to a, and the smaller ciphertext is assigned to b, and the steps comprise: determining the ciphertext value c: when the ciphertext a is less than the ciphertext b, determining the ciphertext value c as 1, otherwise determining the ciphertext value c as 0; assigning values to the ciphertext a and the ciphertext b according to the ciphertext value c through the following formula: a=(1-c)*a+c*b b=c*a+(1-c)*b.
3. The shared resource usage conflict detection method of claim 1, wherein, The larger ciphertext is assigned to a, and the smaller ciphertext is assigned to b, and the steps comprise: determining the ciphertext value c: when the ciphertext a is less than the ciphertext b, determining the ciphertext value c as 0, otherwise determining the ciphertext value c as 1; assigning values to the ciphertext a and the ciphertext b according to the ciphertext value c through 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 by, The ciphertext value c is determined in the following way: a preset sign function shsign(x), x is the input of the sign function, which is used to output 1 when x is less than 0, otherwise output 0; or used to output 0 when x is less than 0, otherwise output 1; calling the sign function shsign(x) to obtain the ciphertext value c by taking the difference between the ciphertext a and the ciphertext b as the input.
5. The shared resource usage conflict detection method of claim 4, wherein, In S2, the sign function shsign(x) is used to judge the size of the ciphertext a and each element in the array d.
6. The shared resource usage conflict detection method of claim 1, wherein, In the element d[i] of the array d, In the formula, is a floor function.
7. The shared resource usage conflict detection method of claim 1, wherein, In S4, the array s and the corresponding elements in the array d are multiplied and stored in the array t in priority, and then the elements in the array t are added to obtain the greatest divisor less than the ciphertext a.
8. The shared resource usage conflict detection method of claim 1, wherein, The maximum iteration number is: In the formula, is a 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 by using the homomorphic encryption based shared resource usage conflict detection method in any one of claims 1-8, and optimizing the shared resource usage period according to the detection result; the steps comprise: when the greatest common divisor is greater than a preset threshold, adjusting the user usage frequency based on the set neighborhood.
10. A homomorphic encryption based shared resource usage conflict detection system, characterized in that, comprising a user terminal A, a user terminal B and a service terminal; the user terminal A and the user terminal B perform homomorphic encryption on the shared resource usage frequency of each user respectively, and send the encrypted ciphertext to the service terminal; the service terminal is used for executing the homomorphic encryption based shared resource usage conflict detection method in any one of claims 1-8 to detect the shared resource usage conflict.
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