Public sample ID identification method, device, server and readable storage medium
By calculating the hash value of the sample ID and generating the key to establish a ciphertext mapping relationship table, the problem of low identification efficiency of public sample IDs in federated learning is solved, achieving efficient identification and enhancing security.
Patent Information
- Application Number
- CN202010965690.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-14
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2040-09-14
AI Technical Summary
In the federated learning process, it is difficult for existing technologies to improve the identification efficiency of public sample IDs while ensuring data security, especially due to the slow encryption and decryption speed caused by the RSA asymmetric encryption algorithm.
By calculating the hash value of the sample ID in the first and second databases, generating a key based on preset numbers and random numbers, establishing a ciphertext mapping relationship table, calculating the intersection of ciphertexts to determine the public sample ID ciphertext, and based on the mapping relationship The table determines the plain text data to achieve efficient identification of public sample IDs.
On the premise of ensuring data security, the identification efficiency of public sample IDs is improved, the security of sample IDs is enhanced, decryption operations are avoided, and the identification efficiency is significantly improved.
Smart Images

Figure CN112182598B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and in particular to a method, device, server and readable storage medium for identifying a public sample ID. Background Art
[0002] With the development of artificial intelligence, federated learning has been widely used in joint modeling because it eliminates the barriers of data silos. During the federated learning process, each participant does not need to share data, but uses local data to train the model separately, and updates the joint model parameters by exchanging encrypted model parameters to obtain a public model.
[0003] In federated learning, it is necessary to find the public user ID of each participant in an encrypted state (the public user ID is the same, but the user feature data is different) to build an initial model based on the public user data. Currently, the RSA asymmetric encryption algorithm is usually used to encrypt the data of each participant. To ensure data security, the length of the RSA key is usually long, which causes the encryption and decryption speed to be too slow, making the recognition efficiency of the public user ID low. Therefore, a public sample ID recognition method is urgently needed to improve the recognition efficiency of the public sample ID while ensuring data security. Summary of the invention
[0004] In view of the above content, it is necessary to provide a public sample ID identification method, aiming to improve the recognition efficiency of public sample ID while ensuring data security.
[0005] The public sample ID identification method provided by the present invention includes:
[0006] Parsing a public sample ID identification request issued by a user based on a client, and obtaining an identifier of a second server participating in the public sample ID identification carried in the request;
[0007] Calculate a first hash value for each first sample ID in the first database, generate a first key based on the first and second preset numbers and the first random number, use the first key to encrypt the first hash value to obtain a first ciphertext, and establish a first mapping relationship table between the first sample ID and the first ciphertext;
[0008] Obtaining a second ciphertext from a second database based on the identifier of the second server, where the second ciphertext is obtained by encrypting a second hash value of the second sample ID by the second server using a second key, where the second key is generated by the second server based on a second random number;
[0009] A first intersection of the first ciphertext and the second ciphertext is calculated to obtain a public sample ID ciphertext, and plaintext data corresponding to the public sample ID ciphertext is determined based on the first mapping relationship table.
[0010] Optionally, generating the first key based on the first and second preset numbers and the first random number includes:
[0011] Generate first and second preset numbers and a first random number, generate a third key based on the first and second preset numbers and the first random number, and send the first and second preset numbers and the third key to the second server;
[0012] Obtain a fourth key generated by the second server based on the first and second preset numbers and the second random number, and generate the first key based on the first preset number and the fourth key.
[0013] Optionally, the calculation formula of the third key is:
[0014] K1=q a modp
[0015] The calculation formula of the fourth key is:
[0016] K2=q b modp
[0017] The calculation formula of the first key is:
[0018] K3=K2 a modp
[0019] Among them, p is a first preset number, q is a second preset number, a is a first random number, b is a second random number, K1 is a third key, K2 is a fourth key, and K3 is a first key.
[0020] Optionally, the calculation formula of the second key is:
[0021] K4=K1 b modp
[0022] Among them, p is the first preset number, K1 is the third key, b is the second random number, and K4 is the second key.
[0023] Optionally, after obtaining the public sample ID ciphertext, the method further includes:
[0024] Constructing a second mapping relationship table between preset characters and the public sample ID ciphertext;
[0025] After determining the plaintext data corresponding to the public sample ID ciphertext based on the first mapping relationship table, the method further includes:
[0026] Based on the second mapping relationship table and the plaintext data corresponding to the ciphertext of the public sample ID, the preset identifier is used to replace each public sample ID in the first database;
[0027] The second mapping relationship table and the public sample ID ciphertext are sent to the second server, so that the second server can convert each public sample ID in the second database into the preset character.
[0028] Optionally, the method further includes:
[0029] If there are multiple second servers participating in the public sample ID identification, the third ciphertext corresponding to the third hash value of each third sample ID corresponding to each second server is obtained respectively, and the second intersection of the first ciphertext and each third ciphertext is calculated respectively, and then the intersection of each second intersection is calculated to obtain the target public sample ID ciphertext, and the plaintext data corresponding to the target public sample ID ciphertext is determined based on the first mapping relationship table.
[0030] In order to solve the above problem, the present invention further provides a public sample ID identification device, the device comprising:
[0031] A parsing module, used to parse the public sample ID identification request issued by the user based on the client, and obtain the identifier of the second server participating in the public sample ID identification carried in the request;
[0032] An encryption module, used to calculate a first hash value for each first sample ID in the first database, generate a first key based on the first and second preset numbers and a first random number, encrypt the first hash value using the first key to obtain a first ciphertext, and establish a first mapping relationship table between the first sample ID and the first ciphertext;
[0033] an acquisition module, configured to acquire a second ciphertext from a second database based on an identifier of the second server, where the second ciphertext is obtained by encrypting a second hash value of a second sample ID by the second server using a second key, where the second key is generated by the second server based on a second random number;
[0034] A determination module is used to calculate a first intersection of the first ciphertext and the second ciphertext to obtain a public sample ID ciphertext, and determine the plaintext data corresponding to the public sample ID ciphertext based on the first mapping relationship table.
[0035] Optionally, generating the first key based on the first and second preset numbers and the first random number includes:
[0036] Generate first and second preset numbers and a first random number, generate a third key based on the first and second preset numbers and the first random number, and send the first and second preset numbers and the third key to the second server;
[0037] Obtain a fourth key generated by the second server based on the first and second preset numbers and the second random number, and generate the first key based on the first preset number and the fourth key.
[0038] In order to solve the above problem, the present invention further provides a server, the server comprising:
[0039] at least one processor; and,
[0040] a memory communicatively connected to the at least one processor; wherein,
[0041] The memory stores a public sample ID identification program executable by the at least one processor, and the public sample ID identification program is executed by the at least one processor so that the at least one processor can execute the above-mentioned public sample ID identification method.
[0042] In order to solve the above problem, the present invention also provides a computer-readable storage medium, on which a public sample ID identification program is stored. The public sample ID identification program can be executed by one or more processors to implement the above public sample ID identification method.
[0043] Compared with the prior art, the present invention first calculates the first hash value of each first sample ID in the first database, generates a first key based on the first and second preset numbers and the first random number, encrypts the first hash value with the first key to obtain the first ciphertext, and establishes a first mapping relationship table between the first sample ID and the first ciphertext; then, obtains the second ciphertext from the second database, the second ciphertext is obtained by encrypting the second hash value of the second sample ID by the second server with the second key, and the second key is generated by the second server based on the second random number. The present invention obtains the first and second hash values by performing hash operations on each first and second sample ID, thereby realizing the mapping of the first and second ciphertexts. The re-encoding of the sample ID increases the security of the first and second sample IDs. At the same time, the first server generates a first key based on the first random number, and the second server generates a second key based on the second random number, so that the first and second ciphertexts encrypted by the first and second keys are more secure; finally, the first intersection of the first ciphertext and the second ciphertext is calculated to obtain the public sample ID ciphertext, and the plaintext data corresponding to the public sample ID ciphertext is determined based on the first mapping relationship table. This step can determine the plaintext data corresponding to the public sample ID ciphertext only according to the first mapping relationship table without any decryption operation, so that the recognition efficiency of the public sample ID is higher. Therefore, the present invention improves the recognition efficiency of the public sample ID while ensuring data security. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1A schematic diagram of a process flow of a public sample ID identification method provided by an embodiment of the present invention;
[0045] Figure 2 A schematic diagram of a module of a public sample ID identification device provided by an embodiment of the present invention;
[0046] Figure 3 A schematic diagram of the structure of a server for implementing a method for identifying a public sample ID provided by an embodiment of the present invention;
[0047] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0049] It should be noted that the descriptions of "first", "second", etc. in the present invention are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0050] The present invention provides a method for identifying a public sample ID. Figure 1 , which is a flow chart of a method for identifying a public sample ID provided by an embodiment of the present invention.
[0051] In this embodiment, the public sample ID identification method is applied to the first server, and the public sample ID identification method includes:
[0052] S1. Parse a public sample ID identification request sent by a user based on a client, and obtain an identifier of a second server participating in the public sample ID identification carried in the request.
[0053] In this embodiment, the public sample ID is the user ID, which can be the user's ID number or the user's mobile phone number. Assume that the first server belongs to bank A and stores the user's account opening information, income and expenditure information at bank A, and the second server belongs to e-commerce B and stores the user's shopping information on e-commerce B's shopping platform. Find the public user IDs of both parties, and realize joint modeling of bank A and e-commerce B based on the feature data of different dimensions of the public users.
[0054] The identifier of the second server may be an IP address of the second server or a MAC address of the second server.
[0055] S2. Calculate the first hash value of each first sample ID in the first database, generate a first key based on the first and second preset numbers and the first random number, use the first key to encrypt the first hash value to obtain a first ciphertext, and establish a first mapping relationship table between the first sample ID and the first ciphertext.
[0056] The first database is a database in the first server. The first server only processes local data and performs hash operations on each first sample ID in the first database, thereby re-encoding each first sample ID and increasing the security of the first sample ID.
[0057] The calculation formula of the hash function is:
[0058] y i =ax i +b
[0059] Among them, x i is the key value of the first sample ID of the first database, a and b are constants, and y i is the first hash value of the i-th first sample ID in the first database.
[0060] In this embodiment, generating the first key based on the first and second preset numbers and the first random number includes:
[0061] A1. Generate first and second preset numbers and a first random number, generate a third key based on the first and second preset numbers and the first random number, and send the first and second preset numbers and the third key to the second server;
[0062] The calculation formula of the third key is:
[0063] K1=q a modp
[0064] Among them, p is a first preset number, q is a second preset number, a is a first random number, and K1 is a third key.
[0065] In this embodiment, p is a prime number, q and a are integers, p, q, and a are all randomly generated by the first server, p and q are public data and can be sent to other servers, and a is kept by the first server throughout the process and will not be sent to other servers. It is equivalent to the private key of the first server.
[0066] A2. Obtain a fourth key generated by the second server based on the first and second preset numbers and the second random number, and generate the first key based on the first preset number and the fourth key.
[0067] The calculation formula of the fourth key is:
[0068] K2=q b modp
[0069] Among them, p is a first preset number, q is a second preset number, b is a second random number, and K2 is a fourth key.
[0070] In this embodiment, b is an integer randomly generated by the second server and kept by the second server throughout the process, which is equivalent to the private key of the second server.
[0071] The calculation formula of the first key is:
[0072] K3=K2 a modp
[0073] Among them, p is the first preset number, K2 is the fourth key, a is the first random number, and K3 is the first key.
[0074] S3. Obtain a second ciphertext from the second database based on the identifier of the second server, where the second ciphertext is obtained by encrypting a second hash value of the second sample ID by the second server using a second key, where the second key is generated by the second server based on a second random number.
[0075] The second database is a local database of the second server, and a method for calculating a second hash value of each second sample ID in the second database is the same as a method for calculating the first hash value.
[0076] The second key is generated based on the first preset number, the second random number and the third key, and the calculation formula of the second key is:
[0077] K4=K1 b modp
[0078] Among them, p is the first preset number, K1 is the third key, b is the second random number, and K4 is the second key.
[0079] According to the modulo operation rules, we can get:
[0080] K4=K1b modp=(q a modp) b modp=(q a ) b modp
[0081] K3=K2 a modp=(q b modp) a modp=(q b ) a modp
[0082] It can be seen from this that K3=K4, that is, under the premise that the first server does not expose the private key a and the second server does not expose the private key b, the present invention achieves that the first key generated by the first server is the same as the second key generated by the second server, so that the first ciphertext encrypted by the first key and the second ciphertext encrypted by the second key are comparable.
[0083] S4. Calculate a first intersection of the first ciphertext and the second ciphertext to obtain a public sample ID ciphertext, and determine plaintext data corresponding to the public sample ID ciphertext based on the first mapping relationship table.
[0084] In this embodiment, the plaintext data corresponding to the ciphertext of the public sample ID can be determined according to the first mapping relationship table without performing any decryption operation, so that the recognition effect of the public sample ID is higher.
[0085] In this embodiment, after obtaining the public sample ID ciphertext, the method further includes:
[0086] Constructing a second mapping relationship table between preset characters and the public sample ID ciphertext;
[0087] After determining the plaintext data corresponding to the public sample ID ciphertext based on the first mapping relationship table, the method further includes:
[0088] B1. Based on the second mapping relationship table and the plaintext data corresponding to the ciphertext of the public sample ID, the preset identifier is used to replace each public sample ID in the first database;
[0089] B2. Send the second mapping relationship table and the public sample ID ciphertext to the second server, so that the second server can convert each public sample ID in the second database into the preset character.
[0090] In this embodiment, the preset characters can be numbers or letters. For example, in the second mapping relationship table, the number 1 corresponds to the first public sample ID, and the number 2 corresponds to the second public sample ID, then each public sample ID in the first data is replaced with the corresponding number. After the first server sends the second mapping relationship table and the public sample ID ciphertext to the second server, the second server can determine the plaintext data corresponding to the public sample ID ciphertext according to the mapping relationship table of the second sample ID and the second ciphertext without decryption, and then replace each public sample ID in the second database with the corresponding preset character according to the second mapping relationship table, thereby replacing the public user ID in the local database of the first server and the second server with the same preset character without exchanging data, further ensuring the security of the public user ID.
[0091] In another embodiment of the present invention, the method further comprises:
[0092] If there are multiple second servers participating in the public sample ID identification, the third ciphertext corresponding to the third hash value of each third sample ID corresponding to each second server is obtained respectively, and the second intersection of the first ciphertext and each third ciphertext is calculated respectively, and then the intersection of each second intersection is calculated to obtain the target public sample ID ciphertext, and the plaintext data corresponding to the target public sample ID ciphertext is determined based on the first mapping relationship table.
[0093] For example, the process of finding the public user IDs of bank A, e-commerce company B, insurance company C, and airline company D is:
[0094] Calculate the public user IDs of bank A and e-commerce B to get D A∩B ;
[0095] Calculate the public user IDs of bank A and insurance company C to get D A∩C ;
[0096] Calculate the public user IDs of bank A and airline D to get D A∩D ;
[0097] The public user IDs of bank A, e-commerce company B, insurance company C and airline company D are D A∩B ∩D A∩C ∩D A∩D .
[0098] It can be seen from the above embodiments that the public sample ID identification method proposed by the present invention is that, first, the first server calculates the first hash value of each first sample ID in the first database, generates a first key based on the first and second preset numbers and the first random number, encrypts the first hash value with the first key to obtain the first ciphertext, and establishes a first mapping relationship table between the first sample ID and the first ciphertext; then, the second ciphertext is obtained from the second database, and the second ciphertext is obtained by encrypting the second hash value of the second sample ID by the second server with the second key, and the second key is generated by the second server based on the second random number. The present invention obtains the first and second hash values by performing hash operations on each first and second sample ID. The first and second sample IDs are re-encoded based on the first random number, and the security of the first and second sample IDs is increased. At the same time, the first server generates a first key based on the first random number, and the second server generates a second key based on the second random number, so that the first and second ciphertexts encrypted by the first and second keys are more secure; finally, the first intersection of the first ciphertext and the second ciphertext is calculated to obtain the public sample ID ciphertext, and the plaintext data corresponding to the public sample ID ciphertext is determined based on the first mapping relationship table. This step can determine the plaintext data corresponding to the public sample ID ciphertext only according to the first mapping relationship table, without any decryption operation, so that the recognition efficiency of the public sample ID is higher. Therefore, the present invention improves the recognition efficiency of the public sample ID under the premise of ensuring data security.
[0099] like Figure 2 FIG. 1 is a schematic diagram of a module of a public sample ID recognition device provided by an embodiment of the present invention.
[0100] The public sample ID recognition device 100 of the present invention is installed in the first server. According to the functions to be implemented, the public sample ID recognition device 100 may include a parsing module 110, an encryption module 120, an acquisition module 130 and a determination module 140. The module of the present invention may also be referred to as a unit, which refers to a series of computer program segments that can be executed by the processor of the first server and can complete fixed functions, and is stored in the memory of the first server.
[0101] In this embodiment, the functions of each module / unit are as follows:
[0102] The parsing module 110 is configured to parse a public sample ID identification request sent by a user based on a client, and obtain an identifier of a second server participating in the public sample ID identification carried in the request.
[0103] In this embodiment, the public sample ID is the user ID, which can be the user's ID number or the user's mobile phone number. Assume that the first server belongs to bank A and stores the user's account opening information, income and expenditure information at bank A, and the second server belongs to e-commerce B and stores the user's shopping information on e-commerce B's shopping platform. Find the public user IDs of both parties, and realize joint modeling of bank A and e-commerce B based on the feature data of different dimensions of the public users.
[0104] The identifier of the second server may be an IP address of the second server or a MAC address of the second server.
[0105] The encryption module 120 is used to calculate the first hash value of each first sample ID in the first database, generate a first key based on the first and second preset numbers and the first random number, use the first key to encrypt the first hash value to obtain a first ciphertext, and establish a first mapping relationship table between the first sample ID and the first ciphertext.
[0106] The first database is a database in the first server. The first server only processes local data and performs hash operations on each first sample ID in the first database, thereby re-encoding each first sample ID and increasing the security of the first sample ID.
[0107] The calculation formula of the hash function is:
[0108] y i =ax i +b
[0109] Among them, x i is the key value of the first sample ID of the first database, a and b are constants, and y i is the first hash value of the i-th first sample ID in the first database.
[0110] In this embodiment, generating the first key based on the first and second preset numbers and the first random number includes:
[0111] A1. Generate first and second preset numbers and a first random number, generate a third key based on the first and second preset numbers and the first random number, and send the first and second preset numbers and the third key to the second server;
[0112] The calculation formula of the third key is:
[0113] K1=q a modp
[0114] Among them, p is a first preset number, q is a second preset number, a is a first random number, and K1 is a third key.
[0115] In this embodiment, p is a prime number, q and a are integers, p, q, and a are all randomly generated by the first server, p and q are public data and can be sent to other servers, and a is kept by the first server throughout the process and will not be sent to other servers. It is equivalent to the private key of the first server.
[0116] A2. Obtain a fourth key generated by the second server based on the first and second preset numbers and the second random number, and generate the first key based on the first preset number and the fourth key.
[0117] The calculation formula of the fourth key is:
[0118] K2=q b modp
[0119] Among them, p is a first preset number, q is a second preset number, b is a second random number, and K2 is a fourth key.
[0120] In this embodiment, b is an integer randomly generated by the second server and kept by the second server throughout the process, which is equivalent to the private key of the second server.
[0121] The calculation formula of the first key is:
[0122] K3=K2 a modp
[0123] Among them, p is the first preset number, K2 is the fourth key, a is the first random number, and K3 is the first key.
[0124] The acquisition module 130 is used to obtain a second ciphertext from a second database based on the identifier of the second server, where the second ciphertext is obtained by the second server encrypting a second hash value of the second sample ID using a second key, where the second key is generated by the second server based on a second random number.
[0125] The second database is a local database of the second server, and a method for calculating a second hash value of each second sample ID in the second database is the same as a method for calculating the first hash value.
[0126] The second key is generated based on the first preset number, the second random number and the third key, and the calculation formula of the second key is:
[0127] K4=K1 b modp
[0128] Among them, p is the first preset number, K1 is the third key, b is the second random number, and K4 is the second key.
[0129] According to the modulo operation rules, we can get:
[0130] K4=K1 b modp=(q a modp) b modp=(q a ) b modp
[0131] K3=K2 a modp=(q b modp) a modp=(q b ) a modp
[0132] It can be seen from this that K3=K4, that is, under the premise that the first server does not expose the private key a and the second server does not expose the private key b, the present invention achieves that the first key generated by the first server is the same as the second key generated by the second server, so that the first ciphertext encrypted by the first key and the second ciphertext encrypted by the second key are comparable.
[0133] The determination module 140 is configured to calculate a first intersection of the first ciphertext and the second ciphertext to obtain a public sample ID ciphertext, and determine plaintext data corresponding to the public sample ID ciphertext based on the first mapping relationship table.
[0134] In this embodiment, the plaintext data corresponding to the ciphertext of the public sample ID can be determined according to the first mapping relationship table without performing any decryption operation, so that the recognition effect of the public sample ID is higher.
[0135] In this embodiment, after obtaining the public sample ID ciphertext, the determination module 140 is further used to:
[0136] Constructing a second mapping relationship table between preset characters and the public sample ID ciphertext;
[0137] After determining the plaintext data corresponding to the public sample ID ciphertext based on the first mapping relationship table, the determination module 140 is further configured to:
[0138] B1. Based on the second mapping relationship table and the plaintext data corresponding to the ciphertext of the public sample ID, the preset identifier is used to replace each public sample ID in the first database;
[0139] B2. Send the second mapping relationship table and the public sample ID ciphertext to the second server, so that the second server can convert each public sample ID in the second database into the preset character.
[0140] In this embodiment, the preset characters can be numbers or letters. For example, in the second mapping relationship table, the number 1 corresponds to the first public sample ID, and the number 2 corresponds to the second public sample ID, then each public sample ID in the first data is replaced with the corresponding number. After the first server sends the second mapping relationship table and the public sample ID ciphertext to the second server, the second server can determine the plaintext data corresponding to the public sample ID ciphertext according to the mapping relationship table of the second sample ID and the second ciphertext without decryption, and then replace each public sample ID in the second database with the corresponding preset character according to the second mapping relationship table, thereby replacing the public user ID in the local database of the first server and the second server with the same preset character without exchanging data, further ensuring the security of the public user ID.
[0141] In another embodiment of the present invention, the determining module 140 is further configured to:
[0142] If there are multiple second servers participating in the public sample ID identification, the third ciphertext corresponding to the third hash value of each third sample ID corresponding to each second server is obtained respectively, and the second intersection of the first ciphertext and each third ciphertext is calculated respectively, and then the intersection of each second intersection is calculated to obtain the target public sample ID ciphertext, and the plaintext data corresponding to the target public sample ID ciphertext is determined based on the first mapping relationship table.
[0143] For example, the process of finding the public user IDs of bank A, e-commerce company B, insurance company C, and airline company D is:
[0144] Calculate the public user IDs of bank A and e-commerce B to get D A∩B ;
[0145] Calculate the public user IDs of bank A and insurance company C to get D A∩C ;
[0146] Calculate the public user IDs of bank A and airline D to get D A∩D ;
[0147] The public user IDs of bank A, e-commerce company B, insurance company C and airline company D are D A∩B ∩D A∩C ∩D A∩D .
[0148] like Figure 3 FIG. 1 is a schematic diagram of the structure of a server for implementing a method for identifying a public sample ID according to an embodiment of the present invention. In this embodiment, the server for implementing the method for identifying a public sample ID is as follows: Figure 3 The first server 1 is shown, and the first server 1 is communicatively connected with the second server.
[0149] The first server 1 is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions. The first server 1 can be a computer, a single network server, a server group consisting of multiple network servers, or a cloud based on cloud computing consisting of a large number of hosts or network servers, wherein cloud computing is a type of distributed computing, a super virtual computer composed of a group of loosely coupled computer sets.
[0150] In this embodiment, the first server 1 includes, but is not limited to, a memory 11, a processor 12, and a network interface 13 that can be interconnected and communicated via a system bus. The memory 11 stores a public sample ID identification program 10, and the public sample ID identification program 10 can be executed by the processor 12. Figure 3 Only the first server 1 having components 11-13 and a public sample ID identification program 10 is shown. It can be understood by those skilled in the art that Figure 3 The structure shown does not constitute a limitation on the first server 1, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0151] Among them, the memory 11 includes a memory and at least one type of readable storage medium. The memory provides a cache for the operation of the first server 1; the readable storage medium may be a non-volatile storage medium such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the readable storage medium may be an internal storage unit of the first server 1, such as a hard disk of the first server 1; in other embodiments, the non-volatile storage medium may also be an external storage device of the first server 1, such as a plug-in hard disk equipped on the first server 1, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. In this embodiment, the readable storage medium of the memory 11 is generally used to store an operating system and various application software installed on the first server 1, such as storing the code of the public sample ID identification program 10 in an embodiment of the present invention. In addition, the memory 11 can also be used to temporarily store various types of data that have been output or are to be output.
[0152] The processor 12 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip in some embodiments. The processor 12 is generally used to control the overall operation of the first server 1, such as performing control and processing related to data interaction or communication with other devices. In this embodiment, the processor 12 is used to run the program code stored in the memory 11 or process data, such as running the public sample ID recognition program 10.
[0153] The network interface 13 may include a wireless network interface or a wired network interface, and the network interface 13 is used to establish a communication connection between the first server 1 and a second server (not shown in the figure) or a client (not shown in the figure).
[0154] Optionally, the first server 1 may further include a user interface, which may include a display (Display), an input unit such as a keyboard (Keyboard), and the optional user interface may also include a standard wired interface and a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device, etc. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the first server 1 and to display a visual user interface.
[0155] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0156] The public sample ID recognition program 10 stored in the memory 11 in the first server 1 is a combination of multiple instructions. When running in the processor 12, it can achieve:
[0157] Parsing a public sample ID identification request issued by a user based on a client, and obtaining an identifier of a second server participating in the public sample ID identification carried in the request;
[0158] Calculate a first hash value for each first sample ID in the first database, generate a first key based on the first and second preset numbers and the first random number, use the first key to encrypt the first hash value to obtain a first ciphertext, and establish a first mapping relationship table between the first sample ID and the first ciphertext;
[0159] Obtaining a second ciphertext from a second database based on the identifier of the second server, where the second ciphertext is obtained by encrypting a second hash value of the second sample ID by the second server using a second key, where the second key is generated by the second server based on a second random number;
[0160] A first intersection of the first ciphertext and the second ciphertext is calculated to obtain a public sample ID ciphertext, and plaintext data corresponding to the public sample ID ciphertext is determined based on the first mapping relationship table.
[0161] Specifically, the specific implementation method of the processor 12 for the public sample ID recognition program 10 can refer to Figure 1 The description of the relevant steps in the corresponding embodiment is not repeated here. It should be emphasized that in order to further ensure the privacy and security of the first and second sample IDs, the first and second sample IDs can also be stored in a node of a blockchain.
[0162] Furthermore, if the module / unit integrated in the first server 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. The computer-readable medium can be non-volatile or non-volatile. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).
[0163] The computer-readable storage medium stores a public sample ID identification program 10, which can be executed by one or more processors. The specific implementation of the computer-readable storage medium of the present invention is basically the same as the above-mentioned embodiments of the public sample ID identification method, and will not be repeated here.
[0164] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0165] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0166] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0167] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0168] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0169] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0170] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The second and other words are used to indicate names, but not to indicate any particular order.
[0171] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A method for identifying a public sample ID, applied to a first server, characterized in that: The method comprises: Parsing a public sample ID identification request issued by a user based on a client, and obtaining an identifier of a second server participating in the public sample ID identification carried in the request; Calculate a first hash value for each first sample ID in the first database, generate a first key based on the first and second preset numbers and the first random number, use the first key to encrypt the first hash value to obtain a first ciphertext, and establish a first mapping relationship table between the first sample ID and the first ciphertext; Obtaining a second ciphertext from a second database based on the identifier of the second server, where the second ciphertext is obtained by encrypting a second hash value of the second sample ID by the second server using a second key, where the second key is generated by the second server based on a second random number, a first preset number, and a third key; Calculate a first intersection of the first ciphertext and the second ciphertext to obtain a public sample ID ciphertext, and determine the plaintext data corresponding to the public sample ID ciphertext based on the first mapping relationship table; The generating of the first key based on the first and second preset numbers and the first random number includes: Generate first and second preset numbers and a first random number, generate a third key based on the first and second preset numbers and the first random number, send the first and second preset numbers and the third key to the second server, obtain a fourth key generated by the second server based on the first and second preset numbers and the second random number, and generate the first key based on the first preset number and the fourth key.
2. The public sample ID identification method according to claim 1, characterized in that: The calculation formula of the third key is: K1=q a mod p The calculation formula of the fourth key is: K2=q b mod p The calculation formula of the first key is: K3=K2 a mod p Among them, p is a first preset number, q is a second preset number, a is a first random number, b is a second random number, K1 is a third key, K2 is a fourth key, and K3 is a first key.
3. The public sample ID identification method according to claim 1, characterized in that: The calculation formula of the second key is: K4=K1 b mod p Among them, p is the first preset number, K1 is the third key, b is the second random number, and K4 is the second key.
4. The public sample ID identification method according to claim 1, characterized in that: After obtaining the public sample ID ciphertext, the method further includes: Constructing a second mapping relationship table between preset characters and the public sample ID ciphertext; After determining the plaintext data corresponding to the public sample ID ciphertext based on the first mapping relationship table, the method further includes: Based on the second mapping relationship table and the plaintext data corresponding to the ciphertext of the public sample ID, the preset characters are used to replace each public sample ID in the first database; The second mapping relationship table and the public sample ID ciphertext are sent to the second server, so that the second server can convert each public sample ID in the second database into the preset character.
5. The public sample ID identification method according to claim 1, characterized in that: The method further comprises: If there are multiple second servers participating in the public sample ID identification, the third ciphertext corresponding to the third hash value of each third sample ID corresponding to each second server is obtained respectively, and the second intersection of the first ciphertext and each third ciphertext is calculated respectively, and then the intersection of each second intersection is calculated to obtain the target public sample ID ciphertext, and the plaintext data corresponding to the target public sample ID ciphertext is determined based on the first mapping relationship table.
6. A public sample ID recognition device, characterized in that: The device comprises: A parsing module, used to parse the public sample ID identification request sent by the user based on the client, and obtain the identifier of the second server participating in the public sample ID identification carried in the request; an encryption module, used to calculate a first hash value of each first sample ID in a first database, generate a first key based on a first and second preset numbers and a first random number, encrypt the first hash value with the first key to obtain a first ciphertext, and establish a first mapping relationship table between the first sample ID and the first ciphertext, wherein the generating of the first key based on the first and second preset numbers and the first random number includes: generating the first and second preset numbers and the first random number, generating a third key based on the first and second preset numbers and the first random number, sending the first and second preset numbers and the third key to the second server, obtaining a fourth key generated by the second server based on the first and second preset numbers and the second random number, and generating the first key based on the first preset number and the fourth key; an acquisition module, configured to acquire a second ciphertext from a second database based on an identifier of the second server, where the second ciphertext is obtained by encrypting a second hash value of a second sample ID by the second server using a second key, where the second key is generated by the second server based on a second random number, the first preset number, and the third key; A determination module is used to calculate a first intersection of the first ciphertext and the second ciphertext to obtain a public sample ID ciphertext, and determine the plaintext data corresponding to the public sample ID ciphertext based on the first mapping relationship table.
7. A server, characterized in that: The server comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a public sample ID recognition program executable by the at least one processor, and the public sample ID recognition program is executed by the at least one processor so that the at least one processor can perform the public sample ID recognition method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a public sample ID identification program, and the public sample ID identification program can be executed by one or more processors to implement the public sample ID identification method according to any one of claims 1 to 5.
