Ciphertext sorting method and device, equipment, storage medium and program product

By using position marking and parity-even alternation strategies to partition the ciphertext array, the problems of high computational complexity and low efficiency in ciphertext sorting methods are solved, achieving secure and efficient ciphertext sorting while protecting the privacy of numerical information.

CN121456901APending Publication Date: 2026-02-03CHINA MOBILE GROUP JIANGSU +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511581741.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-31
Publication Date
2026-02-03

AI Technical Summary

Technical Problem

Existing encrypted sorting methods suffer from high computational complexity and low efficiency, especially when dealing with large amounts of data, and cannot effectively protect the privacy of numerical information.

Method used

Secure and efficient ciphertext sorting is achieved by dividing the ciphertext array using position marking and a parity-even alternation strategy.

Benefits of technology

By reducing computational complexity, a secure and efficient encrypted sorting method is achieved, protecting the privacy of numerical information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121456901A_ABST
    Figure CN121456901A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a ciphertext sorting method and device, equipment, a storage medium and a program product. The method comprises the following steps: acquiring a to-be-sorted ciphertext array; wherein the ciphertext array comprises a plurality of pieces of to-be-sorted ciphertext data; performing position identification on a plurality of pieces of ciphertext data in the ciphertext array to obtain a target array containing a plurality of pieces of target ciphertext data; wherein the target ciphertext data is the data after the position identification; each piece of target ciphertext data corresponds to one position identifier; and determining a sorting result of the multiple pieces of target ciphertext data in the target array based on a preset odd-even crossing strategy. According to the technical scheme, the target array containing the target ciphertext data is obtained by performing position identification on the multiple pieces of ciphertext data in the ciphertext array, and the sorting result of the multiple pieces of target ciphertext data in the target array is determined based on the preset odd-even crossing strategy, so that the sorting efficiency can be improved on the basis of reducing the calculation complexity. And safe and efficient ciphertext sorting is realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of privacy security, and in particular to a ciphertext sorting method and device, equipment, storage medium and program product. BACKGROUND

[0002] In the market expansion of the privacy computing platform, most industry customers in the joint statistical scene have high computing requirements, and sorting is a very key basic operator, such as finding the median in statistical analysis and sorting features in XGBoost.

[0003] Unlike plaintext sorting, ciphertext sorting needs to additionally consider the protection of numerical information, and hopes to not leak any size relationship of the initial position numerical value after sorting. The commonly used method in the past is a sorting network, such as odd-even merge sorting and double adjustment sorting, both of which belong to the non-cryptographic sorting, and have high complexity and low sorting efficiency. In the prior art, there are other schemes such as secure quicksort and secure radix sort, but they all have certain scene restrictions. When the data volume is very large, the comprehensive complexity will reach , and more additional bits are required, therefore, a ciphertext sorting method is urgently needed to solve the above technical problems. SUMMARY

[0004] Therefore, the present application provides a ciphertext sorting method, device, equipment, storage medium and program product, which can realize secure and efficient ciphertext sorting on the basis of reducing the computing complexity.

[0005] According to one aspect of the present application, the present application embodiment provides a ciphertext sorting method, the method comprising:

[0006] obtaining a ciphertext array to be sorted; wherein the ciphertext array comprises a plurality of ciphertext data to be sorted;

[0007] position identification is performed on the plurality of ciphertext data in the ciphertext array to obtain a target array comprising a plurality of target ciphertext data; wherein the target ciphertext data is the data after position identification; each target ciphertext data corresponds to a position identification;

[0008] determining the sorting result of the plurality of target ciphertext data in the target array based on a preset odd-even crossover strategy.

[0009] According to another aspect of the present application, the present application embodiment further provides a ciphertext sorting device, the device comprising:

[0010] The acquisition module is configured to acquire a ciphertext array to be sorted; wherein the ciphertext array comprises a plurality of ciphertext data to be sorted

[0011] A position identification module is configured to identify positions of the plurality of ciphertext data in the ciphertext array to obtain a target array containing a plurality of target ciphertext data; wherein the target ciphertext data are the data after position identification; and each of the target ciphertext data corresponds to a position identification.

[0012] A sorting module is configured to determine a sorting result of the plurality of target ciphertext data in the target array based on a preset odd-even cross strategy.

[0013] According to another aspect of the present application, the embodiments of the present application further provide an electronic device, which comprises:

[0014] at least one processor; and

[0015] a memory in communication with the at least one processor; wherein

[0016] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the ciphertext sorting method according to any one of the embodiments of the present application.

[0017] According to another aspect of the present application, the embodiments of the present application further provide a computer readable storage medium, which stores computer instructions for enabling a processor to execute the ciphertext sorting method according to any one of the embodiments of the present application.

[0018] According to another aspect of the present application, the embodiments of the present application further provide a computer program product, which comprises a computer program for enabling a processor to execute the ciphertext sorting method according to any one of the embodiments of the present application.

[0019] The above technical solution of the embodiments of the present application can realize safe and efficient ciphertext sorting on the basis of reducing the computational complexity, by identifying positions of the plurality of ciphertext data in the ciphertext array to obtain a target array containing a plurality of target ciphertext data, and determining a sorting result of the plurality of target ciphertext data in the target array based on a preset odd-even cross strategy.

[0020] It should be understood that the content described in this section is not intended to identify key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0021] In order to make the technical solution in the embodiments of the present application clearer, the following will briefly introduce the drawings needed in the embodiment description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort.

[0022] Figure 1 A flow chart of a ciphertext sorting method provided by an embodiment of the present application;

[0023] Figure 2 A flow chart of another ciphertext sorting method provided by an embodiment of the present application;

[0024] Figure 3 A structural block diagram of a ciphertext sorting device provided by an embodiment of the present application;

[0025] Figure 4 A structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0026] In order to make the technical solution in the embodiments of the present application clearer, the following will briefly introduce the drawings needed in the embodiment description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort.

[0027] It should be noted that the terms “first”, “second”, and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms “include” and “have” and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to the process, method, product or device.

[0028] In an embodiment, Figure 1 A flow chart of a ciphertext sorting method provided by an embodiment of the present application, the embodiment can be applicable to the case of sorting ciphertext data, the method can be executed by a ciphertext sorting device, the ciphertext sorting device can be realized in the form of hardware and / or software, and the ciphertext sorting device can be configured in an electronic device.

[0029] As Figure 1 shown, specifically, the ciphertext sorting method includes:

[0030] S110, obtaining a ciphertext array to be sorted; wherein the ciphertext array includes a plurality of ciphertext data to be sorted.

[0031] Among them, the plurality of ciphertext data to be sorted is each ciphertext data in the ciphertext array that needs to be sorted, and each ciphertext data can be regarded as an element in the array. The ciphertext data is the encrypted data related to the field.

[0032] In this embodiment, the ciphertext array to be sorted is obtained, which includes a plurality of sorted ciphertext data. In this embodiment, the ciphertext data can include but is not limited to various third-party field related big data such as medical insurance. For example, the big data in the medical insurance industry can include but is not limited to medical expenses of insured personnel, disease diagnosis expenses, drug usage, and other ciphertext data.

[0033] S120, position identification is performed on the plurality of ciphertext data in the ciphertext array to obtain a target array containing a plurality of target ciphertext data.

[0034] Among them, the target ciphertext data is the data after position identification; each target ciphertext data corresponds to a position identification. The form of the position identification can be subscript identification of the target ciphertext data, or superscript identification of the target ciphertext data. This embodiment does not limit it.

[0035] In this embodiment, before performing position identification on the plurality of ciphertext data, a secure random permutation operation needs to be performed on the original positions of the plurality of ciphertext data contained in the ciphertext array, and then the position identification is performed on each ciphertext data in the ciphertext array after the secure random permutation. Of course, the ciphertext array after the secure random permutation operation is still in the form of the ciphertext array, but the order of the plurality of ciphertext data contained in the secure permutation ciphertext array has changed. In this embodiment, the secure random permutation can be understood as a process of securely and randomly arranging the positions of the plurality of ciphertext data. In the process of secure random permutation, no other information is leaked, that is, the process of reordering is completed without knowing the data content and permutation mapping relationship.

[0036] S130, determining the sorting result of the plurality of target ciphertext data in the target array based on a preset odd-even cross strategy.

[0037] The preset parity crossover strategy can be understood as a parity crossover position identification strategy of the odd index identifier and the even index identifier. For example, the target ciphertext data is data with an odd position index, and the comparison strategy required to be executed for the odd position index is executed; the target ciphertext data is data with an even position index, and the comparison strategy required to be executed for the even position index is executed.

[0038] In the embodiment, when the ciphertext is sorted, a target ciphertext data can be randomly selected from the target array, and the target ciphertext data is taken as a reference value. After the reference value is selected, each target ciphertext data in the target array is divided into a subarray according to the reference value and the preset parity crossover strategy. For the divided subarray, each divided subarray is taken as a target array, and the step of randomly selecting a target ciphertext data from the target array is returned until all the subarrays cannot be divided. The sorting result is obtained, which can be understood as that each subarray after division is divided again in the same way as the target data division subarray until each subarray obtained finally cannot be divided. In other embodiments, the array is sorted according to the element value in the array, and each ciphertext sequence in the sorted array is input into the ciphertext sequence value sorting network. The ciphertext sequence is taken as an operand, and the operation operation required for the sequence sorting of the ciphertext sequence is performed in parallel to obtain a second sorted ciphertext sequence, so as to obtain the corresponding ciphertext sorting result. Of course, the ciphertext can also be sorted by other ways, and the embodiment is not limited again.

[0039] The above technical solution of the embodiment of the application can realize safe and efficient ciphertext sorting on the basis of reducing the calculation complexity by identifying the positions of the plurality of ciphertext data in the ciphertext array, obtaining the target array containing the plurality of target ciphertext data, and determining the sorting result of the plurality of target ciphertext data in the target array based on the preset parity crossover strategy.

[0040] In an embodiment, Figure 2 The flowchart of another ciphertext sorting method provided by an embodiment of the application is further refined on the basis of the above embodiments, and the positions of the plurality of ciphertext data in the ciphertext array are identified to obtain the target array containing the plurality of target ciphertext data, and the sorting result of the plurality of target ciphertext data in the target array is determined based on the preset parity crossover strategy.

[0041] As Figure 2 shown, the ciphertext sorting method in the embodiment can include the following steps:

[0042] S210, a ciphertext array to be sorted is obtained; the ciphertext array includes a plurality of ciphertext data to be sorted.

[0043] S220, determine the original positions corresponding to each ciphertext data in the ciphertext array respectively, and perform secure random permutation on each original position to obtain a randomly permuted ciphertext array.

[0044] The original position can be understood as the position order of each ciphertext data before the secure random permutation.

[0045] In this embodiment, the output after the secure random permutation is still a ciphertext array, but the position order of each ciphertext data in the ciphertext array has been randomly permuted, and the permutation function does not leak to any participant. It should be noted that the secure random permutation is independent of the ordered ciphertext technology, which can be called oblivious shuffle, which is often implemented through a ciphertext permutation network, and the purpose is to avoid leaking the size relationship of the original ciphertext array when opening the comparison result of two elements in the subsequent quicksort algorithm. The oblivious shuffle is an inadvertent permutation, that is, a process of disordering the position order of each ciphertext data in the array in a secure state.

[0046] S230, performing position identification on each ciphertext data contained in the randomly permuted ciphertext array to obtain a plurality of target ciphertext data after position identification.

[0047] In this embodiment, position identification is performed on each ciphertext data contained in the randomly permuted ciphertext array to obtain a plurality of target ciphertext data after position identification. For example, data a1 in array A indicates that the position of data a is 1, and data b2 indicates that the position of data b is 2.

[0048] S240, randomly selecting a target ciphertext data from the target array and taking the target ciphertext data as a reference value.

[0049] The reference value is randomly selected from the target ciphertext data contained in the target array. The reference value in this embodiment can also be called the pivot of the quicksort algorithm.

[0050] In this embodiment, a ciphertext is randomly selected from the ciphertext array to be sorted as a reference value, and after secure comparison using the odd-even crossover strategy, two non-degenerate divide-and-conquer sorting subarrays are obtained. In this embodiment, non-degenerate can be understood as each time the subarray is easy to keep balanced, that is, for a ciphertext array of size N, after division according to the odd-even crossover strategy, two divide-and-conquer sorting subarrays of size close to 1 / 2 are obtained.

[0051] S250, dividing each target ciphertext data in the target array according to the reference value and the preset odd-even crossover strategy.

[0052] In the embodiment, the reference value and the preset parity crossover strategy are used to divide each target ciphertext data in the target array into a subarray, and the divided subarray is two subarrays. Specifically, whether the position identifier corresponding to the target ciphertext data is an odd position identifier or an even position identifier is determined, and the odd position identifier and the even position identifier are compared with the reference value to obtain a comparison result (yes or no). All comparison data results of the odd and even positions are integrated, the same result is a group (the comparison result is yes for a group, and the comparison result is no for another group), and the data in the array is divided into two subarrays.

[0053] In the embodiment, the parity crossover strategy is used. Even if the reference value is equal to a large number of elements in the original array, any equal value has an equal probability of falling on both sides, thereby balancing the size of the two intervals and enabling the algorithm to end quickly.

[0054] In an embodiment, each target ciphertext data in the target array is divided into a subarray according to the reference value and the preset parity crossover strategy, including:

[0055] It is determined whether the position identifier corresponding to each target ciphertext data is an odd position identifier or an even position identifier.

[0056] If the position identifier of the target ciphertext data is an odd position identifier, a comparison of whether the target ciphertext data of the odd position identifier is greater than the reference value is performed to obtain a first comparison result.

[0057] If the position identifier of the target ciphertext data is an even position identifier, a comparison of whether the target ciphertext data of the even position identifier is greater than or equal to the reference value is performed to obtain a second comparison result.

[0058] The subarray is divided according to the first comparison result and the second comparison result.

[0059] In the embodiment, the first comparison result includes: when the target data of the odd position identifier is greater than the reference value, the result is a first identifier; and when the target data of the odd position identifier is less than or equal to the reference value, the result is a second identifier. The second comparison result includes: when the target data of the even position identifier is greater than or equal to the reference value, the result is a first identifier; and when the target data of the odd position identifier is less than the reference value, the result is a second identifier. The first identifier can be 1, indicating that the comparison result is yes, and the second identifier can be 0, indicating that the comparison result is no.

[0060] In the embodiment, when the sub-array division is performed, firstly, it is needed to determine whether the position identifier corresponding to each target ciphertext data respectively belongs to odd position identifier or even position identifier. If the position identifier of the target ciphertext data is odd position identifier, the comparison of whether the target ciphertext data of the odd position identifier is greater than the reference value is performed to obtain a first comparison result. If the position identifier of the target ciphertext data is even position identifier, the comparison of whether the target ciphertext data of the even position identifier is greater than or equal to the reference value is performed to obtain a second comparison result. The sub-array division is performed according to the first comparison result and the second comparison result. It can be understood that, for the data in the array, the comparison of whether the data of odd index position is greater than the reference value is performed to obtain a comparison result (‘yes’ or ‘no’); the comparison of whether the ciphertext data of even index position is greater than or equal to the reference value is performed to obtain a comparison result (‘yes’ or ‘no’). The comparison data results of the odd position and the even position are integrated. The same result is a group (the comparison result is ‘yes’ for a group, and the comparison result is ‘no’ for another group). The data in the array is divided into two sub-arrays.

[0061] It should be noted that, when the position identifier of the target ciphertext data is odd position identifier, the comparison of whether the target ciphertext data of the odd position identifier is greater than the reference value is performed. When the position identifier of the target ciphertext data is even position identifier, the comparison of whether the target ciphertext data of the even position identifier is greater than or equal to the reference value is performed. The comparison manner makes that even if the reference value is equal to a large number of elements of the original array, any equal value has an equal probability to fall on both sides, so as to balance the size of the two intervals, and make the algorithm end quickly. If they are all greater than, it is equivalent to the original quicksort two-way division, which is divided into two groups according to greater than pivot and less than or equal to pivot. When there are many equal values, for example, the pivot is equal to most elements, they are all in the group less than or equal to pivot, so that there are only a few greater than pivot, and the group less than or equal to pivot is close to the size of the original sorting, without reducing the problem scale by the power.

[0062] In an embodiment, the sub-array division according to the first comparison result and the second comparison result includes:

[0063] The result marked as the first identifier in the first comparison result and the second comparison result is divided into the first sub-array;

[0064] The result marked as the second identifier in the first comparison result and the second comparison result is divided into the second sub-array.

[0065] In the embodiment, the results identified as the first identification in the first comparison result and the second comparison result are divided into the first sub-array; and the results identified as the second identification in the first comparison result and the second comparison result are divided into the second sub-array. Specifically, all comparison data results of the odd and even positions are integrated, the same results are a group (the comparison result is "yes" for a group, and the comparison result is "no" for another group), and the data in the array is divided into two sub-arrays.

[0066] In the embodiment, the divided sub-arrays are respectively taken as target arrays, the step of randomly selecting a target ciphertext data from the target array is returned, until all sub-arrays cannot be divided, and a sorting result is obtained.

[0067] In the embodiment, the divided sub-arrays are respectively taken as target arrays, the step of randomly selecting a target ciphertext data from the target array is returned, until all sub-arrays cannot be divided, and a sorting result is obtained. It can be understood that the divided sub-arrays will recursively perform the ciphertext sorting of the sub-arrays, and the sub-arrays will randomly select the corresponding reference values from the target array, perform the comparison of the data at the odd index position greater than the reference value, and perform the comparison of the data at the even index position greater than or equal to the reference value, and then integrate all comparison data results of the odd and even positions, the same results are a group (the comparison result is "yes" for a group, and the comparison result is "no" for another group), and the data in the array is divided into two sub-arrays for sorting, that is, the sub-array is divided again, and the process is repeated until the sub-array cannot be divided.

[0068] The above technical solution in the embodiment can further stably prevent algorithm degradation, provide an efficient lower limit guarantee for the ciphertext sorting of actual problems, and achieve secure and efficient ciphertext sorting on the basis of obtaining computational complexity optimization.

[0069] In an embodiment, in order to better understand the way of dividing the target ciphertext data in the target array into sub-arrays according to the reference value and the preset odd-even cross strategy in the ciphertext sorting method, the reference value selected in the embodiment is 2, and the target ciphertext data is divided into sub-arrays. Table 1 is a schematic table when the array is divided by using the prior art, and Table 3 is a schematic table when the sub-arrays are divided by using the odd-even cross strategy provided in the embodiment of the present application. In Table 2, the comparison method of only using x>2 in the prior art is used; in Table 3, the target ciphertext data in the odd-numbered positions is compared with the reference value, and the target ciphertext data in the even-numbered positions is compared with the reference value.

[0070] In the embodiment, [2, 1, 2, 2, 2, 2, 3, 2, 2] represents an array, and a ciphertext number selected from the array is used as a reference value. In the embodiment, 2 is selected as the reference value. When the array is divided, the reference value selected is 2. As can be seen from Table 1, there are 7 results of “no” and 1 result of “yes” in the results of greater than 2. That is, if the comparison method of x (x is the reference value) greater than 2 is used, that is, Table 1, 7 “no” and 1 “yes” can be seen, so the division will be divided into 7+1 two sub-arrays, the problem size changes from 8 to 7, which is a linear complexity of the divide-and-conquer, and finally may degenerate to the complexity. According to the odd-even cross strategy in the present application, the sub-arrays are divided, that is, Table 2, the data in the even-numbered positions is compared with x greater than or equal to 2, and the data in the odd-numbered positions is compared with x greater than 2. At this time, the results of “yes” and “no” of the odd-numbered positions greater than or equal to 2 and the even-numbered positions greater than or equal to 2 are both 4, and the division is 4+4, the problem size changes from 8 to 4, which is a logarithmic complexity of the divide-and-conquer, and the complexity is maintained .

[0071] Table 1: Schematic when the array is divided by using the prior art

[0072]

[0073] Table 2: Schematic table when the sub-arrays are divided by using the odd-even cross strategy

[0074]

[0075] In an embodiment, Figure 3 A structural block diagram of a ciphertext sorting device provided in an embodiment of the present application is shown in FIG. 3. The device is suitable for the case of sorting the ciphertext data, and the device can be realized by hardware / software. The device can be configured in an electronic device to realize the ciphertext sorting method in the embodiment of the present application.

[0076] AsFigure 3 The device comprises an acquisition module 310, a position identification module 320 and a sorting module 330.

[0077] The acquisition module 310 is configured to acquire a ciphertext array to be sorted.

[0078] The position identification module 320 is configured to perform position identification on the plurality of ciphertext data in the ciphertext array to obtain a target array comprising a plurality of target ciphertext data.

[0079] The sorting module 330 is configured to determine a sorting result of the plurality of target ciphertext data in the target array based on a preset odd-even crossover strategy.

[0080] In the embodiment, the position identification module performs position identification on the plurality of ciphertext data in the ciphertext array to obtain the target array comprising the plurality of target ciphertext data, and the sorting module determines the sorting result of the plurality of target ciphertext data in the target array based on the preset odd-even crossover strategy, thereby achieving secure and efficient ciphertext sorting with reduced computational complexity.

[0081] In an embodiment, the position identification module 320 comprises:

[0082] A secure random permutation unit is configured to determine original positions corresponding to the plurality of ciphertext data in the ciphertext array respectively, and perform secure random permutation on the original positions to obtain a randomly-permuted ciphertext array.

[0083] A ciphertext data position identification unit is configured to perform position identification on each of the ciphertext data included in the randomly-permuted ciphertext array to obtain a plurality of target ciphertext data after position identification.

[0084] In an embodiment, the sorting module 330 comprises:

[0085] A reference value selection unit is configured to randomly select one target ciphertext data from the target array and take the target ciphertext data as a reference value.

[0086] A subarray division unit is configured to perform subarray division on each of the target ciphertext data in the target array according to the reference value and the preset odd-even crossover strategy.

[0087] A loop unit is configured to, for the divided subarrays, take each of the divided subarrays as a target array, return to the step of randomly selecting one target ciphertext data from the target array, until all the subarrays cannot be divided, and obtain a sorting result.

[0088] In an embodiment, the sub-array division unit comprises:

[0089] The position identifier identifying sub-unit is configured to determine whether the position identifier corresponding to each of the target ciphertext data belongs to an odd position identifier or an even position identifier.

[0090] The first comparison sub-unit is configured to perform a comparison between the target ciphertext data of the odd position identifier and the reference value if the position identifier of the target ciphertext data is an odd position identifier, to obtain a first comparison result.

[0091] The second comparison sub-unit is configured to perform a comparison between the target ciphertext data of the even position identifier and the reference value if the position identifier of the target ciphertext data is an even position identifier, to obtain a second comparison result.

[0092] The sub-array division sub-unit is configured to perform sub-array division according to the first comparison result and the second comparison result.

[0093] In an embodiment, the first comparison result comprises: a first identifier when the target data of the odd position identifier is greater than the reference value; and a second identifier when the target data of the odd position identifier is less than or equal to the reference value.

[0094] The second comparison result comprises: a first identifier when the target data of the even position identifier is greater than or equal to the reference value; and a second identifier when the target data of the odd position identifier is less than the reference value.

[0095] In an embodiment, the sub-array division sub-unit is specifically configured to:

[0096] divide the results identified as the first identifier in the first comparison result and the second comparison result into a first sub-array;

[0097] divide the results identified as the second identifier in the first comparison result and the second comparison result into a second sub-array.

[0098] The ciphertext sorting device provided by the embodiments of the present application can perform the ciphertext sorting method provided by any of the embodiments of the present application, and has the corresponding function modules and beneficial effects of the execution method.

[0099] In an embodiment, Figure 4A structural diagram of an electronic device is provided for embodiments of the present application. The electronic device 10 is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smart phones, wearable devices (e.g., headsets, glasses, watches, etc.), and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit implementations of the applications described and / or claimed in this document.

[0100] As shown in Figure 4 The electronic device 10 includes at least one processor 11, and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., connected to the at least one processor 11 in communication, where the memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer programs stored in the read-only memory (ROM) 12 or loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0101] A plurality of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunications networks.

[0102] The processor 11 can be various general and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs various methods and processes described above, such as the ciphertext sorting method.

[0103] In some embodiments, the ciphertext ordering method can be implemented as a computer program tangibly embodied in a computer readable storage medium, e.g., storage unit 18. In some embodiments, parts or all of the computer program can be loaded and / or installed onto electronic device 10 via, e.g., ROM 12 and / or communication unit 19. When the computer program is loaded onto RAM 13 and executed by processor 11, one or more steps of the ciphertext ordering method described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the ciphertext ordering method by way of other means, e.g., by way of firmware.

[0104] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, specially designed application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0105] Computer programs used to implement the methods of the present application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the computer program, when executed by the processor of the computer or other programmable data processing apparatus, enables the systems and methods as claimed in the claims to be implemented. The computer program can be executed entirely on a machine, partially on a machine and partially on a remote machine or entirely on a remote machine or server.

[0106] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer-readable storage medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of a machine-readable storage medium will include one or more lines of a program of instructions in a transitory signal, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0107] To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0108] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0109] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.

[0110] It should be understood that the various forms of flow shown above can be used to reorder, add or delete steps. For example, each step described in the present application can be executed in parallel, sequentially or in a different order, as long as the desired results of the technical solutions of the present application can be achieved, which is not limited herein.

[0111] The above detailed description does not constitute a limitation on the protection scope of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for sorting encrypted text, characterized in that, The method includes: Obtain a ciphertext array to be sorted; wherein the ciphertext array includes multiple ciphertext data to be sorted; The positions of multiple ciphertext data in the ciphertext array are marked to obtain a target array containing multiple target ciphertext data; wherein, the target ciphertext data is the data after being marked with positions; each target ciphertext data corresponds to a position mark; The sorting result of multiple target ciphertext data in the target array is determined based on a preset odd-even crossover strategy.

2. The method according to claim 1, characterized in that, The step of identifying the positions of multiple ciphertext data in the ciphertext array to obtain a target array containing multiple target ciphertext data includes: Determine the original position corresponding to each ciphertext data in the ciphertext array, and perform a secure random permutation on each original position to obtain a randomly permuted ciphertext array; Each ciphertext data contained in the randomly permuted ciphertext array is marked with its position to obtain multiple target ciphertext data after position marking.

3. The method according to claim 1, characterized in that, The process of determining the sorting result of multiple target ciphertext data in the target array based on a preset odd-even crossover strategy includes: Randomly select a target ciphertext data from the target array and use the target ciphertext data as a reference value; Based on the reference value and the preset odd-even crossover strategy, each target ciphertext data in the target array is divided into subarrays; For each of the divided subarrays, each of the divided subarrays is used as a target array. The step of randomly selecting a target ciphertext data from the target array is returned until all subarrays cannot be divided, and the sorting result is obtained.

4. The method according to claim 3, characterized in that, The step of dividing the target ciphertext data in the target array into subarrays according to the reference value and the preset odd-even crossover strategy includes: Determine whether the location identifier corresponding to each of the target ciphertext data belongs to an odd-numbered location identifier or an even-numbered location identifier; If the location identifier of the target ciphertext data is an odd-numbered location identifier, then a comparison is performed on the target ciphertext data with the odd-numbered location identifier to determine whether it is greater than the reference value, and a first comparison result is obtained; If the location identifier of the target ciphertext data is an even-numbered location identifier, then a comparison is performed on the target ciphertext data with the even-numbered location identifier to determine whether it is greater than or equal to the reference value, and a second comparison result is obtained. The subarrays are divided based on the first comparison result and the second comparison result.

5. The method according to claim 4, characterized in that, The first comparison result includes: when the target data of the odd-numbered position identifier is greater than the reference value, the result is a first identifier; when the target data of the odd-numbered position identifier is less than or equal to the reference value, the result is a second identifier. The second comparison result includes: when the target data of the even-numbered position is greater than or equal to the reference value, the result is the first identifier; when the target data of the odd-numbered position is less than the reference value, the result is the second identifier.

6. The method according to claim 5, characterized in that, The subarray is divided based on the first comparison result and the second comparison result, including: The results identified by the first identifier in the first comparison result and the second comparison result are divided into the first subarray; The results identified by the second identifier in the first comparison result and the second comparison result are divided into the second subarray.

7. A ciphertext sorting device, characterized in that, The device includes: The acquisition module is used to acquire a ciphertext array to be sorted; wherein the ciphertext array includes multiple ciphertext data to be sorted. A location identification module is used to identify the location of multiple ciphertext data in the ciphertext array to obtain a target array containing multiple target ciphertext data; wherein, the target ciphertext data is the data after location identification; each target ciphertext data corresponds to a location identification; The sorting module is used to determine the sorting result of multiple target ciphertext data in the target array based on a preset odd-even crossover strategy.

8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the ciphertext sorting method according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the ciphertext sorting method according to any one of claims 1-6.

10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the ciphertext sorting method according to any one of claims 1-6.