Privacy intersection method and system based on national secret algorithm
Through the privacy interception method based on the national secret algorithm, the data is encrypted and local feature hash processing, and a hash correlation matrix is constructed to filter the intersection data, which solves the problems of large amount of computing and data leakage in the existing technology, and achieves efficient and secure interception.
Patent Information
- Application Number
- CN202510386716.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2045-03-31
AI Technical Summary
When facing large-scale sensitive data, the existing data interchange method has a large amount of calculation and is prone to leaking the original data.
The privacy interception method based on the national secret algorithm is adopted. By quickly encrypting the data, only basic structural information is retained, local feature hash calculations are performed, hash correlation matrix is constructed, potential intersection data is filtered, and final comparison is performed to determine the intersection data.
It effectively reduces the calculation amount and data leakage risk during data interception, ensures data privacy and security, and improves the efficiency of interception operations.
Smart Images

Figure CN119885283A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a privacy intersection method and system based on a national secret algorithm. Background Art
[0002] In an era of rapid development of digital information, data has become a key factor in promoting innovation and improving efficiency in various fields. Different institutions and enterprises often need to cooperate on data to tap into more value, but this process inevitably involves the interaction of sensitive data.
[0003] On the one hand, enterprises and institutions must strictly protect user data privacy and prevent data leakage risks. On the other hand, traditional data intersection methods have many disadvantages when facing large-scale sensitive data. In the past, most common practices were to directly perform hash operations on the entire data set. This method has a large amount of calculations, especially in massive data scenarios, which consumes a lot of computing resources, resulting in low efficiency and hindering the timeliness of data interaction.
[0004] Meanwhile, in the prior art, direct comparison is usually performed when finding data intersection, which not only requires large amount of comparison calculation, but also easily leaks the original data. Summary of the invention
[0005] The main purpose of the present invention is to provide a privacy intersection method and system based on a national secret algorithm, aiming to overcome the defects of easy leakage of original data and large amount of calculation when performing data intersection.
[0006] To achieve the above purpose, the present invention provides a privacy intersection method based on a national secret algorithm, comprising the following steps: The first data set involved in the intersection is quickly encrypted based on the national secret algorithm to obtain a first encrypted data set; the second data set involved in the intersection is quickly encrypted based on the national secret algorithm to obtain a second encrypted data set; Performing local feature hash calculation on the first encrypted data set and the second encrypted data set to obtain a corresponding first hash sequence and a second hash sequence; wherein, during the local feature hash calculation, only a key data segment in each encrypted data is selected for hash calculation; Constructing a matrix, using the hash data in the first hash sequence as row elements and the hash data in the second hash sequence as column elements; calculating the similarity between the row elements and the column elements and filling them in the matrix to obtain a hash association matrix; Filtering out hash data corresponding to row and column intersection positions with similarity greater than a threshold from the hash association matrix as potential intersection data pairs; The original data corresponding to the hash data in the potential intersection data pair are compared; if they are consistent, the corresponding original data is the final intersection data.
[0007] Furthermore, during fast encryption, only the basic structural information of the original data is retained, and the metadata is removed.
[0008] Furthermore, the similarity between row elements and column elements is calculated and filled in the matrix, including: Based on the similarity evaluation algorithm, the similarities of the row elements and column elements corresponding to each row and column intersection position are calculated respectively, and the row and column intersection positions in the matrix are filled; the similarity evaluation algorithm combines the number of bit differences in the hash data on the row elements and column elements and the data size ratio to calculate the similarity between the two.
[0009] Furthermore, before performing local feature hash calculation on the first encrypted data set and the second encrypted data set, the method further includes: The encrypted data in the first encrypted data set and the second encrypted data set are respectively scattered and reorganized.
[0010] Furthermore, if they are consistent, the corresponding original data is the final intersection data, including: storing each raw data in the first data set and the second data set in a data table of a database; Based on the first data set and the second data set, generate a query code; A mapping relationship between the final intersection data and the data table is established, and a query permission code for the final intersection data is configured based on the query code.
[0011] Further, based on the first data set and the second data set, a query code is generated, including: Extracting multi-dimensional first feature information of the first data set, and generating a closed graph based on the first feature information; Extracting multi-dimensional second feature information of the second data set, and generating a two-dimensional curve based on the second feature information; Divide the data table into four sub-areas evenly, superimpose the closed graph on each of the sub-areas, and obtain the original data located at the center of the closed graph in each sub-area as the target data; Based on the characteristic information of each target data, a multi-digit number is generated; the multi-digit number is substituted into the two-dimensional curve as the horizontal coordinate to perform calculation, and the corresponding vertical coordinate value is obtained as the query code.
[0012] Further, based on the first data set and the second data set, a query code is generated, including: Adding the characters in the first data set to the matrix one by one in sequence to generate a first matrix; adding the characters in the second data set to the matrix one by one in sequence to generate a second matrix; Performing XOR calculation on characters at the same matrix position in the first matrix and the second matrix, and adding the calculation result to a new matrix to obtain an XOR matrix; the XOR matrix includes the first number and the second number; The search code is generated based on the first number in the XOR matrix.
[0013] Further, based on the first number in the XOR matrix, generating the search code comprises: Sequentially select the first number that meets the preset position condition from the XOR matrix as the target number, and sequentially connect the target numbers to form a target curve; Extracting curve feature information of multiple dimensions of the target curve, and generating the query code based on the curve feature information of multiple dimensions.
[0014] Further, based on the first number in the XOR matrix, generating the search code comprises: Extracting multiple features of the first number in the XOR matrix; the features at least include the number, row position, column position, and maximum interval number of the first number; The search code is generated based on multiple features of the first number.
[0015] The present invention also provides a privacy intersection system based on a national secret algorithm, comprising: An encryption unit, used to quickly encrypt the first data set involved in the intersection based on the national secret algorithm to obtain a first encrypted data set; and quickly encrypt the second data set involved in the intersection based on the national secret algorithm to obtain a second encrypted data set; A hash unit, used to perform local feature hash calculation on the first encrypted data set and the second encrypted data set to obtain a corresponding first hash sequence and a second hash sequence; wherein, when performing local feature hash calculation, only a key data segment in each encrypted data is selected for hash calculation; A construction unit is used to construct a matrix, using the hash data in the first hash sequence as row elements and the hash data in the second hash sequence as column elements; calculating the similarity between the row elements and the column elements and filling them in the matrix to obtain a hash association matrix; A screening unit, used to screen out hash data corresponding to row and column intersection positions with a similarity greater than a threshold from the hash association matrix as potential intersection data pairs; The intersection unit is used to compare the original data corresponding to the hash data in the potential intersection data pair; if they are consistent, the corresponding original data is the final intersection data.
[0016] The present invention also provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.
[0017] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned methods are implemented.
[0018] The privacy intersection method and system based on the national secret algorithm provided by the present invention include: quickly encrypting the first data set participating in the intersection based on the national secret algorithm to obtain a first encrypted data set; quickly encrypting the second data set participating in the intersection based on the national secret algorithm to obtain a second encrypted data set; performing local feature hash calculation on the first encrypted data set and the second encrypted data set to obtain corresponding first hash sequence and second hash sequence; wherein, when performing local feature hashing, only the key data segments in each encrypted data are selected for hash calculation; constructing a matrix with the hash data in the first hash sequence as row elements and the hash data in the second hash sequence as column elements; calculating the similarity between the row elements and the column elements and filling them in the matrix to obtain a hash association matrix; screening out the hash data corresponding to the row and column intersection positions with a similarity greater than a threshold from the hash association matrix as potential intersection data pairs; comparing the original data corresponding to the hash data in the potential intersection data pairs; if they are consistent, the corresponding original data is the final intersection data. In the present invention, the original data is encrypted and hashed before intersection calculation is performed to avoid data leakage; local feature hash calculation is used to significantly reduce the amount of calculation; and a hash association matrix is used for similarity screening to reduce the amount of calculation when finding data intersection, while also reducing the risk of data leakage. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 It is a schematic diagram of the steps of a privacy intersection method based on a national secret algorithm in one embodiment of the present invention; Figure 2 It is a structural block diagram of a privacy intersection system based on a national secret algorithm in one embodiment of the present invention; Figure 3 It is a schematic block diagram of the structure of a computer device according to an embodiment of the present invention.
[0020] The implementation, functional features and advantages of the present invention will be further described in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0021] In order to make the purpose, technical solution 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.
[0022] Reference Figure 1 In one embodiment of the present invention, a privacy intersection method based on a national secret algorithm is provided, comprising the following steps: Step S1, quickly encrypting the first data set involved in the intersection based on the national secret algorithm to obtain a first encrypted data set; quickly encrypting the second data set involved in the intersection based on the national secret algorithm to obtain a second encrypted data set; Step S2, performing local feature hash calculation on the first encrypted data set and the second encrypted data set to obtain a corresponding first hash sequence and a second hash sequence; wherein, during the local feature hash calculation, only the key data segment in each encrypted data is selected for hash calculation; Step S3, constructing a matrix, using the hash data in the first hash sequence as row elements and the hash data in the second hash sequence as column elements; calculating the similarity between the row elements and the column elements and filling them in the matrix to obtain a hash association matrix; Step S4, filtering out hash data corresponding to row and column intersection positions with similarity greater than a threshold from the hash association matrix as potential intersection data pairs; Step S5, comparing the original data corresponding to the hash data in the potential intersection data pair; if they are consistent, the corresponding original data is the final intersection data.
[0023] In this embodiment, as described in step S1 above, the national secret algorithm is a cryptographic algorithm system with high security. In this step, the national secret algorithm is used to quickly encrypt the first data set, aiming to protect the privacy and integrity of the data. Specifically, a symmetric encryption algorithm such as the national secret SM4 can be selected (other suitable national secret algorithms can also be selected according to actual needs). During the encryption process, each piece of data or data block in the first data set is encrypted by a specific key, and the original data that may contain sensitive information is converted into a ciphertext form, so that even if the data is illegally obtained during transmission or storage, the attacker cannot directly interpret the content therein, and finally obtain the first encrypted data set. This encryption process emphasizes speed while ensuring security, so that large-scale data can be processed efficiently and the time cost caused by encryption operations can be reduced.
[0024] Based on the national secret algorithm, the second data set participating in the intersection is quickly encrypted to obtain the second encrypted number. The principle and purpose of encrypting the first data set are the same. The national secret algorithm is also used to encrypt the second data set according to the established encryption rules and appropriate keys, and the data therein is converted into a ciphertext state to form a second encrypted data set. This ensures that the two data sets participating in the intersection are under encryption protection from the beginning, laying the foundation for subsequent intersection operations under the premise of privacy and security, and maintaining the symmetry of the processing flow, which is convenient for subsequent unified operations and comparative analysis.
[0025] As described in step S2 above, in traditional hash calculations, the entire data is often processed, but this method innovatively uses local feature hash calculations. Only the key data segments in each encrypted data are selected for hash calculations, which is based on many considerations. On the one hand, the encrypted data as a whole is relatively long and complex. If all hash operations are performed, unnecessary calculations will be increased. Focusing on key data segments can not only reflect the core characteristics of the data, but also effectively reduce the consumption of computing resources and improve overall efficiency. For example, for an encrypted structured data record, the key data segments are specific fields (such as fields representing the unique identifier of the data subject, important timestamp fields, etc.). After selecting these key segments, a suitable hash algorithm (such as the national secret SM3 hash algorithm, etc.) is used to generate corresponding hash values for each data in the first encrypted data set. These hash values are arranged in order to form a first hash sequence; similarly, the same operation is performed on the second encrypted data set to obtain a second hash sequence. Through such local feature hash calculations, the two data sets are converted into a more representative and convenient hash sequence form for subsequent comparison operations, while also further hiding the complete content of the original data and enhancing the privacy protection effect.
[0026] As described in step S3 above, constructing a matrix is a key intermediate link in the privacy intersection method. By taking each hash data in the first hash sequence as the row element of the matrix and each hash data in the second hash sequence as the column element of the matrix, a two-dimensional structure is constructed. The dimension of this matrix depends on the number of elements in the two hash sequences. Its significance lies in providing a clear and regular framework for the subsequent comprehensive comparison of the hash features of the two data sets, which facilitates the systematic examination of the correlation between different hash data.
[0027] After constructing the matrix framework, it is necessary to further calculate the similarity between each row element (i.e. a hash data in the first hash sequence) and each column element (i.e. each hash data in the second hash sequence). The similarity calculation method can adopt a variety of appropriate strategies, such as measuring based on the number of bit differences in the hash value (the smaller the bit difference, the higher the similarity), or through some more complex functions, comprehensively considering factors such as the length of the hash value and data distribution characteristics to determine the similarity value. For each pair of row elements and column elements, after calculating their similarity values, fill the values into the corresponding row and column intersection positions of the matrix. After calculating and filling all element pairs, the hash association matrix is finally obtained. The above hash association matrix fully reflects the similarity of each element between the two hash sequences, providing an intuitive basis for the subsequent screening of potential intersections.
[0028] As described in step S4 above, a reasonable threshold is set. The determination of this threshold usually needs to be combined with factors such as the actual application scenario, data characteristics, and requirements for intersection accuracy and recall rate. For example, in the scenario of financial data intersection where data accuracy is extremely high, the threshold will be set relatively high to minimize misjudgment. From the constructed hash association matrix, traverse the similarity values at the intersection positions of each row and column, and extract the hash data corresponding to those positions whose similarity is greater than the set threshold. Since these hash data come from the first hash sequence and the second hash sequence respectively, they form a potential intersection data pair in pairs. The above data pairs represent data that have a high similarity at the hash level and are likely to be the same or related data in the original data set, and are important candidates for further verification and determination of the final intersection.
[0029] As described in step S5 above, the potential intersection data pairs screened out in the previous steps are only preliminary judgments based on the hash feature level, and further verification is needed to see whether they are truly consistent at the original data level. Since in the previous operation, the data was first encrypted and then processed by hash calculation, it is necessary to first restore the data corresponding to the hash data in the potential intersection data pair by corresponding decryption means (such as decrypting using the corresponding key during the previous encryption), and then perform detailed comparison operations on these restored original data word by word, field by field, or according to established data comparison rules. Only when the comparison results show complete consistency can it be determined that these original data are the true intersection parts of the two data sets, and then they are identified as the final intersection data. Such a final verification process ensures the accuracy of the intersection result, avoids misjudgment caused by hash collisions, etc., and makes the final intersection data meet actual needs and reliable.
[0030] In this embodiment, the original data is encrypted and hashed before intersection calculation is performed to avoid data leakage; local feature hash calculation is used to significantly reduce the amount of calculation; similarity screening is performed using a hash association matrix to reduce the amount of calculation when intersecting data, and also reduce the risk of data leakage. Through the close coordination and orderly execution of the above steps, the privacy intersection method based on the national secret algorithm can efficiently and accurately find the intersection data between two data sets while ensuring data privacy security, meeting the actual needs of many scenarios involving sensitive data interaction.
[0031] In one embodiment, during fast encryption, only the basic structural information of the original data is retained for encryption, and the metadata is removed, and the metadata does not need to be encrypted.
[0032] In this embodiment, during the data encryption process, the basic structural information of the original data refers to the organizational form and architecture of the data, which defines how the data is arranged and associated. For example, in a database table, the basic structural information includes the field definition of the table (such as field name, data type, relationship between fields, etc.), the association relationship between tables, etc. For a file system, the basic structural information may include the directory structure, the hierarchical relationship of files, etc. The purpose of retaining the basic structural information is to still be able to identify and understand the overall organization of the data after encryption, so as to facilitate subsequent processing and analysis.
[0033] Metadata provides description and explanation information of the original data. Metadata can include the source of the data, creation time, author, meaning of the data, quality information of the data, etc. In this encryption scenario, metadata is removed mainly for privacy protection and encryption efficiency. Removing metadata can reduce the amount of data that needs to be encrypted, thereby speeding up encryption, while also avoiding the risk of privacy leakage caused by metadata, because metadata may sometimes contain sensitive information, such as the identity of the owner of the data, the location where the data was collected, etc.
[0034] In one embodiment, calculating the similarity between row elements and column elements and filling them in a matrix includes: Based on the similarity evaluation algorithm, the similarities of the row elements and column elements corresponding to each row and column intersection position are calculated respectively, and the row and column intersection positions in the matrix are filled; the similarity evaluation algorithm combines the number of bit differences in the hash data on the row elements and column elements and the data size ratio to calculate the similarity between the two.
[0035] In this embodiment, in the entire privacy intersection method flow, the similarity evaluation algorithm is a key link, which undertakes the important task of quantifying the similarity between two different hash data (i.e., row elements and column elements). Through this algorithm, the association between relatively abstract data that originally existed only in the form of hashes can be specifically numerically represented, thereby providing a clear and measurable basis for the subsequent screening of potential intersection data pairs.
[0036] In the previously constructed matrix, the row elements come from the first hash sequence, and the column elements come from the second hash sequence. Each row-column intersection position represents a correspondence between a certain hash data in the first hash sequence and a certain hash data in the second hash sequence.
[0037] For each row element (recorded as hash data A) and column element (recorded as hash data B) corresponding to such a row-column intersection, a similarity evaluation algorithm will be used to calculate the similarity between them. This calculation process requires comprehensive consideration of many factors. It is not a simple direct comparison, but an in-depth analysis of the characteristics of the hash data itself to obtain a reasonable similarity value.
[0038] Hash data is usually a string of numbers (or characters) in binary form. The number of bit differences refers to the sum of the number of bits that are different in the corresponding binary bits of the two hash data (A and B). The number of bit differences reflects the similarity of the two hash data to a certain extent. The fewer the number of different bits, the closer the two hash data are, which means that the original data they correspond to are more likely to be the same or highly related, so this is an important dimension to measure similarity.
[0039] The above data size ratio refers to the proportional relationship between the two hash data (A and B) in terms of length or the data scale represented. Hash data of different sizes may differ in terms of generation mechanism, data characteristics represented, etc. Even if the number of bit differences is the same, the actual similarity may have different meanings if the data size ratio is different. For example, a shorter hash data and a very long hash data may have relatively low similarity due to the large difference in overall scale, even if the number of bit differences is not large; while two hash data of similar length are more likely to have higher similarity when the number of bit differences is small. By comprehensively considering this proportional relationship, the true similarity between two hash data can be measured more comprehensively and accurately.
[0040] The similarity evaluation algorithm combines the two factors of the number of bit differences and the data size ratio to perform operations (such as weighted operations) and finally obtain a specific similarity value. The range of this value is usually set between 0 and 1, with 0 indicating complete dissimilarity and 1 indicating complete similarity. The values in between represent different degrees of similarity. For example, through a weighted summation method, appropriate weights are assigned to the number of bit differences and the data size ratio (the weights can be determined in advance based on experiments, data feature analysis, etc.), and then the similarity value is calculated.
[0041] In one embodiment, before performing local feature hash calculation on the first encrypted data set and the second encrypted data set, the method further includes: The encrypted data in the first encrypted data set and the second encrypted data set are respectively scattered and reorganized.
[0042] In one embodiment, if they are consistent, then the corresponding original data is the final intersection data, including: storing each raw data in the first data set and the second data set in a data table of a database; Based on the first data set and the second data set, generate a query code; A mapping relationship between the final intersection data and the data table is established, and a query permission code for the final intersection data is configured based on the query code.
[0043] In this embodiment, after completing the privacy intersection operation and determining the final intersection data, each original data in the first data set and the second data set is stored in the data table of the database, mainly for the consideration of data management, subsequent use and traceability. As an efficient data storage and management tool, the database can organize data in a structured manner to facilitate operations such as querying, updating, and analyzing the data.
[0044] The purpose of generating a query code is to effectively control access and manage permissions for stored data, especially the final intersection data. By creating a unique query code, corresponding query permissions can be configured based on this code. Only authorized users or systems with the correct query code can obtain and view relevant data. This can greatly enhance data security, prevent unauthorized access to data, and protect data privacy, which is particularly important in scenarios involving sensitive information.
[0045] There are many ways to generate the query code. It is necessary to comprehensively consider the overall characteristics of the first data set and the second data set to ensure the uniqueness and validity of the query code. One possible idea is to first extract features from the two data sets. For example, for numerical data, statistical features such as the distribution range, mean, and variance of the data can be counted; for text data, semantic features such as keywords and subject terms can be extracted. Then, these extracted features are combined according to certain rules, which can be concatenated, encrypted, or subjected to specific mathematical transformations (such as hash operations, encoding conversion, etc.), and finally a query code that uniquely identifies the overall characteristics of the two data sets is generated. For example, after the numerical features of the first data set and the text keywords of the second data set are concatenated, they are encrypted by an encryption algorithm (such as a symmetric encryption algorithm, using a specific key), and the ciphertext result is used as the query code, which can not only integrate the key information of the two data sets, but also ensure their confidentiality and uniqueness.
[0046] The mapping relationship between the final intersection data and the data table is established to clearly determine the specific location and association of the final intersection data in the entire stored data system. A large amount of raw data is stored in the data table, and the final intersection data is the part with specific value screened out from these raw data. Through the mapping relationship, the specific record row or field position of these intersection data in the data table can be quickly located, which is convenient for subsequent data extraction, display, and permission-based access control operations. This helps to improve the efficiency of data management and ensure that the use and access of data can accurately correspond to the actual stored data content.
[0047] Configuring the query permission code of the final intersection data based on the query code generated previously is the core step to implement data access control. The query permission code can be understood as a "key" derived from the query code to verify whether the user has the authority to access the final intersection data. For example, a role-based permission management mechanism can be adopted to assign different query permission codes to different roles (such as administrators, ordinary business personnel, etc.). When a user tries to access the final intersection data, he will be required to enter the query permission code, and then compare the entered code with the corresponding permission code configured based on the query code. If the match is successful, it means that the user has the corresponding access rights and can obtain the final intersection data; otherwise, access is denied. The above permission configuration method can flexibly manage data access in a refined manner according to actual business needs, while ensuring data security, ensuring that only legitimate and authorized users can access sensitive final intersection data.
[0048] In one embodiment, generating a query code based on the first data set and the second data set includes: Extracting multi-dimensional first feature information of the first data set, and generating a closed graph based on the first feature information; Extracting multi-dimensional second feature information of the second data set, and generating a two-dimensional curve based on the second feature information; Divide the data table into four sub-areas evenly, superimpose the closed graph on each of the sub-areas, and obtain the original data located at the center of the closed graph in each sub-area as the target data; Based on the characteristic information of each target data, a multi-digit number is generated; the multi-digit number is substituted into the two-dimensional curve as the horizontal coordinate to perform calculation, and the corresponding vertical coordinate value is obtained as the query code.
[0049] In this embodiment, the first data set often contains rich and diverse data content, and extracting its feature information from multiple dimensions is to fully and comprehensively grasp the characteristics of the data set so as to subsequently generate representative identification elements (i.e., closed graphs). The multiple dimensions here can cover multiple aspects. For example, for numerical data, statistical dimension features such as the maximum value (maximum value, minimum value), mean, variance, and interval range of data distribution are considered; for text data, semantic and structural dimension features such as the frequency of keyword occurrence, the subject category of the text, and the mean of sentence length are extracted. After obtaining the first feature information, using these features to generate closed figures is an innovative way of representation. For example, the size parameters of the figure (such as perimeter, area, etc.) can be determined based on the numerical features, the shape category of the figure can be determined based on the data distribution (for example, if the data features are evenly distributed, a circle may be generated; if the data features are biased, an ellipse may be generated, etc.), and some textures or filling styles inside the figure can be determined by text-related features (of course, this may be an abstract representation used to distinguish different semantic features), etc. The closed figure generated in this way is like a visual fingerprint of the first data set, presenting complex data features in an intuitive and unique graphic form, providing a unique basis for further association and operation.
[0050] Similar to extracting feature information of the first data set, feature mining is also performed on the second data set from a multi-dimensional perspective. The key dimensions corresponding to different types of data are also involved, such as various statistics of numerical data, semantic key elements of text data, etc. By comprehensively analyzing these dimensions, the second feature information that can accurately describe the characteristics of the second data set is summarized. This step ensures a comprehensive characterization of the second data set, preparing for the subsequent generation of the corresponding two-dimensional curve.
[0051] The principle of generating a two-dimensional curve based on the extracted second feature information is to convert these features into relevant parameters of the curve. For example, a certain trend feature of the data can be used as the change of the horizontal axis over time or other variables, and the correlation feature of the data can be used as the value of the vertical axis. Through a specific functional relationship or fitting algorithm, a two-dimensional curve can be drawn. This curve is like a unique identifier of the second data set, which can reflect the dynamic changes and internal correlation of the second data set under multi-dimensional features, making it different from other different data sets, and laying the foundation for subsequent association operations with the first data set.
[0052] Dividing the data table into four sub-areas evenly is a strategy for dividing the storage data space, the purpose of which is to filter and associate data from a more detailed local perspective. This division method can be based on the average distribution of the number of rows and columns in the data table, for example, by dividing according to the row index range and column index range, so that each sub-area has a relatively independent and similar-sized data portion.
[0053] The closed graph generated based on the first data set is superimposed on each sub-area. By finding the original data located at the center of the closed graph in each sub-area, a mapping relationship between the first data set and the specific original data in the data table is actually established. By extracting these data as target data, some key data with a strong correlation with the first data set in the entire data table is screened out, further focusing on the key elements for the final generation of the query code.
[0054] The purpose of extracting the feature information of each acquired target data again is to further refine the key attributes of these key data, and then generate a multi-digit number based on these feature information. For example, the different features of the target data can be combined according to certain weights, and converted into a unique multi-digit number through mathematical operations (such as weighted summation, encoding conversion, etc.). This multi-digit number carries the core features of the target data and becomes an important intermediate identifier connecting the first data set, the target data, and subsequent operations.
[0055] Substituting the generated multi-digit number as the horizontal coordinate into the two-dimensional curve generated based on the second data set for operation is a key step in associating the previous two data sets to generate a query code. Since the two-dimensional curve represents the characteristics of the second data set, the multi-digit number carries the characteristics of the target data related to the first data set. Through such substitution operation, the corresponding vertical coordinate value is obtained by using the functional relationship contained in the curve, and this vertical coordinate value is determined as the query code. The query code generated in this way cleverly combines the characteristics of the two data sets and the association between them established through the target data, which not only ensures the uniqueness of the query code, but also makes it closely related to the two data sets, providing a reliable and creative basis for subsequent operations such as permission configuration based on the query code, and realizing effective access control and privacy protection of the final intersection data.
[0056] In one embodiment, generating a query code based on the first data set and the second data set includes: Adding the characters in the first data set to the matrix one by one in sequence to generate a first matrix; adding the characters in the second data set to the matrix one by one in sequence to generate a second matrix; Performing XOR calculation on characters at the same matrix position in the first matrix and the second matrix, and adding the calculation result to a new matrix to obtain an XOR matrix; the XOR matrix includes the first number and the second number; The search code is generated based on the first number in the XOR matrix.
[0057] In this embodiment, the first data set contains many data elements, and the focus here is on the character information therein (for example, if the data set is data in text form, the character is the text content itself; if the data set is a mixed type, the part that can be represented in the form of characters can be extracted). These characters are added to the matrix one by one in sequence, that is, in a certain order, such as starting from the first data in the data set, and filling each element position of the matrix one by one. For example, a fixed number of rows and columns can be set. If the number of characters exceeds the matrix capacity, appropriate strategies such as truncation and block division can be adopted for processing to ensure that the character information of the first data set can be presented in the matrix in an orderly manner, thereby generating the first matrix.
[0058] The principle and operation method are the same as those for constructing the first matrix. For the second data set, the character information is also extracted, and then added to another matrix one by one in a predetermined order to generate the second matrix.
[0059] XOR calculation is a logical operation, and its rule is that for two binary bits involved in the operation, when the two bits are the same (both are 0 or both are 1), the result is 0; when the two bits are different (one is 0 and the other is 1), the result is 1. In this step, the XOR operation is performed bit by bit for the characters in the same position in the first matrix and the second matrix.
[0060] The first number and the second number (ie, 0 and 1) contained in the XOR matrix are the results obtained after the above XOR operation.
[0061] The first number in the XOR matrix is selected to generate the query code because this number has a key representative or unique identification function in the information represented by the entire XOR matrix. Generating the query code in this way cleverly utilizes the difference information between the characters of the two data sets. After the refinement of the XOR operation and the transformation based on specific numbers, the query code can be closely associated with the characteristics of the two data sets, while having a certain degree of confidentiality and uniqueness, which provides strong support for subsequent operations such as effective permission configuration of the final intersection data based on the query code.
[0062] In one embodiment, generating the search code based on the first number in the XOR matrix includes: Sequentially select the first number that meets the preset position condition from the XOR matrix as the target number, and sequentially connect the target numbers to form a target curve; Extracting curve feature information of multiple dimensions of the target curve, and generating the query code based on the curve feature information of multiple dimensions.
[0063] In this embodiment, the XOR matrix is a result matrix obtained after performing XOR operations on the characters at corresponding positions in the first matrix and the second matrix, which contains rich digital information reflecting the difference characteristics of the two data sets. The preset position condition here is a screening rule, which aims to select numbers with specific representativeness or relevance from a large number of numbers as target numbers. For example, the preset position condition can be to select numbers on the main diagonal of the XOR matrix, or it can also be set to select a number every fixed number of rows and columns. According to such preset position conditions, the corresponding first numbers are selected from the XOR matrix in sequence as target numbers, and these target number sets become the basic elements for the subsequent construction of the target curve.
[0064] Connecting the selected target numbers in sequence to form a target curve is a way to convert discrete digital information into a representation with continuity and geometric features. Specifically, each target number can be regarded as the ordinate of a point in a plane rectangular coordinate system, and then these points can be connected in sequence to draw a curve on the plane, namely the target curve. This target curve carries the information contained in the target numbers selected from the XOR matrix, and presents the associated features of the two data sets after specific processing in a visual (abstract) and geometric way, providing a new intermediate data structure for further extracting features and generating query codes.
[0065] After the target curve is formed, the characteristic information contained in it can be mined and extracted from multiple dimensions. From the geometric dimension, it can include the length of the curve, the curvature of the curve (for example, measured by curvature-related indicators, the curvature can reflect the speed of the curve's curvature change at each point), the area enclosed by the curve (if the curve is closed or can enclose a certain area with the coordinate axis), etc.; from the data distribution dimension, it will involve the position range of the curve in the coordinate system (such as the value range of the horizontal axis, the value range of the vertical axis), the density of data points (reflecting whether the distribution of the target number in terms of value is relatively concentrated or dispersed), etc.; it can also be analyzed from the function fitting dimension, such as trying to fit this curve with different functions (such as polynomial functions, trigonometric functions, etc.), and extracting the relevant parameters of the fitting function (such as the coefficients of the polynomial function) as the characteristic information of the curve. By comprehensively considering the characteristic information of the curve in these different dimensions, it is possible to fully and deeply grasp the intrinsic connection and unique properties between the two data sets represented by the target curve.
[0066] After obtaining the multi-dimensional curve feature information, it is necessary to convert this information into a query code. One feasible approach is to arrange and combine the feature information of each dimension in a specific order, such as sorting by dimension importance or a fixed order (such as geometric dimension first, then data distribution dimension, and finally function fitting dimension), and concatenate the eigenvalues corresponding to each dimension together to form a long string. Then, the string can be further processed, such as using a hash algorithm (such as a common hash function, mapping the string to a hash value of a fixed length), encoding conversion (such as converting the string to hexadecimal encoding, etc.) or through specific mathematical operations (such as weighted summing and rounding the eigenvalues, etc.), and finally generate a unique query code that can be used for subsequent permission management and other purposes. The query code generated in this way fully integrates the associated features of the two data sets extracted and converted from the XOR matrix, which not only ensures its close connection with the original data set, but also has the characteristics of being easy to identify, verify and use for access control, providing a reliable basis for the entire data privacy intersection and the permission configuration link in the subsequent data management process.
[0067] In one embodiment, generating the search code based on the first number in the XOR matrix includes: Extracting multiple features of the first number in the XOR matrix; the features at least include the number, row position, column position, and maximum interval number of the first number; The search code is generated based on multiple features of the first number.
[0068] In this embodiment, in the XOR matrix data structure, counting the number of the first number is to count the frequency of its appearance in the entire XOR matrix. This number can reflect the distribution density of the first number in the matrix.
[0069] Record the row position information of the first number in the XOR matrix, that is, to clarify which row of the matrix each first number is in. The row position is an important spatial position attribute, which together with the column position can determine the specific coordinates of the first number in the two-dimensional structure of the matrix.
[0070] Similar to the row position, the column position is used to determine the horizontal coordinate position of the first number in the XOR matrix. Taking the column position feature into consideration and combining it with the row position information can more accurately locate the specific distribution of the first number in the matrix, providing more detailed information support for mining the deep-level association between the two data sets and generating unique and representative query codes.
[0071] The maximum number of intervals refers to the maximum distance between adjacent first numbers in the XOR matrix (the interval here can be measured according to the order of rows and columns of the matrix, for example, how many rows and columns are there between two adjacent first numbers). This feature reflects the degree of dispersion of the first numbers in the matrix. A larger maximum number of intervals indicates that the distribution of the first numbers in the matrix is relatively dispersed; while a smaller maximum number of intervals indicates that the distribution is relatively concentrated, reflecting a certain regularity.
[0072] Generating a query code based on the extracted multiple features of the first digit is a process of integrating these discrete information describing the first digit from different angles and converting them into a unique identifier. One approach is to first determine the representation form and order of each feature. For example, the number of the first digit can be represented by a decimal number, and the row position and column position can be represented by a fixed-bit binary code (the appropriate number of bits is determined according to the size of the XOR matrix to ensure that all possible positions can be accurately represented), and the maximum number of intervals is also represented in a suitable digital form. Then, in a predetermined order, such as the number first, then the row position, then the column position, and finally the maximum number of intervals, these codes representing each feature are spliced together in sequence to form a string.
[0073] Afterwards, in order to make this string more in line with the requirements of the query code (usually the query code is expected to have certain confidentiality, uniqueness, and be easy to store and verify), it can be further processed. For example, a hash algorithm (such as the national secret SM3 hash algorithm or other commonly used hash algorithms) is used to perform a hash operation on the spliced string to obtain a hash value of a fixed length, which can be used as the final query code; or an encryption algorithm is used to encrypt the spliced string using a specific key, and the obtained ciphertext is used as the query code; some mathematical transformations can also be performed, such as weighted summation and modulus operations on the spliced string, to convert the result into a specific format of encoding as the query code. In this way, the multiple features of the first number in the XOR matrix are fully utilized, and the generated query code can be closely associated with the specific situation of the two data sets after the XOR operation, which not only reflects the internal connection between them, but also plays an important role in subsequent data access control, authority management and other links, ensuring that only users or systems with corresponding permissions can access relevant data resources with the correct query code, thereby ensuring data security and privacy.
[0074] In one embodiment, generating a query code based on the first data set and the second data set includes: The first data set is classified and grouped to obtain a plurality of groups; wherein the data is divided into a plurality of different groups according to obvious characteristic differences presented by the data itself, for example, the first data set is divided into corresponding groups according to factors such as the business field involved in the data, the time period in which the data is generated, or the geographical scope corresponding to the data.
[0075] For each group, calculate the key indicators of the group's overall characteristics; for example, a certain average value of the data within the group, which can reflect the central trend of the group's data, and the degree of dispersion of the data within the group, so as to understand the dispersion of the data.
[0076] The second data set is classified and grouped, and the corresponding key indicators of each group are calculated.
[0077] Based on the key indicators of each group of the first data set, a graph is constructed; the above graph can intuitively show its characteristic changes, for example, the average values of different groups are used as the vertical coordinates of the points on the graph, and the order of the groups is used as the horizontal coordinate, and these points are connected in sequence to form a unique line trajectory.
[0078] Based on the key indicators of each group in the second data set, a line trajectory is constructed.
[0079] Transform graphics and line trajectories; mainly convert them from their original shape representation into another feature form that can reflect their internal laws, extract the undulating characteristics, flat characteristics and trend characteristics of line trajectories in the process of change, etc.
[0080] Compare the transformed features and find out the differences between them. These differences reflect the differences in the internal laws of the two data sets.
[0081] Based on the difference, a unique identifier is generated and used as the final query code. For example, if the difference is that the graph has an obvious upward trend at a certain stage, and the line trajectory is flat at the corresponding stage, then this feature combination is encoded into a specific symbol or a short character sequence. This character sequence is the query code, and the query code can be used to accurately control the permissions of the relevant data in the future.
[0082] Reference Figure 2 In another embodiment of the present invention, a privacy intersection system based on a national secret algorithm is provided, comprising: An encryption unit, used to quickly encrypt the first data set involved in the intersection based on the national secret algorithm to obtain a first encrypted data set; and quickly encrypt the second data set involved in the intersection based on the national secret algorithm to obtain a second encrypted data set; A hash unit, used to perform local feature hash calculation on the first encrypted data set and the second encrypted data set to obtain a corresponding first hash sequence and a second hash sequence; wherein, when performing local feature hash calculation, only a key data segment in each encrypted data is selected for hash calculation; A construction unit is used to construct a matrix, using the hash data in the first hash sequence as row elements and the hash data in the second hash sequence as column elements; calculating the similarity between the row elements and the column elements and filling them in the matrix to obtain a hash association matrix; A screening unit, used to screen out hash data corresponding to row and column intersection positions with a similarity greater than a threshold from the hash association matrix as potential intersection data pairs; The intersection unit is used to compare the original data corresponding to the hash data in the potential intersection data pair; if they are consistent, the corresponding original data is the final intersection data.
[0083] In this embodiment, for the specific implementation of each unit in the above system embodiment, please refer to the above method embodiment, which will not be repeated here.
[0084] Reference Figure 3 In an embodiment of the present invention, a computer device is also provided. The computer device may be a server, and its internal structure may be as follows: Figure 3As shown. The computer device includes a processor, a memory, a display screen, an input device, a network interface and a database connected through a system bus. Among them, the processor designed by the computer is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the corresponding data in this embodiment. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the above method is implemented.
[0085] Those skilled in the art will understand that Figure 3 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied.
[0086] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the above method is implemented. It can be understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.
[0087] In summary, the privacy intersection method and system based on the national secret algorithm provided in the embodiment of the present invention include: quickly encrypting the first data set participating in the intersection based on the national secret algorithm to obtain a first encrypted data set; quickly encrypting the second data set participating in the intersection based on the national secret algorithm to obtain a second encrypted data set; performing local feature hash calculation on the first encrypted data set and the second encrypted data set to obtain corresponding first hash sequence and second hash sequence; wherein, when performing local feature hashing, only the key data segments in each encrypted data are selected for hash calculation; constructing a matrix with the hash data in the first hash sequence as row elements and the hash data in the second hash sequence as column elements; calculating the similarity between the row elements and the column elements and filling them in the matrix to obtain a hash association matrix; screening out the hash data corresponding to the row and column intersection positions with a similarity greater than a threshold from the hash association matrix as potential intersection data pairs; comparing the original data corresponding to the hash data in the potential intersection data pairs; if they are consistent, the corresponding original data is the final intersection data. In the present invention, the original data is encrypted and hashed before intersection calculation is performed to avoid data leakage; local feature hash calculation is used to significantly reduce the amount of calculation; and a hash association matrix is used for similarity screening to reduce the amount of calculation when finding data intersection, while also reducing the risk of data leakage.
[0088] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided by the present invention and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double-speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM.
[0089] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0090] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A privacy intersection method based on a national secret algorithm, characterized in that: The following steps are involved: The first data set involved in the intersection is quickly encrypted based on the national secret algorithm to obtain a first encrypted data set; the second data set involved in the intersection is quickly encrypted based on the national secret algorithm to obtain a second encrypted data set; Performing local feature hash calculation on the first encrypted data set and the second encrypted data set to obtain a corresponding first hash sequence and a second hash sequence; wherein, during the local feature hash calculation, only a key data segment in each encrypted data is selected for hash calculation; Constructing a matrix, using the hash data in the first hash sequence as row elements and the hash data in the second hash sequence as column elements; calculating the similarity between the row elements and the column elements and filling them in the matrix to obtain a hash association matrix; Filtering out hash data corresponding to row and column intersection positions with similarity greater than a threshold from the hash association matrix as potential intersection data pairs; The original data corresponding to the hash data in the potential intersection data pair are compared; if they are consistent, the corresponding original data is the final intersection data.
2. The privacy intersection method based on the national secret algorithm according to claim 1 is characterized in that: During fast encryption, only the basic structural information of the original data is retained and the metadata is removed.
3. The privacy intersection method based on the national secret algorithm according to claim 1 is characterized in that: Calculate the similarity between row elements and column elements and fill them in the matrix, including: Based on the similarity evaluation algorithm, the similarities of the row elements and column elements corresponding to each row and column intersection position are calculated respectively, and the row and column intersection positions in the matrix are filled; the similarity evaluation algorithm combines the number of bit differences in the hash data on the row elements and column elements and the data size ratio to calculate the similarity between the two.
4. The privacy intersection method based on the national secret algorithm according to claim 1 is characterized in that: Before performing local feature hash calculation on the first encrypted data set and the second encrypted data set, the method further includes: The encrypted data in the first encrypted data set and the second encrypted data set are respectively scattered and reorganized.
5. The privacy intersection method based on the national secret algorithm according to claim 1 is characterized in that: If they are consistent, the corresponding original data is the final intersection data, including: storing each raw data in the first data set and the second data set in a data table of a database; Based on the first data set and the second data set, generate a query code; A mapping relationship between the final intersection data and the data table is established, and a query permission code for the final intersection data is configured based on the query code.
6. The privacy intersection method based on the national secret algorithm according to claim 5 is characterized in that: Based on the first data set and the second data set, a query code is generated, including: Extracting multi-dimensional first feature information of the first data set, and generating a closed graph based on the first feature information; Extracting multi-dimensional second feature information of the second data set, and generating a two-dimensional curve based on the second feature information; Divide the data table into four sub-areas evenly, superimpose the closed graph on each of the sub-areas, and obtain the original data located at the center of the closed graph in each sub-area as the target data; Based on the characteristic information of each target data, a multi-digit number is generated; the multi-digit number is substituted into the two-dimensional curve as the horizontal coordinate to perform calculation, and the corresponding vertical coordinate value is obtained as the query code.
7. The privacy intersection method based on the national secret algorithm according to claim 5 is characterized in that: Based on the first data set and the second data set, a query code is generated, including: Adding the characters in the first data set to the matrix one by one in sequence to generate a first matrix; adding the characters in the second data set to the matrix one by one in sequence to generate a second matrix; Performing XOR calculation on characters at the same matrix position in the first matrix and the second matrix, and adding the calculation result to a new matrix to obtain an XOR matrix; the XOR matrix includes the first number and the second number; The search code is generated based on the first number in the XOR matrix.
8. The privacy intersection method based on the national secret algorithm according to claim 7 is characterized in that: Generating the search code based on the first number in the XOR matrix includes: Sequentially select the first number that meets the preset position condition from the XOR matrix as the target number, and sequentially connect the target numbers to form a target curve; Extracting curve feature information of multiple dimensions of the target curve, and generating the query code based on the curve feature information of multiple dimensions.
9. The privacy intersection method based on the national secret algorithm according to claim 7 is characterized in that: Generating the search code based on the first number in the XOR matrix includes: Extracting multiple features of the first number in the XOR matrix; the features at least include the number, row position, column position, and maximum interval number of the first number; The search code is generated based on multiple features of the first number.
10. A privacy intersection system based on a national secret algorithm, characterized in that: include: An encryption unit, used for quickly encrypting the first data set involved in the intersection based on a national encryption algorithm to obtain a first encrypted data set; Based on the national encryption algorithm, the second data set involved in the intersection is quickly encrypted to obtain a second encrypted data set; A hash unit, used to perform local feature hash calculation on the first encrypted data set and the second encrypted data set to obtain a corresponding first hash sequence and a second hash sequence; wherein, when performing local feature hash calculation, only a key data segment in each encrypted data is selected for hash calculation; A construction unit is used to construct a matrix, using the hash data in the first hash sequence as row elements and the hash data in the second hash sequence as column elements; calculating the similarity between the row elements and the column elements and filling them in the matrix to obtain a hash association matrix; A screening unit, used to screen out hash data corresponding to row and column intersection positions with a similarity greater than a threshold from the hash association matrix as potential intersection data pairs; The intersection unit is used to compare the original data corresponding to the hash data in the potential intersection data pair; if they are consistent, the corresponding original data is the final intersection data.
Citation Information
Patent Citations
Insurance customer recommendation method and system based on federal label propagation
CN113095946A
Alarm scene mining method
CN113791952A
Hidden query method and device based on high-dimensional matrix operation, equipment and medium
CN117834132A
Approximate data processing method and apparatus, medium and electronic device
WO2021143016A1
Private information retrieval method supporting multiple parties
WO2024239592A1