CN112035850B - Data processing method and device and electronic equipment - Google Patents

Data processing method and device and electronic equipment Download PDF

Info

Publication number
CN112035850B
CN112035850B CN201910483051.7A CN201910483051A CN112035850B CN 112035850 B CN112035850 B CN 112035850B CN 201910483051 A CN201910483051 A CN 201910483051A CN 112035850 B CN112035850 B CN 112035850B
Authority
CN
China
Prior art keywords
ciphertext
array
comparison result
equal
operated
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910483051.7A
Other languages
Chinese (zh)
Other versions
CN112035850A (en
Inventor
王国赛
王蜀洪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huakong Tsingjiao Information Technology Beijing Co Ltd
Original Assignee
Huakong Tsingjiao Information Technology Beijing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huakong Tsingjiao Information Technology Beijing Co Ltd filed Critical Huakong Tsingjiao Information Technology Beijing Co Ltd
Priority to CN201910483051.7A priority Critical patent/CN112035850B/en
Publication of CN112035850A publication Critical patent/CN112035850A/en
Application granted granted Critical
Publication of CN112035850B publication Critical patent/CN112035850B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/606Protecting data by securing the transmission between two devices or processes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2107File encryption
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)

Abstract

The embodiment of the invention provides a data processing method, a data processing device and electronic equipment, wherein the method comprises the following steps: acquiring an array A to be operated with the length of n and operation information, wherein the position of an element x to be operated in the operation information is ciphertext k; when the operation information is element insertion class: constructing a first auxiliary array B1 with the length of n+1; assigning each element B1[ i ] in the first auxiliary array B1 as follows: (whether comparison position i is equal to comparison result M1 x of ciphertext k) + (whether comparison position i is less than comparison result M2 ai) of ciphertext k) + (whether comparison position i is greater than comparison result M3 ai-1 of ciphertext k); when the operation information is element deletion class: constructing a second auxiliary array B2 with the length of n-1; assigning the element B2[ j ] in the second auxiliary array B2 as: (whether the comparison position j is smaller than the comparison result M4 xAj) of the ciphertext k (whether the comparison position j is larger than or equal to the comparison result M5 xAj+1 of the ciphertext k); therefore, the data can be added and deleted based on the ciphertext.

Description

Data processing method and device and electronic equipment
Technical Field
The present invention relates to the field of data processing, and in particular, to a data processing method, apparatus, and electronic device.
Background
With the continuous development of computer, communication technology and internet technology, most users transmit and store information through electronic devices, such as uploading files to a cloud for storage, sending files to other users, and so on. In order to ensure the security of the information, the data is generally encrypted, for example, in the process of storing the data, the data is encrypted on the corresponding stored electronic device, such as the data is encrypted on a server and a terminal; and encrypting the data in the process of data transmission, such as encrypting the data in the process of terminal and server transmission.
When the electronic equipment needs to use the data, the data needs to be decrypted firstly, and after the plaintext of the information is obtained, the data is subjected to corresponding calculation and other processes; this can lead to information safety hazards; for example, in an electronic payment scenario, the plain text of face data used for payment by a user is visible to the Unionpay in the payment operation, and if the face data is stolen and the face data is associated with information such as a corresponding user account, a great risk is caused to the user. To solve this problem, data calculation may be performed based on ciphertext to fully secure user information.
In the process of calculating data based on ciphertext, adding and deleting operations are generally required to be carried out on the array; however, the current server node cannot perform the adding and deleting operation on the array based on the ciphertext adding and deleting conditions, for example, how to determine which element in the array should be deleted according to the ciphertext deleting conditions, how to determine which position in the array to add the element according to the ciphertext adding conditions, and so on.
Disclosure of Invention
The embodiment of the invention provides a data processing method for realizing the addition and deletion operation of an array based on ciphertext conditions.
Correspondingly, the embodiment of the invention also provides a data processing device and electronic equipment, which are used for ensuring the realization and application of the method.
In order to solve the above problems, the present invention discloses a data processing method, comprising: acquiring an array A to be operated and operation information corresponding to the array A to be operated, wherein the position of an element x to be operated in the operation information is ciphertext k, and the length of the array A to be operated is n; when the operation information is element insertion type operation information: constructing a first auxiliary array B1, wherein the length of the first auxiliary array B1 is n+1; assigning an element B1[ i ] corresponding to each position i in the first auxiliary array B1 as follows: (whether the comparison position i is equal to the comparison result M1 of the ciphertext k) + (whether the comparison position i is smaller than the comparison result M2 of the ciphertext k is equal to the comparison result M3 of the ciphertext k is greater than the comparison result M1 of the ciphertext k is equal to the comparison result A1), and a first auxiliary array B1 is obtained after inserting the element x at the position k of the array A to be operated; when the operation information is element deletion type operation information: constructing a second auxiliary array B2, wherein the length of the second auxiliary array B2 is n-1; assigning an element B2[ j ] corresponding to each position j in the second auxiliary array B2 as follows: (whether the comparison position j is smaller than the comparison result M4 of the ciphertext k is equal to or larger than the comparison result M5 of the ciphertext k is equal to or larger than the comparison result M1 of the ciphertext k is equal to or smaller than the comparison result M4 of the ciphertext k), and a second auxiliary array B2 is obtained after deleting the element x to be operated of the position k in the array A to be operated; wherein M1, M2, M3, M4 and M5 are all ciphertext of 0 or 1, n is a positive integer, i and j are integers, the value range of i is 0-n, and the value range of j is 0-n-2.
Optionally, when the position i is equal to the ciphertext k, the comparison result M1 is a ciphertext of 1; when the position i is not equal to the ciphertext k, the comparison result M1 is a ciphertext of 0; when the position i is smaller than the ciphertext k, the comparison result M2 is a ciphertext of 1; when the position i is not smaller than the ciphertext k, the comparison result M2 is a ciphertext of 0; when the position i is larger than the ciphertext k, the comparison result M3 is a ciphertext of 1; and when the position i is not greater than the ciphertext k, the comparison result M3 is a ciphertext of 0.
Optionally, when the position j is smaller than the ciphertext k, the comparison result M4 is a ciphertext of 1; when the position j is not smaller than the ciphertext k, the comparison result M4 is a ciphertext of 0; when the position j is greater than or equal to the ciphertext k, the comparison result M5 is a ciphertext of 1; when the position j is not greater than and not equal to the ciphertext k, the comparison result M5 is a ciphertext of 0.
The embodiment of the invention also discloses a data processing device, which comprises: the operation information acquisition module is used for acquiring an array A to be operated and operation information corresponding to the array A to be operated, wherein the position of an element x to be operated in the operation information is ciphertext k, and the length of the array A to be operated is n; the element to be operated inserting module is used for inserting the class operation information when the operation information is the element: constructing a first auxiliary array B1, wherein the length of the first auxiliary array B1 is n+1; assigning an element B1[ i ] corresponding to each position i in the first auxiliary array B1 as follows: (whether the comparison position i is equal to the comparison result M1 of the ciphertext k) + (whether the comparison position i is smaller than the comparison result M2 of the ciphertext k is equal to the comparison result M3 of the ciphertext k is greater than the comparison result M1 of the ciphertext k is equal to the comparison result A1), and a first auxiliary array B1 is obtained after inserting the element x at the position k of the array A to be operated; the to-be-operated element deleting module is used for when the operation information is element deleting operation information: constructing a second auxiliary array B2, wherein the length of the second auxiliary array B2 is n-1; assigning an element B2[ j ] corresponding to each position j in the second auxiliary array B2 as follows: (whether the comparison position j is smaller than the comparison result M4 of the ciphertext k is equal to or larger than the comparison result M5 of the ciphertext k is equal to or larger than the comparison result M1 of the ciphertext k is equal to or smaller than the comparison result M4 of the ciphertext k), and a second auxiliary array B2 is obtained after deleting the element x to be operated of the position k in the array A to be operated; wherein M1, M2, M3, M4 and M5 are all ciphertext of 0 or 1, n is a positive integer, i and j are integers, the value range of i is 0-n, and the value range of j is 0-n-2.
Optionally, when the position i is equal to the ciphertext k, the comparison result M1 is a ciphertext of 1; when the position i is not equal to the ciphertext k, the comparison result M1 is a ciphertext of 0; when the position i is smaller than the ciphertext k, the comparison result M2 is a ciphertext of 1; when the position i is not smaller than the ciphertext k, the comparison result M2 is a ciphertext of 0; when the position i is larger than the ciphertext k, the comparison result M3 is a ciphertext of 1; and when the position i is not greater than the ciphertext k, the comparison result M3 is a ciphertext of 0.
Optionally, when the position j is smaller than the ciphertext k, the comparison result M4 is a ciphertext of 1; when the position j is not smaller than the ciphertext k, the comparison result M4 is a ciphertext of 0; when the position j is greater than or equal to the ciphertext k, the comparison result M5 is a ciphertext of 1; when the position j is not greater than and not equal to the ciphertext k, the comparison result M5 is a ciphertext of 0.
The embodiment of the invention also discloses a data processing method, which comprises the following steps: acquiring an array C corresponding to service data and inserting information corresponding to the array C, wherein the position of data y to be inserted in the inserting information is ciphertext s1, and the length of the array C is L1; constructing an auxiliary array D, wherein the length of the auxiliary array D is L1+1; assigning an element Dp corresponding to each position p in the auxiliary array D as follows: (whether the comparison position p is equal to the comparison result N1 of the ciphertext s1 and the data y to be inserted) + (whether the comparison position p is smaller than the comparison result N2 of the ciphertext s1 and the C [ i ])+ (whether the comparison position p is larger than the comparison result N3 of the ciphertext s1 and the C [ i-1 ]), obtaining an auxiliary array D after inserting the element y to be inserted into the position s1 in the array C of the service data; wherein N1, N2 and N3 are all ciphertext of 0 or 1, L1 is a positive integer, p is an integer, and the value range of p is 0-L1.
The embodiment of the invention also discloses a data processing device, which comprises: the system comprises a first service data acquisition module, a second service data acquisition module and a first service data processing module, wherein the first service data acquisition module is used for acquiring an array C corresponding to service data and inserting information corresponding to the array C, the position of data y to be inserted in the inserting information is ciphertext s1, and the length of the array C is L1; the first construction module is used for constructing an auxiliary array D, and the length of the auxiliary array D is L1+1; the business data insertion module is used for assigning the element Dp corresponding to each position p in the auxiliary array D as follows: (whether the comparison position p is equal to the comparison result N1 of the ciphertext s1 and the data y to be inserted) + (whether the comparison position p is smaller than the comparison result N2 of the ciphertext s1 and the C [ i ])+ (whether the comparison position p is larger than the comparison result N3 of the ciphertext s1 and the C [ i-1 ]), obtaining an auxiliary array D after inserting the element y to be inserted into the position s1 in the array C of the service data; wherein N1, N2 and N3 are all ciphertext of 0 or 1, L1 is a positive integer, p is an integer, and the value range of p is 0-L1.
The embodiment of the invention also discloses a data processing method, which comprises the following steps: acquiring an array E corresponding to service data and deleting information corresponding to the array E, wherein the position of data z to be deleted in the deleting information is ciphertext s2, and the length of the array E is L2; constructing an auxiliary array F, wherein the length of the auxiliary array F is L2-1; assigning the element Fq corresponding to each position q in the auxiliary array F as follows: (comparing whether the position q is smaller than the comparison result N4 xEq) of the ciphertext s2 or not (comparing whether the position q is larger than or equal to the comparison result N5 xEq+1 of the ciphertext s2 or not) to obtain an auxiliary array F after deleting the element z to be deleted in the position k in the array E of the service data; wherein N4 and N5 are both ciphertext of 0 or 1, L2 is a positive integer, q is an integer, and the value range of q is 0-L2-2.
The embodiment of the invention also discloses a data processing device, which comprises: the second service data acquisition module is used for acquiring an array E corresponding to service data and deleting information corresponding to the array E, wherein the position of data z to be deleted in the deleting information is ciphertext s2, and the length of the array E is L2; the second construction module is used for constructing an auxiliary array F, and the length of the auxiliary array F is L2-1; the service data deleting module is used for assigning the element Fq corresponding to each position q in the auxiliary array F as follows: (comparing whether the position q is smaller than the comparison result N4 xEq) of the ciphertext s2 or not (comparing whether the position q is larger than or equal to the comparison result N5 xEq+1 of the ciphertext s2 or not) to obtain an auxiliary array F after deleting the element z to be deleted in the position k in the array E of the service data; wherein N4 and N5 are both ciphertext of 0 or 1, L2 is a positive integer, q is an integer, and the value range of q is 0-L2-2.
The embodiment of the invention also discloses a readable medium, which enables the electronic device to execute the data processing method according to one or more of the embodiments of the invention when the instructions in the storage medium are executed by the processor of the electronic device.
The embodiment of the invention also discloses an electronic device, which comprises: one or more processors; and one or more readable media having instructions stored thereon that, when executed by the one or more processors, cause the electronics to perform the data processing methods as described in one or more of the embodiments of the invention.
Compared with the prior art, the embodiment of the invention has the following advantages:
in the embodiment of the invention, the operation information of the array A to be operated with the length of n and the ciphertext k corresponding to the position of the element to be operated can be obtained; when the operation information is element insertion type operation information, a first auxiliary array B1 with a length of n+1 may be constructed, and then an element B1[ i ] corresponding to each position i in the first auxiliary array B1 is assigned as: (whether the comparison position i is equal to the comparison result M1 of the ciphertext k) + (whether the comparison position i is smaller than the comparison result M2 of the ciphertext k is equal to A [ i ])+ (whether the comparison position i is larger than the comparison result M3 of the ciphertext k is equal to A [ i-1 ]), a first auxiliary array B1 is obtained after the element x to be operated is inserted into the position k of the array A to be operated, and then the element with the ciphertext is added into the array; when the operation information is element deletion type operation information, a second auxiliary array B2 with a length of n-1 may be constructed, and then an element B2[ j ] corresponding to each position j in the second auxiliary array B2 is assigned as: (whether the comparison position j is smaller than the comparison result M4 x A [ j ])+ (whether the comparison position j is larger than or equal to the comparison result M5 x A [ j+1 ]) of the ciphertext k) to obtain a second auxiliary array B2 after deleting the element x to be operated of the position k in the array A to be operated, thereby realizing deleting the element with the position of the ciphertext from the array.
Drawings
FIG. 1 is a flow chart of steps of an embodiment of a data processing method of the present invention;
FIG. 2 is a flow chart of steps of an alternative embodiment of a data processing method of the present invention;
FIG. 3 is a flow chart of steps of yet another alternative embodiment of a data processing method of the present invention;
FIG. 4 is a block diagram of an embodiment of a data processing apparatus of the present invention;
FIG. 5 is a block diagram of an alternative embodiment of a data processing apparatus of the present invention;
FIG. 6 is a block diagram of an alternative embodiment of a data processing apparatus of the present invention;
fig. 7 schematically shows a block diagram of an electronic device for performing the method according to the invention.
Detailed Description
In order that the above-recited objects, features and advantages of the present invention will become more readily apparent, a more particular description of the invention will be rendered by reference to the appended drawings and appended detailed description.
In the embodiment of the present invention, the device for executing the data processing method may provide a multiparty secure computing service, where multiparty secure computing may be understood in an abstract manner as follows: the two parties respectively have respective private data, and under the condition of not leaking the respective private data, the result about the public function can be calculated; when the whole calculation is completed, only the calculation result is known to both sides, and both sides cannot know the corresponding data and the intermediate data in the calculation process. Wherein the common function may implement a variety of computing functions such as addition, subtraction, multiplication, division, and the like; and at least one of the private data of the two parties is ciphertext, so that the calculation between the ciphertext and the ciphertext can be performed, and the calculation between the ciphertext and the plaintext can be performed.
The embodiment of the invention can be applied to performing various operations based on ciphertext on the array, such as inserting elements in the array based on ciphertext, for example, inserting elements with ciphertext positions in the array; for another example, elements are deleted from the array based on ciphertext, e.g., elements that are in place of ciphertext are deleted from the array. The specific application scenario includes, but is not limited to, storing an array containing information such as user identity information and corresponding user bank account number in a database, if user information needs to be added or deleted in the current array, and for data security, the position of the user needing to be added or deleted in the array is ciphertext, and then the operation of the present invention needs to be executed.
Referring to fig. 1, a flowchart illustrating steps of an embodiment of a data processing method according to the present invention may specifically include the following steps:
102, acquiring an array A to be operated and operation information corresponding to the array A to be operated; the position of the element x to be operated in the operation information is ciphertext k, and the length of the array to be operated is n.
In the embodiment of the invention, in the process of operating the array, the array needing to be operated and the operation information corresponding to the array can be obtained, and then the array is operated according to the corresponding operation information; the operation information may include element insertion operation information for inserting an element into an array, and may also include element deletion operation information for deleting an element from the array.
When the position of the element to be operated (the element to be deleted or the element to be inserted) in the operation information is ciphertext k, it may be determined that ciphertext-based delete operation needs to be performed on the array, at this time, the array that need to perform the delete operation based on the ciphertext may be referred to as the array to be operated, and then ciphertext-based delete operation is performed on the array to be operated according to the corresponding operation information. The length of the array to be operated is n, wherein n is a positive integer; of course, the array a to be operated may be plaintext (which may refer to the elements in the array a to be operated as plaintext) or ciphertext (which may refer to the elements in the array a to be operated as ciphertext), which is not limited in the embodiment of the present invention.
In the embodiment of the present invention, after obtaining the array to be operated and the operation information, the type of the operation information may be determined, if the operation information is element insertion type operation information, steps 104 to 106 may be performed, and if the operation information is element insertion type operation information, steps 108 to 110 may be performed.
Step 104, when the operation information is element insertion type operation information, a first auxiliary array B1 is constructed, and the length of the first auxiliary array B1 is n+1.
Step 106, assigning an element B1[ i ] corresponding to each position i in the first auxiliary array B1 as: (whether the comparison position i is equal to the comparison result M1 of the ciphertext k) + (whether the comparison position i is smaller than the comparison result M2 of the ciphertext k is equal to the comparison result M3 of the ciphertext k is greater than the comparison result M1 of the ciphertext k is equal to the comparison result A1), and a first auxiliary array B1 is obtained after inserting the element x at the position k of the array A to be operated.
When the position i is equal to the ciphertext k, the comparison result M1 is a ciphertext of 1; when the position i is not equal to the ciphertext k, the comparison result M1 is a ciphertext of 0; when the position i is smaller than the ciphertext k, the comparison result M2 is a ciphertext of 1; when the position i is not smaller than the ciphertext k, the comparison result M2 is a ciphertext of 0; when the position i is larger than the ciphertext k, the comparison result M3 is a ciphertext of 1; when the position i is not greater than the ciphertext k, the comparison result M3 is a ciphertext of 0. M1, M2 and M3 are all ciphertext of 0 or 1, i is an integer, and the value range of i is 0-n.
In the embodiment of the present invention, when the operation information is element insertion type operation information, a first auxiliary array B1 may be constructed, and an element a [ i ] and an element x to be operated in an array a to be operated are added to the first auxiliary array B1, so as to implement an element whose insertion position in the array to be operated is a ciphertext; the element x to be operated on may refer to the element x to be inserted. Therefore, the first auxiliary array B1 with the length of n+1 can be constructed, and the element B1[ i ] corresponding to each position i in the first auxiliary array B1 can be initialized, for example, the element B1[ i ] corresponding to each position i in the first auxiliary array B1 can be initialized to be a default value, such as 0; the embodiments of the present invention are not limited in this regard. For example, if the length of the array a to be operated is n, a first auxiliary array B1 with a length of n+1 may be constructed, and the element of each position i in B1 may be initialized to 0; for example, the following code implementation is adopted: b1 Zeros (len (a)).
In the embodiment of the invention, after an element is inserted into an array, the position corresponding to the element before the insertion position corresponding to the element in the array is kept unchanged, and the position corresponding to the element after the insertion position corresponding to the element is changed; therefore, whether each position i in the first auxiliary array B1 is equal to the ciphertext k, is smaller than the ciphertext k, and is larger than the ciphertext k can be judged, and each element in the array to be operated and each element to be inserted can be accurately added to each position i of the first auxiliary array B1. Therefore, in the embodiment of the present invention, for each position i in the first auxiliary array B1, the position i may be compared with the ciphertext k, for example, whether the position i is smaller than the ciphertext k may be compared, and for example, whether the position i is equal to the ciphertext k may be compared, etc., which is not limited in the embodiment of the present invention; and then assigning a value to the element B1[ i ] corresponding to the position i in the first auxiliary array B1 according to the comparison result of the position i and the ciphertext k.
Wherein, for the element B1[ i ] corresponding to each position i in the first auxiliary array B1, the element B1[ i ] corresponding to the position i may be assigned as: (whether the comparison position i is equal to the comparison result M1 of the ciphertext k) + (whether the comparison position i is smaller than the comparison result M2 of the ciphertext k is equal to the comparison result M3 of the ciphertext k is greater than the comparison result M1 of the ciphertext k is equal to the comparison result A1), and a first auxiliary array B1 is obtained after inserting the element x into the position k of the array A to be operated.
When the position i is equal to the ciphertext k, the position i is characterized as an insertion position corresponding to the element to be inserted, and the corresponding position i is not smaller than the ciphertext k and not larger than the ciphertext k, so that an element B1[ i ] corresponding to the position i in B1 is the element x to be inserted; at this time, the comparison result M1 is a ciphertext of 1, the comparison result M2 is a ciphertext of 0, and the comparison result M3 is a ciphertext of 0, and then the comparison result M1 is a ciphertext of the element x to be operated=the element x to be operated, the comparison result M2 is a [ i ] =0, and the comparison result M3 is a [ i-1] =0, and then B1[ i ] =the element x to be operated.
When the position i is smaller than the ciphertext k, representing that the position i corresponds to the position before the insertion position corresponding to the element to be inserted, wherein the position i is not equal to the ciphertext k and is not greater than the ciphertext k; therefore, the element B1[ i ] corresponding to the position i in B1 is the element a [ i ] corresponding to the position i in a, at this time, the comparison result M1 is a ciphertext of 0, the comparison result M2 is a ciphertext of 1, the comparison result M3 is a ciphertext of 0, the comparison result M1 is a ciphertext of the element x=0 to be operated, the comparison result M2 is a [ i ] =a [ i ], the comparison result M3 is a [ i-1] =0, and B [ i ] =a [ i ].
When the position i is larger than the ciphertext k, representing that the position i is not equal to the ciphertext k and is not smaller than the ciphertext k after the position i is inserted at the position corresponding to the element to be inserted; since the element B1 i corresponding to the position i in a [ i ], B1 is inserted and is the element a [ i-1] corresponding to the position (i-1) in a, at this time, the comparison result M1 is the ciphertext of 0, the comparison result M2 is the ciphertext of 0, the comparison result M3 is the ciphertext of 1, the comparison result M1 is the ciphertext of the element x=0 to be operated, the comparison result M2 is the ciphertext of a [ i ] =0, and the comparison result M3 is the ciphertext of a [ i-1] =a [ i-1], B [ i ] =a [ i-1].
And adding the corresponding element and the element to be inserted in the array to be operated at each position i in the first auxiliary array B1, wherein the obtained assigned B1 is the array obtained by inserting the element to be inserted in the array to be operated A.
It should be noted that, the comparison operation based on the ciphertext is implemented by the scheme of the present invention, and the comparison operation method based on the ciphertext can refer to the implementation scheme introduced in the application number 201910252632.X of the applicant, and is not described herein.
In one example of the present invention, the step 106 may be implemented by the following code:
for i in range(len(B1)):
B1[i]=(i==k)*x+(i<k)*A[i]+(i>k)*A[i-1]
wherein A is an array to be operated, B1 is a first auxiliary array, x is an element to be inserted, and k is a position (ciphertext) to be inserted.
Of course, in the embodiment of the present invention, step 106 may also be implemented by using other codes, which is not limited in the embodiment of the present invention.
In one example of the present invention, for example, a= [1',2',3',4',5',6' ], the element to be inserted x=10 ', and the corresponding insertion position is ciphertext k (e.g., ciphertext corresponding to 2), where, in this example and the following examples, x' represents ciphertext corresponding to a numerical value. Then, a first auxiliary array B1 with a length of 7 may be constructed, and the element corresponding to each position i in the array B1 is initialized to 0, so as to obtain b1= [0, 0], where the value range of i is 0-6. Then, each element in the B1 is assigned, and an element B1[ i ] corresponding to each position i in the first auxiliary array B1 is assigned as: (whether the comparison position i is equal to the comparison result M1 of the ciphertext k) + (whether the comparison position i is smaller than the comparison result M2 of the ciphertext k, ai ]) + (whether the comparison position i is larger than the comparison result M3 of the ciphertext k, ai-1). When i=0, B1[0] =0 ' +1' ×a0 ] =a0 ] =1 '; when i=1, f1[1] =0 '+1' ×a1 ] +0'×a0 ] =a1 ] =2'. F1[2] =1 ' +0' ×a2 ] +0' ×a1 ] =10 ' when i=2, f1[3] =0 ' ×10' +0' ×a3 ] +1' ×a2 ] =3 ' when i=3; when i=4, f1[4] =0 '×10+0' ×a4 ] +1'×a3 ] =a3 ] =4'; when i=5, f1[5] =0 '×10+0' ×a5 ] +1'×a4 ] =a4 ] =5'; when i=6, f1[6] =0 '×10+0' ×a6 ] +1'×a5 ] =a5 ] =7'. Thus, b1= [1',10',2',3',4',5',6' ] is obtained. Of course, the array a to be operated on may also be plain text, which is not limited in this embodiment of the present invention.
And 108, when the operation information is element deletion type operation information, constructing a second auxiliary array B2, wherein the length of the second auxiliary array B2 is n-1.
Step 110, assigning an element B2[ j ] corresponding to each position j in the second auxiliary array B2 as: (whether the comparison position j is smaller than the comparison result M4 x A [ j ]) + (whether the comparison position j is larger than or equal to the comparison result M5 x A [ j+1 ]) of the ciphertext k) to obtain a second auxiliary array B2 after deleting the element x to be operated of the position k in the array A to be operated.
When the position j is smaller than the ciphertext k, the comparison result M4 is a ciphertext of 1; when the position j is not smaller than the ciphertext k, the comparison result M4 is a ciphertext of 0; when the position j is greater than or equal to the ciphertext k, the comparison result M5 is a ciphertext of 1; when the position j is not greater than and not equal to the ciphertext k, the comparison result M5 is a ciphertext of 0. M4 and M5 are both ciphertext of 0 or 1, j is an integer, and the value range of j is 0-n-2.
In the embodiment of the present invention, when the operation information is element deletion type operation information, a second auxiliary array B2 may be constructed, and other elements in the array a to be operated except for the element x to be operated are added to the second auxiliary array B2, so as to implement deletion of the element whose position is ciphertext from the array a to be operated; the element x to be operated on may refer to the element x to be deleted. Therefore, a second auxiliary array B2 with a length of n-1 can be constructed, and elements B2[ j ] corresponding to each position j in the second auxiliary array B2 can be initialized, for example, the elements corresponding to each position j in the second auxiliary array can be initialized to be a default value, such as 0; the embodiments of the present invention are not limited in this regard. For example, if the length of the array a to be operated is n, a second auxiliary array B2 with length of n-1 may be constructed, and the elements of each position j in B2 may be initialized to 0; for example, the following code implementation is adopted: b2 Zeros (len (a)).
In the embodiment of the invention, after an element is deleted from an array, the position corresponding to the element before the element corresponding to the deleted position in the array is kept unchanged, and the position corresponding to the element after the element corresponding to the deleted position is changed; therefore, whether each position j in the second auxiliary array B2 is smaller than the ciphertext k and whether the position j is larger than or equal to the ciphertext k can be judged, and further accurate addition of other elements except the element to be deleted in the array to be operated to each position of the second auxiliary array can be achieved. Therefore, in the embodiment of the present invention, for a position j in the second auxiliary array B2, the position j is compared with the ciphertext k, for example, whether the position j is smaller than the ciphertext k may be compared, and whether the position j is greater than or equal to the ciphertext k may be determined, etc., which is not limited in the embodiment of the present invention; and then assigning a value to the element B2[ j ] corresponding to the position j in the second auxiliary array B2 according to the comparison result of the position j and the ciphertext k.
Wherein, for the element B2[ j ] corresponding to each position j in the second auxiliary array B2, the element B2[ j ] corresponding to the position j may be assigned as: (whether the comparison position j is smaller than the comparison result M4 x a [ j ]) + (whether the comparison position j is greater than or equal to the comparison result M5 x a [ j+1 ]) of the ciphertext k.
When the position j is smaller than the ciphertext k, the corresponding position j is not equal to or not greater than the ciphertext k, and the element is characterized before the deletion position corresponding to the element to be deleted, so that the element B2[ j ] corresponding to the position j in B2 is the element A [ j ] corresponding to the position j in A; at this time, the comparison result M4 is a ciphertext of 1, and the comparison result M5 is a ciphertext of 0; the comparison result m4×aj=1 ' ×aj=aj ], the comparison result m5×aj+1=0 ' ×aj+1=0 ', and B2×aj=aj ].
When the position j is equal to the ciphertext k, the corresponding position j is not less than the ciphertext k, and represents that the position j is a deletion position corresponding to the element to be deleted, and the element B2[ j ] corresponding to the position j in B2 is the element A [ j+1] corresponding to the position (j+1) in A, and the comparison result M5 is the ciphertext of 1, and the comparison result M4 is the ciphertext of 0. The comparison result m4_aj=0 ' _aj=0 ', the comparison result m5_aj+1 ' _aj+1 ] =aj+1 ], and b2_j=aj+1 ].
When the position j is greater than the ciphertext k, the corresponding position j is not less than the ciphertext k, and represents that the position j is deleted after the element to be deleted corresponds to the deletion position, and therefore, the element B2[ j ] corresponding to the position j in B2 is the element A [ j+1] corresponding to the position (j+1) in A, and at this time, the comparison result M5 is the ciphertext of 1, and at this time, the comparison result M4 is the ciphertext of 0. The comparison result m4_aj=0 ' _aj=0 ', the comparison result m5_aj+1 ' _aj+1 ] =aj+1 ], and b2_j=aj+1 ].
And adding elements in the corresponding array to be operated at each position j in the second auxiliary array B2, wherein the obtained assigned B2 is the array obtained by deleting the elements to be deleted in the array to be operated A.
In one example of the present invention, the step 110 may be implemented by the following code:
for j jn range(len(B2)):
B2[j]=(j<k)*A[j]+(j>=k)*A[j+1]
wherein A is an array to be operated, B2 is a second auxiliary array, and k is ciphertext of the position of the element to be deleted.
Of course, in the embodiment of the present invention, step 110 may also be implemented by using other codes, which is not limited in the embodiment of the present invention.
In one example of the present invention, for example, a= [1',2',3',4',5',3' ], the element x to be deleted is 5', and the corresponding deletion position is ciphertext k (e.g., ciphertext of 4). Then, a second auxiliary array B2 with a length of 5 may be constructed, and the element corresponding to each position j in the array B2 is initialized to 0, so as to obtain b2= [0, 0], where j e [0,4]. When j=0, B2[0] =1 ' ×a0 ] +0' ×a0 ] =1 '; when j=1, B2[1] =1 ' ×a [1] +0' ×a [2] =2 '; when j=2, b2[2] =1 ' ×a2 ] +0' ×a3 ] =3 '; when j=3, B2[3] =1 ' ×a [3] +0' ×a [4] =4 '; when j=4, we get b2[4] =0 ' ×a4 ] +1' ×a5 ] =3 '; thereby obtaining f2= [1',2',4',5',3' ]. Of course, the array a to be operated on may also be plain text, which is not limited in this embodiment of the present invention.
In summary, in the embodiment of the present invention, the operation information of the array a to be operated with the length of n and the ciphertext k corresponding to the position of the element to be operated can be obtained; when the operation information is element insertion type operation information, a first auxiliary array B1 with a length of n+1 may be constructed, and then an element B1[ i ] corresponding to each position i in the first auxiliary array B1 is assigned as: (whether the comparison position i is equal to the comparison result M1 of the ciphertext k) + (whether the comparison position i is smaller than the comparison result M2 of the ciphertext k is equal to A [ i ])+ (whether the comparison position i is larger than the comparison result M3 of the ciphertext k is equal to A [ i-1 ]), a first auxiliary array B1 is obtained after the element x to be operated is inserted into the position k of the array A to be operated, and then the element with the ciphertext is added into the array; when the operation information is element deletion type operation information, a second auxiliary array B2 with a length of n-1 may be constructed, and then an element B2[ j ] corresponding to each position j in the second auxiliary array B2 is assigned as: (whether the comparison position j is smaller than the comparison result M4 x A [ j ])+ (whether the comparison position j is larger than or equal to the comparison result M5 x A [ j+1 ]) of the ciphertext k) to obtain a second auxiliary array B2 after deleting the element x to be operated of the position k in the array A to be operated, thereby realizing deleting the element with the position of the ciphertext from the array.
The embodiment of the invention can be applied to any field needing ciphertext-based calculation, such as financial field, electronic commerce field and the like, wherein each field has corresponding service data, and one piece of service data is selected from the corresponding service data of any field and can be one or more arrays to be operated.
The following describes an example of inserting an element with a ciphertext at a position in an array to be operated in the embodiment of the present invention, where the element is applied to service data with the ciphertext at a position in the array to be operated.
Referring to fig. 2, a flowchart of the steps of an alternative embodiment of a data processing method of the present invention is shown.
Step 202, acquiring an array C corresponding to service data and insertion information corresponding to the array C, wherein the position of data y to be inserted in the insertion information is ciphertext s1, and the length of the array C is L1.
In the embodiment of the invention, the array C corresponding to the service data of which the data needs to be inserted and the insertion information corresponding to the array C can be obtained; the insertion information includes a position of the data y to be inserted, and the position is ciphertext s1. The length of the array C is L1, and L1 is a positive integer.
Step 204, constructing an auxiliary array D, where the length of the auxiliary array D is l1+1.
In the embodiment of the invention, an auxiliary array D with the length of L1+1 can be constructed, and then each element C [ p ] and the data y to be operated in the corresponding array C of the service array are added into the auxiliary array D, so that the data y to be inserted is inserted into the corresponding array C of the service data. The element dp corresponding to each position p in the auxiliary array D may be initialized, for example, the element dp corresponding to each position p in the auxiliary array D may be initialized to a default value, such as 0, which is not limited in the embodiment of the present invention; p is an integer, and the value range of p is 0-L1. Then adopting corresponding service array to each element Cp or data y to be operated in array C to assign value to each element DPP in auxiliary array D; wherein reference may be made to step 206.
Step 206, assigning an element dp corresponding to each position p in the auxiliary array D as: (whether the comparison position p is equal to the comparison result N1 of the ciphertext s 1) + (whether the comparison position p is smaller than the comparison result N2 of the ciphertext s1, C p > + (whether the comparison position p is larger than the comparison result N3 of the ciphertext s1, C p-1 ]), and obtaining an auxiliary array D after inserting the element y to be inserted into the position s1 in the array C of the service data.
Wherein, N1, N2 and N3 are all ciphertext of 0 or 1.
Step 206 in the embodiment of the present invention is similar to step 106 in the above embodiment, and will not be described again.
Further, by executing steps 202-206, insertion of the data y to be inserted into the service data corresponding array C can be achieved.
The following describes an example of deleting an element whose position is a ciphertext from an array to be operated, and applying the element to deleting service data whose position is a ciphertext from an array corresponding to the service data.
Referring to fig. 3, a flowchart of the steps of yet another alternative embodiment of a data processing method of the present invention is shown.
Step 302, acquiring an array E corresponding to service data and deletion information corresponding to the array E, wherein the position of data z to be deleted in the deletion information is ciphertext s2, and the length of the array E is L2.
In the embodiment of the invention, the array E corresponding to the service data of the data to be deleted and the deletion information corresponding to the array E can be obtained; the deletion information includes a position of the data z to be deleted, where the position is ciphertext s2. The length of the array E is L2, and L2 is a positive integer.
Step 304, an auxiliary array F is constructed, where the length of the auxiliary array F is L2-1.
In the embodiment of the invention, an auxiliary array F with the length of L2-1 can be constructed, and then, other elements C [ q ] except the data z to be operated in the corresponding array C of the service array are added into the auxiliary array F, so that the data z to be deleted is deleted from the corresponding array E of the service data. The element fq corresponding to each position q in the auxiliary array F may be initialized, for example, the element fq corresponding to each position q in the auxiliary array F may be all initialized to a default value, such as 0, which is not limited in the embodiment of the present invention; wherein q is an integer, and the value range of q is 0-L2-2. Then adopting the corresponding element Eq or the data y to be operated in the service array to assign value to each element Eq in the auxiliary array F; therein, reference may be made to step 306.
Step 306, assigning the element fq corresponding to each position q in the auxiliary array F as: (whether the comparison position q is smaller than the comparison result N4 xEq) of the ciphertext s2 or not (whether the comparison position q is larger than or equal to the comparison result N5 xEq+1 of the ciphertext s2 or not) to obtain an auxiliary array F after deleting the element z to be deleted in the position k in the array E of the service data.
Wherein, N4 and N5 are both ciphertext of 0 or 1, q is an integer, and the value range of q is 0-L2-2.
Step 306 in the embodiment of the present invention is similar to step 110 in the above embodiment, and will not be described again here.
Further, by executing steps 302 to 306, deletion of the data z to be deleted from the service data corresponding array E can be achieved.
It should be noted that, for simplicity of description, the method embodiments are shown as a series of acts, but it should be understood by those skilled in the art that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred embodiments, and that the acts are not necessarily required by the embodiments of the invention.
With reference to fig. 4, a block diagram of an embodiment of a data processing apparatus according to the present invention is shown, which may specifically include the following modules:
an operation information obtaining module 402, configured to obtain an array a to be operated and operation information corresponding to the array a to be operated, where a position of an element x to be operated in the operation information is a ciphertext k, and a length of the array a to be operated is n;
the element to be operated inserting module 404 is configured to, when the operation information is element insertion type operation information: constructing a first auxiliary array B1, wherein the length of the first auxiliary array B1 is n+1; assigning an element B1[ i ] corresponding to each position i in the first auxiliary array B1 as follows: (whether the comparison position i is equal to the comparison result M1 of the ciphertext k) + (whether the comparison position i is smaller than the comparison result M2 of the ciphertext k is equal to the comparison result M3 of the ciphertext k is greater than the comparison result M1 of the ciphertext k is equal to the comparison result A1), and a first auxiliary array B1 is obtained after inserting the element x at the position k of the array A to be operated;
The to-be-operated element deletion module 406 is configured to, when the operation information is element deletion type operation information: constructing a second auxiliary array B2, wherein the length of the second auxiliary array B2 is n-1; assigning an element B2[ j ] corresponding to each position j in the second auxiliary array B2 as follows: (whether the comparison position j is smaller than the comparison result M4 of the ciphertext k is equal to or larger than the comparison result M5 of the ciphertext k is equal to or larger than the comparison result M1 of the ciphertext k is equal to or smaller than the comparison result M4 of the ciphertext k), and a second auxiliary array B2 is obtained after deleting the element x to be operated of the position k in the array A to be operated; wherein M1, M2, M3, M4 and M5 are all ciphertext of 0 or 1, n is a positive integer, i and j are integers, the value range of i is 0-n, and the value range of j is 0-n-2.
In an alternative embodiment of the present invention, when the position i is equal to the ciphertext k, the comparison result M1 is a ciphertext of 1; when the position i is not equal to the ciphertext k, the comparison result M1 is a ciphertext of 0; when the position i is smaller than the ciphertext k, the comparison result M2 is a ciphertext of 1; when the position i is not smaller than the ciphertext k, the comparison result M2 is a ciphertext of 0; when the position i is larger than the ciphertext k, the comparison result M3 is a ciphertext of 1; and when the position i is not greater than the ciphertext k, the comparison result M3 is a ciphertext of 0.
In an alternative embodiment of the present invention, when the position j is smaller than the ciphertext k, the comparison result M4 is a ciphertext of 1; when the position j is not smaller than the ciphertext k, the comparison result M4 is a ciphertext of 0; when the position j is greater than or equal to the ciphertext k, the comparison result M5 is a ciphertext of 1; when the position j is not greater than and not equal to the ciphertext k, the comparison result M5 is a ciphertext of 0.
In summary, in the embodiment of the present invention, the operation information of the array a to be operated with the length of n and the ciphertext k corresponding to the position of the element to be operated can be obtained; when the operation information is element insertion type operation information, a first auxiliary array B1 with a length of n+1 may be constructed, and then an element B1[ i ] corresponding to each position i in the first auxiliary array B1 is assigned as: (whether the comparison position i is equal to the comparison result M1 of the ciphertext k) + (whether the comparison position i is smaller than the comparison result M2 of the ciphertext k is equal to A [ i ])+ (whether the comparison position i is larger than the comparison result M3 of the ciphertext k is equal to A [ i-1 ]), a first auxiliary array B1 is obtained after the element x to be operated is inserted into the position k of the array A to be operated, and then the element with the ciphertext is added into the array; when the operation information is element deletion type operation information, a second auxiliary array B2 with a length of n-1 may be constructed, and then an element B2[ j ] corresponding to each position j in the second auxiliary array B2 is assigned as: (whether the comparison position j is smaller than the comparison result M4 x A [ j ])+ (whether the comparison position j is larger than or equal to the comparison result M5 x A [ j+1 ]) of the ciphertext k) to obtain a second auxiliary array B2 after deleting the element x to be operated of the position k in the array A to be operated, thereby realizing deleting the element with the position of the ciphertext from the array.
With reference to FIG. 5, a block diagram of an alternative embodiment of a data processing apparatus of the present invention is shown, which may include the following modules in particular:
a first service data obtaining module 502, configured to obtain an array C corresponding to service data and insertion information corresponding to the array C, where a position of data y to be inserted in the insertion information is ciphertext s1, and a length of the array C is L1;
a first construction module 504, configured to construct an auxiliary array D, where the length of the auxiliary array D is l1+1;
the service data insertion module 506 is configured to assign an element dp corresponding to each position p in the auxiliary array D as: (whether the comparison position p is equal to the comparison result N1 of the ciphertext s1 and the data y to be inserted) + (whether the comparison position p is smaller than the comparison result N2 of the ciphertext s1 and the C [ i ])+ (whether the comparison position p is larger than the comparison result N3 of the ciphertext s1 and the C [ i-1 ]), obtaining an auxiliary array D after inserting the element y to be inserted into the position s1 in the array C of the service data;
wherein N1, N2 and N3 are all ciphertext of 0 or 1, L1 is a positive integer, p is an integer, and the value range of p is 0-L1.
Referring to FIG. 6, there is shown a block diagram of yet another alternative embodiment of a data processing apparatus of the present invention, which may include the following modules in particular:
A second service data obtaining module 602, configured to obtain an array E corresponding to service data and deletion information corresponding to the array E, where a position of data z to be deleted in the deletion information is ciphertext s2, and a length of the array E is L2;
a second construction module 604, configured to construct an auxiliary array F, where the length of the auxiliary array F is L2-1;
the service data deleting module 606 is configured to assign an element fq corresponding to each position q in the auxiliary array F as: (comparing whether the position q is smaller than the comparison result N4 xEq) of the ciphertext s2 or not (comparing whether the position q is larger than or equal to the comparison result N5 xEq+1 of the ciphertext s2 or not) to obtain an auxiliary array F after deleting the element z to be deleted in the position k in the array E of the service data;
wherein N4 and N5 are both ciphertext of 0 or 1, L2 is a positive integer, q is an integer, and the value range of q is 0-L2-2.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
It will be apparent to those skilled in the art that embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the invention may take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The embodiment of the invention also provides electronic equipment, which comprises: one or more processors; and one or more machine readable media having instructions stored thereon, which when executed by the one or more processors, cause the terminal device to perform the data processing method according to one or more of the embodiments of the present invention.
One or more readable media having instructions stored thereon that, when executed by one or more processors, cause a terminal device to perform a data processing method as described in one or more of the embodiments of the invention are also provided.
In an example of an embodiment of the present invention, an electronic device, such as a server, fig. 7 shows that a server according to the present invention, such as a management server, a storage server, an application server, a cloud control service, a server cluster, etc., may be implemented. The server conventionally comprises a processor 710 and a computer program product or computer readable medium in the form of a memory 720. The memory 720 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. Memory 720 has storage space 730 for program code 731 for performing any of the method steps described above. For example, the memory space 730 for program code may include individual program code 731 for implementing the various steps in the above methods, respectively. The program code can be read from or written to one or more computer program products. These computer program products comprise a program code carrier such as a hard disk, a Compact Disc (CD), a memory card or a floppy disk. Such computer program products are typically portable or fixed storage units. The storage unit may have a memory segment, a memory space, or the like arranged similarly to the memory 720 in the server of fig. 7. The program code may be compressed, for example, in a suitable form. Typically, the storage unit comprises computer readable code, i.e. code that can be read by a processor, such as 710, for example, which when executed by a server causes the server to perform the steps in the method described above.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or terminal device comprising the element.
The foregoing has described in detail a data processing method, a data processing apparatus and an electronic device according to the present invention, and specific examples have been applied to illustrate the principles and embodiments of the present invention, and the above examples are only used to help understand the method and core idea of the present invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.

Claims (12)

1. A method of data processing, comprising:
acquiring an array A to be operated and operation information corresponding to the array A to be operated, wherein the position of an element x to be operated in the operation information is ciphertext k, and the length of the array A to be operated is n;
when the operation information is element insertion type operation information:
constructing a first auxiliary array B1, wherein the length of the first auxiliary array B1 is n+1;
assigning an element B1[ i ] corresponding to each position i in the first auxiliary array B1 as follows: (whether the comparison position i is equal to the comparison result M1 of the ciphertext k) + (whether the comparison position i is smaller than the comparison result M2 of the ciphertext k is equal to the comparison result M3 of the ciphertext k is greater than the comparison result M1 of the ciphertext k is equal to the comparison result A1), and a first auxiliary array B1 is obtained after inserting the element x at the position k of the array A to be operated;
When the operation information is element deletion type operation information:
constructing a second auxiliary array B2, wherein the length of the second auxiliary array B2 is n-1;
assigning an element B2[ j ] corresponding to each position j in the second auxiliary array B2 as follows: (whether the comparison position j is smaller than the comparison result M4 of the ciphertext k is equal to or larger than the comparison result M5 of the ciphertext k is equal to or larger than the comparison result M1 of the ciphertext k is equal to or smaller than the comparison result M4 of the ciphertext k), and a second auxiliary array B2 is obtained after deleting the element x to be operated of the position k in the array A to be operated;
wherein M1, M2, M3, M4 and M5 are all ciphertext of 0 or 1, n is a positive integer, i and j are integers, the value range of i is 0-n, and the value range of j is 0-n-2.
2. The method of claim 1, wherein the step of determining the position of the substrate comprises,
when the position i is equal to the ciphertext k, the comparison result M1 is a ciphertext of 1; when the position i is not equal to the ciphertext k, the comparison result M1 is a ciphertext of 0;
when the position i is smaller than the ciphertext k, the comparison result M2 is a ciphertext of 1; when the position i is not smaller than the ciphertext k, the comparison result M2 is a ciphertext of 0;
when the position i is larger than the ciphertext k, the comparison result M3 is a ciphertext of 1; and when the position i is not greater than the ciphertext k, the comparison result M3 is a ciphertext of 0.
3. The method of claim 1, wherein the step of determining the position of the substrate comprises,
when the position j is smaller than the ciphertext k, the comparison result M4 is a ciphertext of 1; when the position j is not smaller than the ciphertext k, the comparison result M4 is a ciphertext of 0;
when the position j is greater than or equal to the ciphertext k, the comparison result M5 is a ciphertext of 1; when the position j is not greater than and not equal to the ciphertext k, the comparison result M5 is a ciphertext of 0.
4. A method of data processing, comprising:
acquiring an array C corresponding to service data and inserting information corresponding to the array C, wherein the position of data y to be inserted in the inserting information is ciphertext s1, and the length of the array C is L1;
constructing an auxiliary array D, wherein the length of the auxiliary array D is L1+1;
assigning an element Dp corresponding to each position p in the auxiliary array D as follows: (whether the comparison position p is equal to the comparison result N1 of the ciphertext s1 and the data y to be inserted) + (whether the comparison position p is smaller than the comparison result N2 of the ciphertext s1 and the C [ i ])+ (whether the comparison position p is larger than the comparison result N3 of the ciphertext s1 and the C [ i-1 ]), obtaining an auxiliary array D after inserting the element y to be inserted into the position s1 in the array C of the service data;
Wherein N1, N2 and N3 are all ciphertext of 0 or 1, L1 is a positive integer, p is an integer, and the value range of p is 0-L1.
5. A method of data processing, comprising:
acquiring an array E corresponding to service data and deleting information corresponding to the array E, wherein the position of data z to be deleted in the deleting information is ciphertext s2, and the length of the array E is L2;
constructing an auxiliary array F, wherein the length of the auxiliary array F is L2-1;
assigning the element Fq corresponding to each position q in the auxiliary array F as follows: (comparing whether the position q is smaller than the comparison result N4 xEq) of the ciphertext s2 or not (comparing whether the position q is larger than or equal to the comparison result N5 xEq+1 of the ciphertext s2 or not) to obtain an auxiliary array F after deleting the element z to be deleted in the position k in the array E of the service data;
wherein N4 and N5 are both ciphertext of 0 or 1, L2 is a positive integer, q is an integer, and the value range of q is 0-L2-2.
6. A data processing apparatus, comprising:
the operation information acquisition module is used for acquiring an array A to be operated and operation information corresponding to the array A to be operated, wherein the position of an element x to be operated in the operation information is ciphertext k, and the length of the array A to be operated is n;
The element to be operated inserting module is used for inserting the class operation information when the operation information is the element: constructing a first auxiliary array B1, wherein the length of the first auxiliary array B1 is n+1; assigning an element B1[ i ] corresponding to each position i in the first auxiliary array B1 as follows: (whether the comparison position i is equal to the comparison result M1 of the ciphertext k) + (whether the comparison position i is smaller than the comparison result M2 of the ciphertext k is equal to the comparison result M3 of the ciphertext k is greater than the comparison result M1 of the ciphertext k is equal to the comparison result A1), and a first auxiliary array B1 is obtained after inserting the element x at the position k of the array A to be operated;
the to-be-operated element deleting module is used for when the operation information is element deleting operation information: constructing a second auxiliary array B2, wherein the length of the second auxiliary array B2 is n-1; assigning an element B2[ j ] corresponding to each position j in the second auxiliary array B2 as follows: (whether the comparison position j is smaller than the comparison result M4 of the ciphertext k is equal to or larger than the comparison result M5 of the ciphertext k is equal to or larger than the comparison result M1 of the ciphertext k is equal to or smaller than the comparison result M4 of the ciphertext k), and a second auxiliary array B2 is obtained after deleting the element x to be operated of the position k in the array A to be operated;
wherein M1, M2, M3, M4 and M5 are all ciphertext of 0 or 1, n is a positive integer, i and j are integers, the value range of i is 0-n, and the value range of j is 0-n-2.
7. The apparatus of claim 6, wherein the comparison result M1 is a ciphertext of 1 when the position i is equal to the ciphertext k; when the position i is not equal to the ciphertext k, the comparison result M1 is a ciphertext of 0; when the position i is smaller than the ciphertext k, the comparison result M2 is a ciphertext of 1; when the position i is not smaller than the ciphertext k, the comparison result M2 is a ciphertext of 0; when the position i is larger than the ciphertext k, the comparison result M3 is a ciphertext of 1; and when the position i is not greater than the ciphertext k, the comparison result M3 is a ciphertext of 0.
8. The apparatus of claim 6, wherein the comparison result M4 is a ciphertext of 1 when the position j is less than the ciphertext k; when the position j is not smaller than the ciphertext k, the comparison result M4 is a ciphertext of 0; when the position j is greater than or equal to the ciphertext k, the comparison result M5 is a ciphertext of 1; when the position j is not greater than and not equal to the ciphertext k, the comparison result M5 is a ciphertext of 0.
9. A data processing apparatus, comprising:
the system comprises a first service data acquisition module, a second service data acquisition module and a first service data processing module, wherein the first service data acquisition module is used for acquiring an array C corresponding to service data and inserting information corresponding to the array C, the position of data y to be inserted in the inserting information is ciphertext s1, and the length of the array C is L1;
The first construction module is used for constructing an auxiliary array D, and the length of the auxiliary array D is L1+1;
the business data insertion module is used for assigning the element Dp corresponding to each position p in the auxiliary array D as follows: (whether the comparison position p is equal to the comparison result N1 of the ciphertext s1 and the data y to be inserted) + (whether the comparison position p is smaller than the comparison result N2 of the ciphertext s1 and the C [ i ])+ (whether the comparison position p is larger than the comparison result N3 of the ciphertext s1 and the C [ i-1 ]), obtaining an auxiliary array D after inserting the element y to be inserted into the position s1 in the array C of the service data;
wherein N1, N2 and N3 are all ciphertext of 0 or 1, L1 is a positive integer, p is an integer, and the value range of p is 0-L1.
10. A data processing apparatus, comprising:
the second service data acquisition module is used for acquiring an array E corresponding to service data and deleting information corresponding to the array E, wherein the position of data z to be deleted in the deleting information is ciphertext s2, and the length of the array E is L2;
the second construction module is used for constructing an auxiliary array F, and the length of the auxiliary array F is L2-1;
the service data deleting module is used for assigning the element Fq corresponding to each position q in the auxiliary array F as follows: (comparing whether the position q is smaller than the comparison result N4 xEq) of the ciphertext s2 or not (comparing whether the position q is larger than or equal to the comparison result N5 xEq+1 of the ciphertext s2 or not) to obtain an auxiliary array F after deleting the element z to be deleted in the position k in the array E of the service data;
Wherein N4 and N5 are both ciphertext of 0 or 1, L2 is a positive integer, q is an integer, and the value range of q is 0-L2-2.
11. A readable medium, characterized in that instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the data processing method according to one or more of the method claims 1-5.
12. An electronic device, comprising:
one or more processors; and
one or more readable media having instructions stored thereon, which when executed by the one or more processors, cause the electronics to perform the data processing method of one or more of claims 1-5.
CN201910483051.7A 2019-06-04 2019-06-04 Data processing method and device and electronic equipment Active CN112035850B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910483051.7A CN112035850B (en) 2019-06-04 2019-06-04 Data processing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910483051.7A CN112035850B (en) 2019-06-04 2019-06-04 Data processing method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN112035850A CN112035850A (en) 2020-12-04
CN112035850B true CN112035850B (en) 2023-06-23

Family

ID=73576267

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910483051.7A Active CN112035850B (en) 2019-06-04 2019-06-04 Data processing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN112035850B (en)

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013050613A1 (en) * 2011-10-06 2013-04-11 The Provost, Fellows, Foundation Scholars, And The Other Members Of Board, Of The College Of The Holy And Undivided Trinity Of Queen Elizabeth, Near Dublin System and apparatus for securely storing data
US10009169B2 (en) * 2014-12-02 2018-06-26 Zettaset, Inc. Format-preserving cipher
US9979537B2 (en) * 2014-12-02 2018-05-22 Zettaset, Inc. Format-preserving cipher
US10360390B2 (en) * 2016-12-14 2019-07-23 Sap Se Oblivious order-preserving encryption

Also Published As

Publication number Publication date
CN112035850A (en) 2020-12-04

Similar Documents

Publication Publication Date Title
WO2018228973A1 (en) Improved hardware security module management
CN112204557A (en) System and method for automated decentralized multilateral transaction processing
CN110022315A (en) Weight management method, device and equipment in a kind of piece of chain type account book
JP2023133560A (en) Computer-implemented voting process and system
CN114818000A (en) Privacy protection set confusion intersection method, system and related equipment
CN109146444B (en) Virtual account creating method and device and account information updating method and device
CN109785145B (en) Fixed-point drugstore financing method based on block chain, storage medium and computer equipment
CN110995438A (en) Non-interactive zero-knowledge proof method, system and storage medium
US7685211B2 (en) Deterministic file content generation of seed-based files
CN112035850B (en) Data processing method and device and electronic equipment
CN112182108A (en) Block chain based distributed data storage updating method and electronic equipment
CN111047444A (en) Data transaction method and device based on block chain network
Gayoso Martínez et al. Secure elliptic curves and their performance
CN111383008B (en) Block chain transfer method and device based on account model
CN112465498A (en) Data processing method and device for application blockchain enterprise wallet
CN111949738A (en) Block chain-based data storage deduplication method, terminal device and storage medium
CN112182593A (en) Data processing method and device and electronic equipment
CN111444044A (en) Method for data redundancy backup check, electronic device and computer storage medium
CN112035849B (en) Data processing method and device and electronic equipment
CN117349261A (en) Data storage method and system based on data playback
CN112395624B (en) Data processing method and device and electronic equipment
CN111444242B (en) Method for checking data equivalence, electronic device and computer storage medium
CN114363363B (en) Data storage method, device, equipment and medium based on multiple chains
CN112115487A (en) Data processing method and device and electronic equipment
CN110912987B (en) Information processing method and related equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant