An anonymous query method, device, equipment, medium and product

By serializing and matrixing the database, and using accelerated hardware to generate random matrices for preprocessing, the problems of high computational complexity and heavy communication burden in stealth queries are solved, achieving efficient data retrieval and privacy protection.

CN121301432BActive Publication Date: 2026-06-19CHINA MOBILE INFORMATION TECHNOLOGY CO LTD +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA MOBILE INFORMATION TECHNOLOGY CO LTD
Filing Date
2025-10-14
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Existing stealth query techniques face problems such as high computational complexity, heavy communication burden, and low data transfer efficiency with large-scale datasets, especially when using FPGA or GPU acceleration hardware, where data transmission bottlenecks are obvious.

Method used

By serializing and matrixing the database to be processed, a two-dimensional data matrix is ​​generated. Then, an accelerated hardware is used to generate a random matrix for offline preprocessing to generate prompt data. The server and the query end work together to perform encrypted query calculations, reducing the computational burden and data transfer during the online phase.

🎯Benefits of technology

It significantly reduces the computational complexity and communication burden in the online query phase, improves query efficiency, protects query privacy, and enhances the efficiency of anonymous queries.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121301432B_ABST
    Figure CN121301432B_ABST
Patent Text Reader

Abstract

This application provides an anonymous query method, apparatus, device, medium, and product, relating to the field of big data technology. The method includes: performing serialization and matrix processing on a database to be processed to generate a two-dimensional data matrix; generating a random matrix according to the size of the matrix; performing offline preprocessing on the two-dimensional data matrix and the random matrix based on accelerated hardware to obtain hint data; sending a second hint matrix and the random matrix to a query terminal; receiving an encrypted query request from the query terminal; performing online query calculation on the encrypted query request based on the accelerated hardware, the two-dimensional data matrix, the random matrix, and the first hint matrix; generating an encrypted response; and returning the encrypted response to the query terminal. Thus, by generating hint data through serialization and matrix processing, and utilizing accelerated hardware to achieve efficient online query calculation, data privacy is protected while providing a rapid response to encrypted query requests, ultimately providing the query terminal with decrypted query results and improving the efficiency of reverse tracing queries.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of big data technology, and in particular to an anonymous query method, apparatus, device, medium and product. Background Technology

[0002] With the rapid development of information technology, data privacy protection and secure querying have become indispensable and important issues in today's internet environment. Against the backdrop of cloud computing and big data applications, users are increasingly concerned about data privacy, leading to the emergence of Private Information Retrieval (PIR) technology. PIR aims to allow users to retrieve desired information from remote databases without disclosing the query content. Existing PIR technologies mainly include schemes based on Oblivious Transfer (OT) and Partially Homomorphic Encryption (PHE).

[0003] OT-based solutions effectively protect user query privacy by implementing a 1-out-of-n (n-choose-1) unobtrusive transmission protocol. However, this approach may face performance bottlenecks in practical applications, especially with large-scale datasets. On the other hand, homomorphic encryption-based solutions encrypt query conditions before sending them to the server, utilizing homomorphic properties for computation to return query results while protecting privacy. Specifically, the client generates a homomorphic public-private key pair, uses this key to encrypt the query conditions, and then sends the ciphertext to the server, which then calculates and returns the result.

[0004] However, existing keyword-based anonymous query schemes suffer from significant drawbacks in terms of computational and communication complexity. Protocols based on homomorphic encryption and Lagrange interpolation require 5n semi-homomorphic encryption operations and high-order calculations, leading to a significant increase in computational complexity when the number of database entries n is large. Furthermore, communication complexity is also considerable, requiring the transmission of n+2 semi-homomorphically encrypted ciphertexts, further exacerbating the bandwidth burden.

[0005] More importantly, when protocol acceleration is performed using acceleration hardware such as FPGAs (Field-Programmable Gate Arrays) and GPUs (Graphics Processing Units), the time spent on data transfer often exceeds the time gains that hardware acceleration can provide. This data transmission bottleneck means that although acceleration can be achieved in computational parts such as modular exponentiation and number theoretic transformations (NTTs), the overall acceleration effect fails to meet expectations.

[0006] Therefore, existing technologies face multiple challenges in achieving high-performance anonymous queries, including high computational complexity, heavy communication burden, and low data transfer efficiency. Summary of the Invention

[0007] This application provides a method, apparatus, device, medium, and product for stealth querying, in order to solve the technical problems of high computational complexity, heavy communication burden, and low data transfer efficiency faced by the prior art in achieving high-performance stealth querying.

[0008] To solve the above-mentioned technical problems, this application is implemented as follows:

[0009] In a first aspect, embodiments of this application provide an anonymous query method, the method being applied to a server, the method comprising:

[0010] The database to be processed is serialized and matrix-processed to generate a two-dimensional data matrix.

[0011] A random matrix is ​​generated based on the size of the two-dimensional data matrix. The two-dimensional data matrix and the random matrix are preprocessed offline using accelerated hardware to obtain prompt data, wherein the prompt data includes a first prompt matrix and a second prompt matrix.

[0012] Send the second hint matrix and the random matrix to the query terminal;

[0013] Receive an encrypted query request sent by the query terminal, wherein the encrypted query request is generated based on the random matrix;

[0014] Based on the acceleration hardware, the two-dimensional data matrix, the random matrix, and the first prompt matrix, the encrypted query request is calculated online to generate an encrypted response and return the encrypted response to the query terminal. The query terminal is used to decrypt the encrypted response based on the second prompt matrix to obtain the query result.

[0015] Optionally, the database to be processed is serialized and matrix processed to generate a two-dimensional data matrix, including:

[0016] Based on multiple hash functions and the Cuckoo Hash algorithm, the values ​​in the database to be processed are inserted into a preset one-dimensional data array;

[0017] Calculate the size of the two-dimensional data matrix based on the amount of data in the database to be processed;

[0018] Based on the stated dimensions, the data in the one-dimensional data array is mapped to the corresponding positions in the two-dimensional data matrix.

[0019] Optionally, a random matrix is ​​generated based on the size of the two-dimensional data matrix, and the two-dimensional data matrix and the random matrix are preprocessed offline using accelerated hardware to obtain prompt data, including:

[0020] Generate a first random matrix and a second random matrix based on the size of the two-dimensional data matrix;

[0021] The product of the first random matrix and the two-dimensional data matrix is ​​calculated on the acceleration hardware to obtain the first prompt matrix;

[0022] The product of the first cue matrix and the second random matrix is ​​calculated on the acceleration hardware to obtain the second cue matrix;

[0023] The first prompt matrix and the second prompt matrix are determined as the prompt data.

[0024] Optionally, the encrypted query request includes: a first query ciphertext encrypted based on the first random matrix and a second query ciphertext encrypted based on the second random matrix; performing online query calculations on the encrypted query request based on the accelerated hardware, the two-dimensional data matrix, the random matrix, and the first hint matrix, generating an encrypted response, and returning the encrypted response to the query end, including:

[0025] The first response vector is obtained by multiplying the transpose of the first query ciphertext with the transpose of the two-dimensional data matrix on the acceleration hardware.

[0026] The product of the first response vector and the second random matrix is ​​calculated on the acceleration hardware to obtain the second response vector;

[0027] On the acceleration hardware, the first prompt matrix and the first response vector are concatenated, and the product of the concatenated result and the second query ciphertext is calculated to obtain the encryption result;

[0028] The second response vector and the encryption result are used as the encryption response, and the encryption response is returned to the query terminal.

[0029] Secondly, embodiments of this application provide an anonymous query method, which is applied to a query terminal and includes:

[0030] The server receives a second prompt matrix and a random matrix, wherein the random matrix is ​​generated by the server after processing its own database of unprocessed data to generate a two-dimensional data matrix, and the second prompt matrix is ​​obtained by the server using acceleration hardware to calculate the two-dimensional data matrix and the random matrix.

[0031] Get the user's input search keywords;

[0032] Based on the query keywords and the random matrix, an encrypted query request is generated using accelerated hardware, and the encrypted query request is sent to the server.

[0033] Receive the encrypted response returned by the server based on the encrypted query request;

[0034] Based on the second hint matrix and the locally pre-generated random number vector, the encrypted response is decrypted using the accelerated hardware to obtain the query result.

[0035] Optionally, based on the query keyword and the random matrix, an encrypted query request is generated using accelerated hardware, including:

[0036] Based on the hash mapping rules pre-agreed with the server, the target index of the query keyword in the preset one-dimensional data array on the server is determined;

[0037] Based on the size of the two-dimensional data matrix pre-agreed with the server, the target index is converted into the target row number and target column number in the two-dimensional data matrix;

[0038] Based on the target row number and the target column number, generate a row selection vector and a column selection vector respectively;

[0039] Based on the random matrix and the locally pre-generated random number vector, error vector, and ciphertext modulus, the column selection vector and the row selection vector are encrypted using the acceleration hardware to generate a first query ciphertext and a second query ciphertext, respectively. The first query ciphertext and the second query ciphertext are then combined to form the encrypted query request.

[0040] Optionally, the encrypted response includes: a second response vector received from the server and an encryption result; the random number vector includes a first random number vector and a second random number vector; and the encrypted response is decrypted using the acceleration hardware based on the second hint matrix and the locally pre-generated random number vector to obtain a query result, including:

[0041] Using the second prompt matrix and the second random number vector, calculate the first auxiliary value; and using the received second response vector and the second random number vector, calculate the second auxiliary value.

[0042] The encryption result is divided into a first part and a second part;

[0043] Based on the first part, the second part, the first auxiliary value, the second auxiliary value, and the first random number vector, the accelerated hardware is used to perform decryption calculations to obtain an approximate result;

[0044] The approximate result is decoded to restore the query result.

[0045] Thirdly, embodiments of this application provide an anonymity query device, which is applied to a server and includes:

[0046] The generation module is used to perform serialization and matrix processing on the database to be processed, generating a two-dimensional data matrix.

[0047] The first execution module is used to generate a random matrix according to the size of the two-dimensional data matrix, and to perform offline preprocessing on the two-dimensional data matrix and the random matrix based on acceleration hardware to obtain prompt data, wherein the prompt data includes a first prompt matrix and a second prompt matrix;

[0048] Send the second hint matrix and the random matrix to the query terminal;

[0049] Receive an encrypted query request sent by the query terminal, wherein the encrypted query request is generated based on the random matrix;

[0050] Based on the acceleration hardware, the two-dimensional data matrix, the random matrix, and the first prompt matrix, the encrypted query request is calculated online to generate an encrypted response and return the encrypted response to the query terminal. The query terminal is used to decrypt the encrypted response based on the second prompt matrix to obtain the query result.

[0051] Fourthly, embodiments of this application provide an anonymity query device, which is applied to a query terminal and includes:

[0052] The receiving module is used to receive a second prompt matrix and a random matrix from the server. The random matrix is ​​generated by the server after processing its own database of unprocessed data to generate a two-dimensional data matrix, and the second prompt matrix is ​​obtained by the server using acceleration hardware to calculate the two-dimensional data matrix and the random matrix.

[0053] The second execution module is used to obtain the query keywords input by the user;

[0054] Based on the query keywords and the random matrix, an encrypted query request is generated using accelerated hardware, and the encrypted query request is sent to the server.

[0055] Receive the encrypted response returned by the server based on the encrypted query request;

[0056] Based on the second hint matrix and the locally pre-generated random number vector, the encrypted response is decrypted using the accelerated hardware to obtain the query result.

[0057] Fifthly, embodiments of this application provide an electronic device, including: a processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, it implements the steps of an anonymous query method as described in the first or second aspect.

[0058] In a sixth aspect, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of an anonymous query method as described in the first or second aspect.

[0059] In a seventh aspect, embodiments of this application provide a computer program product, including computer instructions, which, when executed by a processor, implement the steps of an anonymous query method as described in the first or second aspect.

[0060] In this embodiment, the original database to be processed is serialized and matrixed, transforming it into a structured two-dimensional data matrix, laying the data foundation for subsequent efficient computation. A random matrix is ​​then dynamically generated based on the size of this matrix, and accelerated hardware is used to preprocess the two-dimensional data matrix and the random matrix offline, yielding a first hint matrix and a second hint matrix, respectively. This step significantly reduces the computational burden during the online query phase. Subsequently, the server sends the second hint matrix and the random matrix to the query client, enabling it to construct a valid encrypted query request based on this information. Upon receiving the encrypted query request generated from the random matrix from the query client, the server utilizes accelerated hardware, combined with the locally stored two-dimensional data matrix, the random matrix, and the pre-computed first hint matrix, to efficiently complete the online query computation, generate an encrypted response, and return it to the query client. The query client finally decrypts the response based on the second hint matrix to obtain the target query result.

[0061] This fully leverages the parallel computing advantages of accelerated hardware while significantly reducing data transfer requirements during the online phase, thereby substantially improving query efficiency and reducing computational and communication complexity. Through the coordinated use of encryption mechanisms and hint matrices, efficient data retrieval is achieved while ensuring query privacy, guaranteeing that user query content is not leaked, and improving the efficiency of anonymous queries while maintaining security. Attached Figure Description

[0062] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0063] Figure 1 A flowchart illustrating an anonymous query method provided in this application embodiment;

[0064] Figure 2 A flowchart illustrating an anonymous query method provided in this application embodiment;

[0065] Figure 3 This is a schematic diagram of the structure of an acceleration hardware provided in an embodiment of this application;

[0066] Figure 4 A structural block diagram of an elusive query device provided in an embodiment of this application;

[0067] Figure 5 A structural block diagram of an elusive query device provided in an embodiment of this application;

[0068] Figure 6 This is a structural block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0069] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0070] Figure 1 This application illustrates an anonymous query method according to an embodiment of the present application. The method is applied to a server, such as... Figure 1 As shown, the method includes:

[0071] Step S101: Perform serialization and matrix processing on the database to be processed to generate a two-dimensional data matrix;

[0072] Step S102: Generate a random matrix based on the size of the two-dimensional data matrix, and perform offline preprocessing on the two-dimensional data matrix and the random matrix based on accelerated hardware to obtain the prompt data;

[0073] The prompt data includes a first prompt matrix and a second prompt matrix;

[0074] Step S103: Send the second hint matrix and the random matrix to the query terminal;

[0075] Step S104: Receive the encrypted query request sent by the query terminal;

[0076] The encrypted query request is generated based on a random matrix;

[0077] Step S105: Based on the accelerated hardware, two-dimensional data matrix, random matrix and first prompt matrix, perform online query calculation on the encrypted query request, generate an encrypted response and return the encrypted response to the query end;

[0078] The query terminal is used to decrypt the encrypted response based on the second hint matrix to obtain the query results.

[0079] It should be noted that this application Figure 1 The illustrated embodiment provides a server-side anonymous query method. Its core lies in achieving efficient and secure data querying through a combination of structured data preprocessing and hardware acceleration technology. First, the database to be processed is transformed into a structurally regular two-dimensional data matrix through serialization and matrix processing, laying the foundation for subsequent calculations. Then, the server generates a random matrix based on the size of this two-dimensional data matrix and performs offline preprocessing on the two-dimensional data matrix and the random matrix using accelerated hardware, generating hint data containing a first hint matrix and a second hint matrix. After preprocessing, the server stores the first hint matrix and sends the second hint matrix and the random matrix to the query client for constructing an encrypted query request. Upon receiving the encrypted query request generated by the query client based on the random matrix, the server uses accelerated hardware and its locally held two-dimensional data matrix, random matrix, and first hint matrix to perform efficient online query calculations, generating an encrypted response and returning it to the query client. The query client can finally decrypt the encrypted response based on the previously obtained second hint matrix to obtain the desired query result.

[0080] In specific application scenarios, the hardware-software collaborative solution proposed in this application first deconstructs homomorphic encryption, and then designs the offline preprocessing and online query process for anonymous queries, taking into account the characteristics of the acceleration hardware. Specifically, the server refers to the party that holds the database and provides data query services in anonymous queries. In this solution, the database held by the server can be a keyword-value database, and it supports querying the corresponding value by keyword. The query party refers to the party that holds the query conditions and obtains the corresponding server data through the query conditions in anonymous queries.

[0081] Furthermore, offline preprocessing is primarily performed by the server. The server can generate random number matrices that meet specific protection conditions and preprocess the data it holds based on the matrix computation capabilities provided by the hardware accelerator card, thus reducing the computational load in the online phase. To make the protocol more suitable for hardware accelerator cards, the protocol provided in this solution reduces the size of the preprocessed data, thereby reducing the amount of data that needs to be exchanged between the host and the server. Therefore, offline matrix precomputation significantly reduces the computational burden in the online phase, effectively improving query efficiency, while relying on encryption technology and matrix operations to ensure the privacy and security of the query process.

[0082] In one possible implementation, serialization and matrix processing of the database to be processed to generate a two-dimensional data matrix includes: inserting values ​​from the database to be processed into a preset one-dimensional data array according to multiple hash functions and the Cuckoo Hash algorithm; calculating the size of the two-dimensional data matrix according to the amount of data in the database to be processed; and mapping the data in the one-dimensional data array to the corresponding positions in the two-dimensional data matrix according to the size.

[0083] It should be noted that this possible implementation discloses the transformation of the original database to be processed into a well-organized, computationally efficient structured form. Specifically, the implementation is as follows: First, using multiple hash functions and the Cuckoo Hash algorithm, the scattered, unstructured data entries (values) in the database are systematically inserted into a pre-defined one-dimensional data array. The Cuckoo Hash algorithm, as an efficient hashing technique, helps reduce collisions and ensures that data is placed completely and evenly when constructing the one-dimensional data array. Then, the system calculates the required size of the final two-dimensional data matrix based on the actual total amount of data in the database. This size determines the number of rows and columns of the matrix, providing a framework for the data transformation from one-dimensional to two-dimensional form. Finally, based on the calculated size of the two-dimensional data matrix, the data from the previously constructed one-dimensional data array is orderly filled into the corresponding rows and columns of the two-dimensional data matrix according to a pre-defined mapping rule.

[0084] In specific application scenarios, the server, for its keyword-value database (assuming the database format is (key1, value1), (key2, value2), ..., (keyn, valuen), establishes a mapping between each keyword and its index. Then, it performs database serialization, arranging the values ​​according to the positions determined by the keys. The specific steps are as follows:

[0085] (1) The server and the query end agree on four hash algorithms h1, h2, h3, and h4;

[0086] (2) The server calculates the hash of each key1 based on h1, h2, h3, h4 to obtain h1(key1), h2(key1), h3(key1), h4(key1);

[0087] (3) Based on h1(key1), h2(key1), h3(key1), and h4(key1), insert data into key1. If two or more of the positions corresponding to the four hashes h1(key1), h2(key1), h3(key1), and h4(key1) (assuming the obtained hash value is e10adc3949ba59abbe56e057f20f883e, then place it in the e10adc3949ba59abbe56e057f20f883e position) are empty, then place it in the corresponding position. Choose a position to insert the value; if one of the four hashes h1(key1), h2(key1), h3(key1), and h4(key1) is empty, insert the corresponding value into the empty position; if none of the four hashes are empty, remove one of the four hashes and insert the value. For the removed value, repeat the above steps to find another position, and repeat until the insertion is successful.

[0088] The server further processes the serialized database into a data matrix (db), as follows:

[0089] (1) Calculate L = Ceil(√n). Where √ represents the square root, n is the number of data in the database, and Ceil is the rounding up.

[0090] (2) According to the sequence number of each row in the database obtained in step (1), the position of the row in the data matrix form database is obtained. Assuming that the sequence number of a certain data value is M, the row sequence number of the data in the data matrix form database is C=Floor(M / L), and the column sequence number of the data is R=M%L, where " / " is division calculation, Floor is rounding down, and % is taking the remainder;

[0091] (3) Based on the row number C and column number R, store the corresponding value into the corresponding position of the data matrix. After all rows of data are completed, the database in the form of a data matrix can be obtained, denoted as db.

[0092] Overall, the effect of this process is to reorganize an unordered database into a structured two-dimensional data matrix. This transformation not only lays a solid foundation for subsequent matrix operations, but also greatly optimizes the data retrieval path and efficiency.

[0093] In one possible implementation, a random matrix is ​​generated based on the size of the two-dimensional data matrix. The two-dimensional data matrix and the random matrix are preprocessed offline using accelerated hardware to obtain the prompt data, which includes: generating a first random matrix and a second random matrix based on the size of the two-dimensional data matrix; calculating the product of the first random matrix and the two-dimensional data matrix on the accelerated hardware to obtain a first prompt matrix; calculating the product of the first prompt matrix and the second random matrix on the accelerated hardware to obtain a second prompt matrix; and determining the first prompt matrix and the second prompt matrix as the prompt data.

[0094] For example, in a specific application scenario (the application scenario is the same as the application scenario in the above possible implementation methods), the server generates random number matrices A1 (first random matrix) and A2 (second random matrix) that meet the requirements according to the parameters of the matrix database (i.e., two-dimensional data matrix). The length of A1 and A2 is L, and the width is arbitrarily set as a random number k.

[0095] Furthermore, the server-side preprocesses the data in vector form based on a random number matrix and matrix multiplication operations using the accelerator card, obtaining preprocessed data `hintc` and `hints`. The preprocessing calculation method is `hints = A1 × db`; `hintc = hints × A2`, where the length of A1 and A2 is L, consistent with the number of rows in the two-dimensional database. Here, the accelerator card refers to the acceleration hardware, `hints` is equivalent to the first hint matrix, and `hintc` is equivalent to the second hint matrix.

[0096] Furthermore, in step S103, sending the second hint matrix and the random matrix to the query end is equivalent to the server sending the preprocessed data hintc, the random number matrices A1 and A2 to the query end. The query end saves the preprocessed hintc, the random number matrices A1 and A2 (details will be explained on the query end side later).

[0097] It's important to note that the core of this possible implementation lies in the server-side utilizing accelerated hardware to perform a series of offline matrix pre-computations to generate key hint data for optimizing subsequent online queries. This process begins by generating two random matrices, a first and a second, that match the external dimensions of the constructed two-dimensional data matrix. The elements of these random matrices are composed of random numbers, introducing the necessary randomness and security for encryption throughout the process. Next, the server leverages the powerful parallel computing capabilities of the accelerated hardware (such as a GPU or FPGA) to perform a multiplication operation between the first random matrix and the two-dimensional data matrix. The result of this calculation is defined as the first hint matrix. Subsequently, on the accelerated hardware, using the newly obtained first hint matrix as input, it is multiplied again with the second random matrix to generate the second hint matrix. Finally, the calculated first and second hint matrices are combined to determine the complete hint data. Overall, the effect of this offline preprocessing stage is that it pre-computes the most computationally intensive matrix operations, transforming the original database (two-dimensional data matrix) and random factors (first random matrix and second random matrix) into two refined hint matrices. This means that during subsequent online queries, the server no longer needs to directly operate on the massive original database, but only needs to use these pre-computed hint data for lightweight operations, greatly reducing the pressure on real-time computing.

[0098] In one possible implementation, the encrypted query request includes: a first query ciphertext encrypted based on a first random matrix and a second query ciphertext encrypted based on a second random matrix; performing online query calculations on the encrypted query request based on accelerated hardware, a two-dimensional data matrix, a random matrix, and a first hint matrix, generating an encrypted response, and returning the encrypted response to the query end includes: calculating the product of the transpose of the first query ciphertext and the transpose of the two-dimensional data matrix on the accelerated hardware to obtain a first response vector; calculating the product of the first response vector and the second random matrix on the accelerated hardware to obtain a second response vector; concatenating the first hint matrix and the first response vector on the accelerated hardware, and calculating the product of the concatenated result and the second query ciphertext to obtain an encrypted result; and returning the second response vector and the encrypted result as an encrypted response to the query end.

[0099] It should be noted that this possible implementation details how the server, upon receiving an encrypted query request from the querying client, utilizes accelerated hardware and pre-prepared data to perform online query computation, efficiently generating an encrypted response. The encrypted query request specifically comprises two components: a first ciphertext encrypted based on a first random matrix and a second ciphertext encrypted based on a second random matrix. The server's computation begins by invoking the accelerated hardware, first calculating the matrix product between the transpose of the first ciphertext and the transpose of the two-dimensional data matrix. The output of this operation is defined as the first response vector. Subsequently, the accelerated hardware continues to use the obtained first response vector as input, multiplying it by the second random matrix to generate the second response vector. In parallel or subsequent steps, the accelerated hardware also performs another crucial operation: concatenating the pre-calculated and locally stored first hint matrix with the previously obtained first response vector to form a joint matrix. Then, it calculates the product of this joint matrix and the second ciphertext in the encrypted query request. The final output of this step is defined as the encrypted result. Finally, the server packages the second response vector generated during this calculation process together with the encryption result, determines it as the final encrypted response, and returns this encrypted response to the query client.

[0100] Overall, the server fully leverages the parallel computing capabilities of the accelerated hardware, transforming complex query processing into efficient computational steps through a series of linear operations centered on matrix multiplication. This avoids expensive operations such as real-time homomorphic encryption, significantly reducing latency during the online phase, while ensuring the security of the response content, as the entire computation is performed in encrypted or protected data formats, without revealing any original database information or query intent.

[0101] It should be noted that the accelerated hardware stores input data in its own global memory; divides the input data into multiple data blocks according to the capacity of its shared memory; loads the data blocks from global memory into shared memory; splits the data blocks into sub-blocks according to the number of its registers, and loads the sub-blocks from shared memory into their respective registers; performs operations on its respective sub-blocks in parallel in each register to obtain the corresponding operation results; writes the operation results corresponding to each register back to shared memory for integration; and writes the integrated final result from shared memory back to global memory to complete the calculation of the input data. For example, in the step of generating a random matrix based on the size of the two-dimensional data matrix, performing offline preprocessing on the two-dimensional data matrix and the random matrix based on the accelerated hardware to obtain prompt data, the input data is the two-dimensional data matrix and the random matrix; in the step of performing online query calculation on the encrypted query request based on the accelerated hardware, the two-dimensional data matrix, the random matrix, and the first prompt matrix to generate an encrypted response, the input data is the two-dimensional data matrix, the random matrix, the first prompt matrix, and the encrypted query request.

[0102] It should be noted that this possible implementation details the internal data processing flow and architectural advantages of the accelerated hardware when performing computational tasks. The computation process begins by storing the input data to be processed into the accelerated hardware's own global memory, which has a large capacity but relatively high access latency. To efficiently utilize computing resources, the accelerated hardware then divides the input data stored in the global memory into multiple appropriately sized data blocks, based on the limited capacity of its own shared memory. These data blocks are then loaded from the global memory into the faster-access shared memory to achieve more efficient data reuse.

[0103] Furthermore, to maximize parallel computing capabilities, the accelerator hardware further subdivides each data block into smaller sub-blocks based on the capacity of its numerous internal registers, and loads these sub-blocks from shared memory into their respective independent registers. Once the data is in place, each register can execute the computation task assigned to its sub-block in parallel and independently, obtaining the corresponding computation result. After the computation at the register level is completed, the computation results corresponding to each register are written back to shared memory for preliminary integration and summarization. Finally, the integrated complete result is written back from shared memory to global memory, marking the formal completion of the computation task on the input data.

[0104] Overall, the effectiveness of this process lies in fully leveraging the unique hierarchical storage system (global memory-shared memory-registers) and parallel computing capabilities of the accelerated hardware. By intelligently segmenting large data blocks and progressively loading them into faster memory layers closer to the computing units, and achieving extreme parallelism at the lowest level of registers, this design significantly reduces the number of direct data accesses in the vast and slow global memory. This effectively avoids data movement bottlenecks, concentrates computing resources on parallel computation itself, and significantly improves overall computing throughput and efficiency. The method shown in this application's embodiment utilizes this capability of the accelerated hardware to achieve efficient data retrieval while ensuring query privacy, ensuring that user query content is not leaked, and improving the efficiency of anonymous queries while maintaining security.

[0105] In this embodiment, the original database to be processed is serialized and matrixed, transforming it into a structured two-dimensional data matrix, laying the data foundation for subsequent efficient computation. A random matrix is ​​then dynamically generated based on the size of this matrix, and accelerated hardware is used to preprocess the two-dimensional data matrix and the random matrix offline, yielding a first hint matrix and a second hint matrix, respectively. This step significantly reduces the computational burden during the online query phase. Subsequently, the server sends the second hint matrix and the random matrix to the query client, enabling it to construct a valid encrypted query request based on this information. Upon receiving the encrypted query request generated from the random matrix from the query client, the server utilizes accelerated hardware, combined with the locally stored two-dimensional data matrix, the random matrix, and the pre-computed first hint matrix, to efficiently complete the online query computation, generate an encrypted response, and return it to the query client. The query client finally decrypts the response based on the second hint matrix to obtain the target query result.

[0106] For example, existing acceleration hardware such as FPGAs, GPUs, or DCUs (Deep Computing Units) possess good parallel computing capabilities, but their internal storage exhibits multi-layered characteristics. Taking GPUs or DCUs as an example, such as... Figure 3 As shown, this includes global memory, shared memory, registers, etc. Global memory has the largest capacity on the GPU but the highest access latency, while shared memory has a smaller capacity but high bandwidth. Threads within the same thread block can share access, often used for inter-thread communication. Registers offer the fastest access speed but are limited in number; excessive use can cause registers to overflow into local memory. Therefore, the method shown in this embodiment is specifically designed based on the characteristics of the hardware accelerator card. Taking step S102, generating a random matrix based on the size of the two-dimensional data matrix, and performing offline preprocessing on the two-dimensional data matrix and the random matrix based on the accelerator hardware to obtain the prompt data, as an example, the specific implementation steps based on the accelerator card are as follows:

[0107] (1) Taking hints=A1×db as an example, the server stores the full amount of preprocessed random matrix A1 and db into the global memory of the accelerator card;

[0108] (2) Split A1 and db in global memory according to the storage space ratio of global memory and shared memory of the current accelerated hardware to obtain sub-matrices A11,...,A1n and db1,...,dbn. Assuming the storage space ratio is n, divide them into n sub-matrix slices respectively. Then obtain the storage status of shared memory. If there are empty positions, write the sub-matrix slices A11,...,A1n and db1,...,dbn into shared memory one by one according to the processing order.

[0109] (3) Split the A1n and dbn currently stored in the shared memory according to the number of registers in the current acceleration hardware (assuming it is m) to obtain A1n1,...,A1nm and dbn1,...,dbnm, and then store A1ni and dbni (i=1~m) into a register i according to the index value;

[0110] (4) Perform scalar multiplication-accumulation instructions of length 1 in each of the m registers of the accelerator card to obtain the calculation results of each part;

[0111] (5) Read the calculation results in the register from the accelerator card, and then fill them into the corresponding positions of the result matrix according to the subscripts to obtain the matrix calculation results.

[0112] This fully leverages the parallel computing advantages of accelerated hardware while significantly reducing data transfer requirements during the online phase, thereby substantially improving query efficiency and reducing computational and communication complexity. Through the coordinated use of encryption mechanisms and hint matrices, efficient data retrieval is achieved while ensuring query privacy, guaranteeing that user query content is not leaked, and improving the efficiency of anonymous queries while maintaining security.

[0113] Figure 2 This paper illustrates an anonymous query method according to an embodiment of this application. The method is applied to the query end, such as... Figure 2 As shown, the method includes:

[0114] Step S201: Receive the second prompt matrix and the random matrix from the server;

[0115] The random matrix is ​​generated by the server after processing the database to be processed to generate a two-dimensional data matrix, and the second prompt matrix is ​​generated by the server using acceleration hardware to calculate the two-dimensional data matrix and the random matrix.

[0116] Step S202: Obtain the query keywords entered by the user;

[0117] Step S203: Based on the query keywords and the random matrix, generate an encrypted query request using accelerated hardware and send the encrypted query request to the server.

[0118] Step S204: Receive the encrypted response returned by the server based on the encrypted query request;

[0119] Step S205: Based on the second hint matrix and the locally pre-generated random number vector, use accelerated hardware to decrypt the encrypted response and obtain the query result.

[0120] It should be noted that the embodiments of this application also provide an anonymous query method applied to the query end, such as... Figure 2 As shown, this method works in conjunction with server-side operations to form a complete privacy query mechanism. Therefore, for Figure 2 For specific instructions regarding the server side, please refer to the documentation. Figure 1 The following is an explanation of the method embodiment shown. The query terminal first receives a second hint matrix and a random matrix from the server. It should be noted that this random matrix is ​​generated by the server after performing serialization and matrix processing on its own stored database to be processed to generate a two-dimensional data matrix, and then generating the random matrix according to the size of the two-dimensional data matrix. The second hint matrix is ​​the result of the server using accelerated hardware to perform a series of offline calculations on the above two-dimensional data matrix and this random matrix.

[0121] After receiving the user's input query keywords, the core operation of the query client is to generate an encrypted query request based on the query keywords and a random matrix received from the server, utilizing the powerful parallel computing capabilities of the accelerated hardware. This encrypted query request is then sent to the server. Next, the query client waits for and receives an encrypted response from the server after performing online query calculations based on the encrypted query request. Finally, the query client does not directly read this response; instead, it needs to use the second hint matrix obtained from the server and its own pre-generated random number vector to perform decryption calculations on the encrypted response again, with the help of the accelerated hardware, to finally obtain the query result requested by the user.

[0122] Overall, by utilizing the pre-calculated and distributed hint data (second hint matrix and random matrix) from the server, the query client can generate encrypted query requests and decrypt responses with extremely high efficiency. The computation throughout the online phase avoids traditional complex cryptographic operations, instead relying on efficient matrix operations and the parallel capabilities of accelerated hardware. This ensures that the query content (query keywords) and results are completely anonymous to the server, while achieving a low-latency and high-efficiency query experience.

[0123] In one possible implementation, generating an encrypted query request using accelerated hardware based on the query keyword and a random matrix includes: determining the target index of the query keyword in a pre-defined one-dimensional data array on the server according to a hash mapping rule agreed upon with the server; converting the target index into target row and column numbers in the two-dimensional data matrix according to the size agreed upon with the server; generating row selection vectors and column selection vectors based on the target row and column numbers; encrypting the column selection vectors and row selection vectors using accelerated hardware based on the random matrix and locally pre-generated random number vectors, error vectors, and ciphertext modulus, respectively, to generate a first ciphertext and a second ciphertext, and combining the first ciphertext and the second ciphertext to form an encrypted query request.

[0124] It should be noted that this possible implementation details the process by which the query end uses a random matrix obtained from the server and local parameters to generate an encrypted query request. The entire process begins with the query end processing the user-input query keywords according to a pre-agreed hash mapping rule between the query end and the server to determine the unique target index corresponding to the keyword in a pre-constructed one-dimensional data array on the server. Subsequently, based on the pre-agreed dimensions of the two-dimensional data matrix, the target index is precisely converted into two-dimensional coordinates, that is, its specific target row and column numbers in the two-dimensional data matrix are determined.

[0125] Based on the determined target row and column numbers, the query client needs to generate two selection vectors: one for precise positioning in the row dimension, called the row selection vector; and the other for precise positioning in the column dimension, called the column selection vector. Finally, based on the random matrix received from the server and combined with a series of cryptographic parameters such as the locally pre-generated random number vector, error vector, and ciphertext modulus, the query client utilizes the parallel computing capabilities of the accelerated hardware to perform encryption operations on both the column and row selection vectors. This encryption process produces two corresponding ciphertext results: a first query ciphertext encrypted based on the first random matrix and a second query ciphertext encrypted based on the second random matrix. Finally, the first and second query ciphertexts are combined to form a complete encrypted query request.

[0126] Overall, a clear query intent (keyword) can be transformed into an encrypted request that cannot be cracked by the server, thus enabling anonymous queries. By transforming simple index selection into a complex ciphertext vector and introducing noise factors such as random matrices, random number vectors, and error vectors, the privacy of the query content can be ensured. Meanwhile, its core computation is efficiently completed by accelerated hardware, balancing security and performance.

[0127] In one possible implementation, the encrypted response includes: a second response vector received from the server and an encrypted result; the random number vector includes a first random number vector and a second random number vector; decrypting the encrypted response using accelerated hardware based on a second hint matrix and a locally pre-generated random number vector to obtain the query result includes: calculating a first auxiliary value using the second hint matrix and the second random number vector; calculating a second auxiliary value using the received second response vector and the second random number vector; dividing the encrypted result into a first part and a second part; performing decryption calculations using accelerated hardware based on the first part, the second part, the first auxiliary value, the second auxiliary value, and the first random number vector to obtain an approximate result; and decoding the approximate result to restore the query result.

[0128] It should be noted that this possible implementation details how the query client, after receiving the encrypted response from the server, utilizes its local information to complete the final decryption process. The encrypted response comprises two components: a second response vector and the encryption result. Simultaneously, the query client pre-generates a random number vector locally, including a first random number vector and a second random number vector. The decryption process begins with the query client using the second hint matrix previously obtained from the server and its local second random number vector to calculate a first auxiliary value; in parallel, it uses the second response vector received from the server and its local second random number vector to calculate a second auxiliary value. Subsequently, the received encrypted result is structurally divided into a first part and a second part.

[0129] Based on this, the query client uses the first part of the encrypted result, the second part of the encrypted result, the calculated first auxiliary value, the calculated second auxiliary value, and the locally pre-generated first random number vector to invoke the parallel computing capabilities of the accelerated hardware to perform the core decryption calculation. The result of this calculation is an approximation. Finally, the query client needs to perform a final decoding operation on this approximate result to accurately restore the true query result requested by the user.

[0130] Overall, through a series of operations, the random noise and matrix transformation effects introduced during the encryption process are offset. Its design makes full use of the correspondence between the pre-shared second hint matrix and the local random vector, enabling the query end to extract the plaintext result from the complex encryption response efficiently and accurately. The entire decryption process also benefits from the parallel optimization of the acceleration hardware, ensuring the ultimate performance and ultimately achieving a balance between security and efficiency.

[0131] In this embodiment, the original database to be processed is serialized and matrixed, transforming it into a structured two-dimensional data matrix, laying the data foundation for subsequent efficient computation. A random matrix is ​​then dynamically generated based on the size of this matrix, and accelerated hardware is used to preprocess the two-dimensional data matrix and the random matrix offline, yielding a first hint matrix and a second hint matrix, respectively. This step significantly reduces the computational burden during the online query phase. Subsequently, the server sends the second hint matrix and the random matrix to the query client, enabling it to construct a valid encrypted query request based on this information. Upon receiving the encrypted query request generated from the random matrix from the query client, the server utilizes accelerated hardware, combined with the locally stored two-dimensional data matrix, the random matrix, and the pre-computed first hint matrix, to efficiently complete the online query computation, generate an encrypted response, and return it to the query client. The query client finally decrypts the response based on the second hint matrix to obtain the target query result.

[0132] This fully leverages the parallel computing advantages of accelerated hardware while significantly reducing data transfer requirements during the online phase, thereby substantially improving query efficiency and reducing computational and communication complexity. Through the coordinated use of encryption mechanisms and hint matrices, efficient data retrieval is achieved while ensuring query privacy, guaranteeing that user query content is not leaked, and improving the efficiency of anonymous queries while maintaining security.

[0133] From the perspective of specific application scenarios, this application describes the anonymous query method applied to the query end side, as shown in the embodiments of this application. During the online query phase, the query end and the server end complete the anonymous query process based on their respective preprocessed data and random matrix. The specific protocol is as follows:

[0134] 1. The query client holds the query condition key_query (equivalent to the query keyword). First, following the same processing method as the server in the offline stage, it obtains the corresponding query_index (target index). Then, it takes query_index_col = Floor(query_index / L), and the column index of this row is query_index_row = query_index%L, where " / " represents division, Floor is rounded down, % is the remainder, and L = Ceil(√n). Here, √ represents the square root, n is the number of data in the database, and Ceil is rounded up.

[0135] 2. The query end generates random number vectors s1 and s2 (s1 is the first random number vector and s2 is the second random number vector), as well as random number vectors e1 and e2 that conform to Gaussian distribution (equivalent to error vectors), and the ciphertext space modulus q of LWE (Learning With Errors) (equivalent to ciphertext modulus).

[0136] 3. The query end processes query_index_col (column selection vector) and query_index_row (row selection vector) based on the matrix multiplication operation of random matrices A1 and A2 and the accelerator card to obtain ciphertext query c1 (first ciphertext query) and c2 (second ciphertext query), and then organizes them into query_crypt (encrypted query request).

[0137] The specific processing method is as follows: c1 = A1 × s1 + e1 + Floor(q / p) × u_col, c2 = A2 × s2 + e2 + Floor(q / p) × u_row, where p is the value modulus of the database stored data; u_col is a vector of length L with only the query_index_col position being 1 and all other positions being 0; u_row is a vector of length L with only the query_index_row position being 1 and all other positions being 0. (This generates a vector composed of ciphertext consisting of 0s and 1s. Since the random number vectors s1 and s2 (actually playing the role of the private key) are generated and stored locally by the query end, the other party (server) cannot deduce from the ciphertext vector which ciphertext corresponds to which plaintext is 0 or 1, and therefore cannot know the keyword position.) The matrix multiplication and matrix addition calculations in this step refer to the calculation steps in the preprocessing steps, and will not be repeated here.

[0138] 4. The query terminal sends query_crypt, composed of encrypted query c1 and c2, to the server.

[0139] 5. The server decomposes the ciphertext query data query_crypt into c1 and c2, then takes the c1 part and performs parallel matrix multiplication with the database db based on the accelerator card to obtain ans1=c1TdbT (equivalent to the query end calculating the product of the transpose of the first query ciphertext and the transpose of the two-dimensional data matrix on the accelerator hardware to obtain the first response vector).

[0140] 6. The server performs matrix multiplication on ans1 based on the accelerator card and matrix A2 generated in the preprocessing stage to obtain h = ans1 × A2 (equivalent to the server calculating the product of the first response vector and the second random matrix on the accelerator hardware to obtain the second response vector).

[0141] 7. The server concatenates the hints obtained in the preprocessing stage with ans1 to obtain the corresponding data matrix. Then, based on the accelerator card, it performs matrix multiplication with c2 to obtain ans = [hints, ans1] × c2; (equivalent to the server concatenating the first hint matrix and the first response vector on the acceleration hardware, and calculating the product of the concatenated result and the second query ciphertext to obtain the encrypted result). At the same time, the query end performs matrix multiplication based on the accelerator card, multiplying the preprocessed data hintc with s2 to obtain AN1 = hintc × s2. This is equivalent to the query end using the second hint matrix and the second random number vector to calculate the first auxiliary value.

[0142] 8. The server sends vectors h and ans to the query client (equivalent to the server sending the second response vector and the encrypted result as an encrypted response and returning the encrypted response to the query client).

[0143] 9. The query terminal uses matrix multiplication based on the accelerator card to calculate AN2 = h × s2 by multiplying h and s2. Then, it calculates ans1 - AN1 and ans2 - AN2 respectively. Here, ans1 and ans2 are the first and second halves of ans, which are separated by the length of AN1, respectively.

[0144] 10. The query terminal calculates (ans2-AN2)-s1×(ans1-AN1) to obtain the query result.

[0145] It should be noted that steps 9 and 10 are equivalent to the query end using the second prompt matrix and the second random number vector to calculate the first auxiliary value; and using the received second response vector and the second random number vector to calculate the second auxiliary value; dividing the encrypted result into a first part and a second part; and using accelerated hardware to perform decryption calculation based on the first part, the second part, the first auxiliary value, the second auxiliary value, and the first random number vector to obtain an approximate result; and decoding the approximate result to restore the query result.

[0146] In this embodiment, the original database to be processed is serialized and matrixed, transforming it into a structured two-dimensional data matrix, laying the data foundation for subsequent efficient computation. A random matrix is ​​then dynamically generated based on the size of this matrix, and accelerated hardware is used to preprocess the two-dimensional data matrix and the random matrix offline, yielding a first hint matrix and a second hint matrix, respectively. This step significantly reduces the computational burden during the online query phase. Subsequently, the server sends the second hint matrix and the random matrix to the query client, enabling it to construct a valid encrypted query request based on this information. Upon receiving the encrypted query request generated from the random matrix from the query client, the server utilizes accelerated hardware, combined with the locally stored two-dimensional data matrix, the random matrix, and the pre-computed first hint matrix, to efficiently complete the online query computation, generate an encrypted response, and return it to the query client. The query client finally decrypts the response based on the second hint matrix to obtain the target query result.

[0147] This fully leverages the parallel computing advantages of accelerated hardware while significantly reducing data transfer requirements during the online phase, thereby substantially improving query efficiency and reducing computational and communication complexity. Through the coordinated use of encryption mechanisms and hint matrices, efficient data retrieval is achieved while ensuring query privacy, guaranteeing that user query content is not leaked, and improving the efficiency of anonymous queries while maintaining security.

[0148] Figure 4 An anonymous query device according to an embodiment of this application is shown, such as... Figure 4 As shown, the device is used on the server side, and device 40 includes:

[0149] The generation module 401 is used to perform serialization and matrix processing on the database to be processed, and generate a two-dimensional data matrix.

[0150] The first execution module 402 is used to generate a random matrix according to the size of the two-dimensional data matrix, and to perform offline preprocessing on the two-dimensional data matrix and the random matrix based on the acceleration hardware to obtain prompt data, wherein the prompt data includes a first prompt matrix and a second prompt matrix;

[0151] Send the second hint matrix and the random matrix to the query end;

[0152] Receive encrypted query requests sent by the query client, wherein the encrypted query requests are generated based on a random matrix;

[0153] Based on accelerated hardware, a two-dimensional data matrix, a random matrix, and a first hint matrix, an online query calculation is performed on the encrypted query request to generate an encrypted response and return it to the query end. The query end is used to decrypt the encrypted response based on a second hint matrix to obtain the query result.

[0154] In one possible implementation, the generation module 401 is also used to insert the values ​​in the database to be processed into a preset one-dimensional data array according to multiple hash functions and the Cuckoo Hash algorithm;

[0155] Calculate the size of the two-dimensional data matrix based on the amount of data in the database to be processed;

[0156] Based on the size, the data in the one-dimensional data array is mapped to the corresponding position in the two-dimensional data matrix.

[0157] In one possible implementation, the first execution module 402 is further configured to generate a first random matrix and a second random matrix based on the size of the two-dimensional data matrix;

[0158] The first prompt matrix is ​​obtained by multiplying the first random matrix and the two-dimensional data matrix on the accelerated hardware.

[0159] The product of the first cue matrix and the second random matrix is ​​calculated on the accelerated hardware to obtain the second cue matrix;

[0160] The first and second prompt matrices are determined as the prompt data.

[0161] In one possible implementation, the encrypted query request includes: a first query ciphertext encrypted based on a first random matrix and a second query ciphertext encrypted based on a second random matrix; the first execution module 402 is further configured to calculate the product of the transpose of the first query ciphertext and the transpose of the two-dimensional data matrix on the acceleration hardware to obtain a first response vector;

[0162] The second response vector is obtained by multiplying the first response vector and the second random matrix on the accelerated hardware.

[0163] On the acceleration hardware, the first prompt matrix and the first response vector are concatenated, and the product of the concatenated result and the second query ciphertext is calculated to obtain the encryption result;

[0164] The second response vector and the encrypted result are used as an encrypted response, which is then returned to the query end.

[0165] It should be noted that the stealth query scheme based on matrix computation shown in this application differs from common stealth query schemes based on homomorphic encryption. This scheme decomposes the encryption process down to atomic calculations such as matrix data multiplication and matrix data addition. Therefore, it is more suitable for accelerating stealth computations using the general matrix operation capabilities provided by FPGA, GPU, or DCU acceleration hardware. It eliminates the need for hardware acceleration methods for homomorphic encryption, such as modular exponentiation and NTT (Number Theoretic Transform), thus improving the acceleration effect and the hardware applicability. The specific improvement depends on the type and configuration of the acceleration hardware. FPGA and DCU provide dedicated parallel acceleration methods for matrix multiplication, but the number and parallelism vary.

[0166] This application proposes a stealth solution suitable for parallel acceleration methods of matrix multiplication using FPGA and DCU. Based on general experience, for matrix multiplication, the acceleration hardware can achieve performance improvements of tens of times compared to the CPU. Furthermore, in the stealth query method proposed in this solution, the preprocessing stage reduces the computational load required in the online phase, and the preprocessing data and online interaction data are both relatively small, avoiding performance degradation of the accelerator card during data transfer and ensuring the performance of the accelerator card.

[0167] Figure 5 An anonymous query device according to an embodiment of this application is shown, such as... Figure 5 As shown, the device is used in the query terminal, and device 50 includes:

[0168] The receiving module 501 is used to receive a second prompt matrix and a random matrix from the server. The random matrix is ​​generated by the server after processing the database to be processed to generate a two-dimensional data matrix. The second prompt matrix is ​​obtained by the server using acceleration hardware to calculate the two-dimensional data matrix and the random matrix.

[0169] The second execution module 502 is used to obtain the query keywords input by the user;

[0170] Based on the query keywords and a random matrix, an encrypted query request is generated using accelerated hardware and sent to the server.

[0171] Receive the encrypted response returned by the server based on the encrypted query request;

[0172] Based on the second hint matrix and the locally pre-generated random number vector, the encrypted response is decrypted using accelerated hardware to obtain the query result.

[0173] In one possible implementation, the second execution module 502 is used to determine the target index of the query keyword in a preset one-dimensional data array on the server according to a hash mapping rule pre-agreed with the server.

[0174] Based on the dimensions of the two-dimensional data matrix pre-agreed with the server, the target index is converted into the target row number and target column number in the two-dimensional data matrix;

[0175] Generate row selection vectors and column selection vectors based on the target row number and target column number, respectively;

[0176] Based on the random matrix and locally pre-generated random number vector, error vector and ciphertext modulus, the column selection vector and row selection vector are encrypted using accelerated hardware to generate the first query ciphertext and the second query ciphertext respectively. The first query ciphertext and the second query ciphertext are combined to form an encrypted query request.

[0177] In one possible implementation, the encrypted response includes: a second response vector received from the server and an encryption result; the random number vector includes a first random number vector and a second random number vector; the second execution module 502 is further configured to calculate a first auxiliary value using a second prompt matrix and the second random number vector; and to calculate a second auxiliary value using the received second response vector and the second random number vector.

[0178] The encrypted result is divided into a first part and a second part;

[0179] Based on the first part, the second part, the first auxiliary value, the second auxiliary value, and the first random number vector, decryption calculations are performed using accelerated hardware to obtain an approximate result.

[0180] Decode the approximate result to restore the query result.

[0181] In this embodiment, the original database to be processed is serialized and matrixed, transforming it into a structured two-dimensional data matrix, laying the data foundation for subsequent efficient computation. A random matrix is ​​then dynamically generated based on the size of this matrix, and accelerated hardware is used to preprocess the two-dimensional data matrix and the random matrix offline, yielding a first hint matrix and a second hint matrix, respectively. This step significantly reduces the computational burden during the online query phase. Subsequently, the server sends the second hint matrix and the random matrix to the query client, enabling it to construct a valid encrypted query request based on this information. Upon receiving the encrypted query request generated from the random matrix from the query client, the server utilizes accelerated hardware, combined with the locally stored two-dimensional data matrix, the random matrix, and the pre-computed first hint matrix, to efficiently complete the online query computation, generate an encrypted response, and return it to the query client. The query client finally decrypts the response based on the second hint matrix to obtain the target query result.

[0182] This fully leverages the parallel computing advantages of accelerated hardware while significantly reducing data transfer requirements during the online phase, thereby substantially improving query efficiency and reducing computational and communication complexity. Through the coordinated use of encryption mechanisms and hint matrices, efficient data retrieval is achieved while ensuring query privacy, guaranteeing that user query content is not leaked, and improving the efficiency of anonymous queries while maintaining security.

[0183] This application provides an electronic device 60, such as... Figure 6 As shown, the electronic device 60 includes a processor 601, a memory 602, and a program stored in the memory 602 and executable on the processor 601. When the program is executed by the processor 601, it implements the steps of a stealth query method as shown in the above embodiment.

[0184] This application also provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the steps of the stealth query method shown in the above embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0185] This application also provides a computer program product, including computer instructions. When executed by a processor, the computer instructions implement the steps of the stealth query method shown in the above embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0186] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0187] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0188] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A method of anonymous querying, the method comprising: The method is applied to the server side, and the method includes: The database to be processed is serialized and matrix-processed to generate a two-dimensional data matrix. A random matrix is ​​generated based on the size of the two-dimensional data matrix. The two-dimensional data matrix and the random matrix are preprocessed offline using accelerated hardware to obtain prompt data, wherein the prompt data includes a first prompt matrix and a second prompt matrix. Send the second hint matrix and the random matrix to the query terminal; Receive an encrypted query request sent by the query terminal, wherein the encrypted query request is generated based on the random matrix; Based on the acceleration hardware, the two-dimensional data matrix, the random matrix, and the first prompt matrix, the encrypted query request is calculated online to generate an encrypted response and return the encrypted response to the query terminal. The query terminal is used to decrypt the encrypted response based on the second prompt matrix to obtain the query result. Specifically, a random matrix is ​​generated based on the size of the two-dimensional data matrix. The two-dimensional data matrix and the random matrix are then preprocessed offline using accelerated hardware to obtain prompt data, including: Generate a first random matrix and a second random matrix based on the size of the two-dimensional data matrix; The product of the first random matrix and the two-dimensional data matrix is ​​calculated on the acceleration hardware to obtain the first prompt matrix; The product of the first cue matrix and the second random matrix is ​​calculated on the acceleration hardware to obtain the second cue matrix; The first prompt matrix and the second prompt matrix are determined as the prompt data.

2. The method of claim 1, wherein, The database to be processed undergoes serialization and matrix processing to generate a two-dimensional data matrix, including: Based on multiple hash functions and the Cuckoo Hash algorithm, the values ​​in the database to be processed are inserted into a preset one-dimensional data array; Calculate the size of the two-dimensional data matrix based on the amount of data in the database to be processed; Based on the stated dimensions, the data in the one-dimensional data array is mapped to the corresponding positions in the two-dimensional data matrix.

3. The method of claim 1, wherein, The encrypted query request includes: a first query ciphertext encrypted based on the first random matrix and a second query ciphertext encrypted based on the second random matrix; online query calculation is performed on the encrypted query request based on the accelerated hardware, the two-dimensional data matrix, the random matrix, and the first hint matrix to generate an encrypted response and return the encrypted response to the query end, including: The first response vector is obtained by multiplying the transpose of the first query ciphertext with the transpose of the two-dimensional data matrix on the acceleration hardware. The product of the first response vector and the second random matrix is ​​calculated on the acceleration hardware to obtain the second response vector; On the acceleration hardware, the first prompt matrix and the first response vector are concatenated, and the product of the concatenated result and the second query ciphertext is calculated to obtain the encryption result; The second response vector and the encryption result are used as the encryption response, and the encryption response is returned to the query terminal.

4. A method of anonymous querying, the method comprising: The method is applied to the query end, and the method includes: The server receives a second prompt matrix and a random matrix. The random matrix is ​​generated by the server after processing its own database of unprocessed data to generate a two-dimensional data matrix. The second prompt matrix is ​​obtained by the server using acceleration hardware to calculate the two-dimensional data matrix and the random matrix. Get the user's input search keywords; Based on the query keywords and the random matrix, an encrypted query request is generated using accelerated hardware, and the encrypted query request is sent to the server. Receive the encrypted response returned by the server based on the encrypted query request; Based on the second hint matrix and the locally pre-generated random number vector, the encrypted response is decrypted using the accelerated hardware to obtain the query result.

5. The method of claim 4, wherein, Based on the query keyword and the random matrix, an encrypted query request is generated using accelerated hardware, including: Based on the hash mapping rules pre-agreed with the server, the target index of the query keyword in the one-dimensional data array preset in the server is determined; Based on the size of the two-dimensional data matrix pre-agreed with the server, the target index is converted into the target row number and target column number in the two-dimensional data matrix; Based on the target row number and the target column number, generate a row selection vector and a column selection vector respectively; Based on the random matrix and the locally pre-generated random number vector, error vector, and ciphertext modulus, the column selection vector and the row selection vector are encrypted using the acceleration hardware to generate a first query ciphertext and a second query ciphertext, respectively. The first query ciphertext and the second query ciphertext are then combined to form the encrypted query request.

6. The method according to claim 5, characterized in that, The encrypted response includes: a second response vector received from the server and an encryption result; the random number vector includes a first random number vector and a second random number vector; based on the second hint matrix and the locally pre-generated random number vector, the encrypted response is decrypted using the acceleration hardware to obtain a query result, including: Using the second prompt matrix and the second random number vector, calculate the first auxiliary value; and using the received second response vector and the second random number vector, calculate the second auxiliary value. The encryption result is divided into a first part and a second part; Based on the first part, the second part, the first auxiliary value, the second auxiliary value, and the first random number vector, the accelerated hardware is used to perform decryption calculations to obtain an approximate result; The approximate result is decoded to restore the query result.

7. An anonymous tracking device, characterized in that, The device is used on a server side, and the device includes: The generation module is used to perform serialization and matrix processing on the database to be processed, generating a two-dimensional data matrix. The first execution module is used to generate a random matrix according to the size of the two-dimensional data matrix, and to perform offline preprocessing on the two-dimensional data matrix and the random matrix based on acceleration hardware to obtain prompt data, wherein the prompt data includes a first prompt matrix and a second prompt matrix; Send the second hint matrix and the random matrix to the query terminal; Receive an encrypted query request sent by the query terminal, wherein the encrypted query request is generated based on the random matrix; Based on the acceleration hardware, the two-dimensional data matrix, the random matrix, and the first prompt matrix, the encrypted query request is calculated online to generate an encrypted response and return the encrypted response to the query terminal. The query terminal is used to decrypt the encrypted response based on the second prompt matrix to obtain the query result. The first execution module is further configured to generate a first random matrix and a second random matrix based on the size of the two-dimensional data matrix; calculate the product of the first random matrix and the two-dimensional data matrix on the acceleration hardware to obtain a first prompt matrix; calculate the product of the first prompt matrix and the second random matrix on the acceleration hardware to obtain a second prompt matrix; and determine the first prompt matrix and the second prompt matrix as prompt data.

8. An anonymous tracking device, characterized in that, The device is used in the query terminal, and the device includes: The receiving module is used to receive a second prompt matrix and a random matrix from the server. The random matrix is ​​generated by the server after processing its own database of unprocessed data to generate a two-dimensional data matrix, and the second prompt matrix is ​​obtained by the server using acceleration hardware to calculate the two-dimensional data matrix and the random matrix. The second execution module is used to obtain the query keywords input by the user; Based on the query keywords and the random matrix, an encrypted query request is generated using accelerated hardware, and the encrypted query request is sent to the server. Receive the encrypted response returned by the server based on the encrypted query request; Based on the second hint matrix and the locally pre-generated random number vector, the encrypted response is decrypted using the accelerated hardware to obtain the query result.

9. An electronic device, characterized in that, include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of a stealth query method as described in any one of claims 1 to 3, or the program, when executed by the processor, implements the steps of a stealth query method as described in any one of claims 4 to 6.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of a stealth query method as described in any one of claims 1 to 3, or, when executed by a processor, implements the steps of a stealth query method as described in any one of claims 4 to 6.

11. A computer program product, characterized in that, The method includes computer instructions that, when executed by a processor, implement the steps of a stealth query method as described in any one of claims 1 to 3, or, when executed by a processor, implement the steps of a stealth query method as described in any one of claims 4 to 6.

Citation Information

Patent Citations

  • Hidden trace query method and device

    CN114860735A

  • Data processing method and device and storage medium

    CN117194756A