Search

CN-115913538-B - Quantum symmetric encryption key searching method, device, equipment and medium

CN115913538BCN 115913538 BCN115913538 BCN 115913538BCN-115913538-B

Abstract

The application relates to a method, a device, equipment and a medium for searching a quantum symmetric encryption key. According to the method, an initial quantum state is converted into an initial key superposition state based on an H gate and a rotary gate, a plaintext is encoded by using a ground state encoding to obtain a plaintext quantum state, a quantum encryption circuit constructed by a preset symmetric encryption algorithm is used for encrypting the plaintext quantum state to obtain a ciphertext quantum state, a loss function is constructed according to a result of measuring the ciphertext quantum state and a true ciphertext of the plaintext, a rotation angle parameter of the initial rotary gate is adjusted to enable the loss function to meet preset conditions, the rotation angle parameter of the rotary gate at the moment is determined, the initial quantum state is converted into a search key superposition state by combining the H gate, a key with the largest occurrence number in a result of measuring the search key superposition state is determined to be a key obtained by searching, encryption and measurement in a quantum computing mode are realized, parameters are optimized by using a loss function mode, and complexity of quantum computing and occupation of quantum resources are reduced.

Inventors

  • FAN GAOMING
  • LIN YUEFENG
  • GUO CONG
  • FENG GUANRU
  • XIANG JINGEN
  • MENG TIEJUN

Assignees

  • 深圳量旋科技有限公司

Dates

Publication Date
20260512
Application Date
20221115

Claims (9)

  1. 1. A method for searching a quantum symmetric encryption key, the method comprising: Converting the initial quantum state into an initial key superposition state based on the H gate and the initial rotation gate, and encoding a plaintext by using a ground state encoding to obtain a plaintext quantum state; Based on the initial key superposition state, carrying out quantum encryption on the plaintext quantum state by using a quantum encryption circuit constructed by a preset symmetric encryption algorithm to obtain a corresponding ciphertext quantum state, and measuring the ciphertext quantum state to obtain a first measurement result; Constructing a loss function according to the first measurement result and the real ciphertext corresponding to the plaintext, and adjusting the rotation angle parameter of the initial revolving door based on the loss function so that the loss function meets a preset condition; Based on the rotation angle parameter of the initial revolving door and the H door when the loss function meets preset conditions, converting the initial quantum state into a search key superposition state, measuring the search key superposition state to obtain a second measurement result, and determining a key with the largest occurrence number in the second measurement result as a searched key; Converting the initial quantum state into an initial key superposition state based on the H gate and the initial rotation gate, and encoding the plaintext using the ground state encoding to obtain a plaintext quantum state comprises: acquiring the number of bits of a plaintext as n, and constructing a quantum circuit of 2n quantum bits; In the first n quantum bits, respectively placing an H gate and an initial rotating gate on a quantum circuit corresponding to each quantum bit, and converting an initial quantum state into an initial key superposition state through the quantum circuits corresponding to the first n quantum bits, wherein the rotating angles of the initial rotating gates are all 0; And encoding the plaintext to a quantum circuit corresponding to the last n quantum bits through ground state encoding to obtain a plaintext quantum state.
  2. 2. The search method according to claim 1, further comprising, after determining that the key having the largest number of occurrences in the second measurement result is the searched key: based on the key obtained by searching, performing non-quantum encryption on the plaintext by using the preset symmetric encryption algorithm to obtain encrypted ciphertext; comparing the encrypted ciphertext with the real ciphertext to obtain a comparison result; and if the comparison result is consistent, determining that the searched secret key is a real secret key for encrypting the plaintext into the real ciphertext.
  3. 3. The search method according to claim 2, further comprising, after comparing the encrypted ciphertext with the true ciphertext to obtain a comparison result: And if the comparison result is inconsistent, adjusting the preset condition, and repeating the step of converting the initial quantum state into the initial key superposition state based on the H gate and the initial rotation gate, and encoding the plaintext by using the ground state encoding to obtain the plaintext quantum state until the comparison result is consistent.
  4. 4. The search method according to claim 2, wherein the number of measurements when the ciphertext quantum state is measured is the same as the number of measurements when the search key superposition state is measured; after comparing the encrypted ciphertext with the real ciphertext to obtain a comparison result, the method further comprises the following steps: And if the comparison result is inconsistent, adjusting the measurement times, and repeating the step of converting the initial quantum state into the initial key superposition state based on the H gate and the initial rotation gate, and encoding the plaintext by using the ground state encoding to obtain the plaintext quantum state until the comparison result is consistent.
  5. 5. The search method of claim 1, wherein constructing a loss function from the first measurement and the plaintext corresponding actual ciphertext comprises: Taking the negative number of the probability that the first measurement result is the true ciphertext corresponding to the plaintext as a loss function, wherein the loss function is as follows: In the formula, Representing the quantum state The probability that the result is the true ciphertext y is obtained after measurement on a computational basis, And representing the quantum state obtained after the plaintext quantum state is evolved on the quantum circuit corresponding to the last n quantum bits.
  6. 6. The search method of claim 1, wherein constructing a loss function from the first measurement and the plaintext corresponding actual ciphertext comprises: acquiring a quantum state of a real ciphertext corresponding to the plaintext; Taking the fidelity between the first measurement result and the quantum state of the real ciphertext as a loss function, wherein the loss function is as follows: where y represents the true ciphertext, To use the quantum state vector corresponding to the true ciphertext obtained by ground state encoding, And representing the quantum state obtained after the plaintext quantum state is evolved on the quantum circuit corresponding to the last n quantum bits.
  7. 7. A search device for quantum symmetric encryption keys, the search device comprising: the quantum state conversion module is used for converting an initial quantum state into an initial key superposition state based on the H gate and the initial rotation gate, and encoding a plaintext by using a ground state encoding to obtain a plaintext quantum state; The quantum encryption measurement module is used for carrying out quantum encryption on the plaintext quantum state by using a quantum encryption circuit constructed by a preset symmetric encryption algorithm based on the initial key superposition state to obtain a corresponding ciphertext quantum state, and measuring the ciphertext quantum state to obtain a first measurement result; the angle parameter adjusting module is used for constructing a loss function according to the first measurement result and the real ciphertext corresponding to the plaintext, and adjusting the rotation angle parameter of the initial revolving door based on the loss function so that the loss function meets a preset condition; the key searching module is used for converting the initial quantum state into a search key superposition state based on the rotation angle parameter of the initial rotation door and the H door when the loss function meets preset conditions, measuring the search key superposition state to obtain a second measurement result, and determining a key with the largest occurrence number in the second measurement result as a searched key; the quantum state conversion module comprises: the circuit construction unit is used for acquiring the number of bits of the plaintext as n and constructing a quantum circuit of 2n quantum bits; the key coding unit is used for respectively placing an H gate and an initial rotating gate on the quantum circuit corresponding to each quantum bit in the first n quantum bits, converting an initial quantum state into an initial key superposition state through the quantum circuits corresponding to the first n quantum bits, wherein the rotating angles of the initial rotating gates are all 0; and the plaintext coding unit is used for coding the plaintext to the quantum circuits corresponding to the last n quantum bits through the ground state coding to obtain a plaintext quantum state.
  8. 8. A computer device, characterized in that it comprises a processor, a memory and a computer program stored in the memory and executable on the processor, which processor implements the search method according to any of claims 1 to 6 when executing the computer program.
  9. 9. A computer readable storage medium storing a computer program, characterized in that the computer program, when executed by a processor, implements the search method according to any one of claims 1 to 6.

Description

Quantum symmetric encryption key searching method, device, equipment and medium Technical Field The application is suitable for the technical field of quantum computing, and particularly relates to a method, a device, equipment and a medium for searching a quantum symmetric encryption key. Background Currently, with the vigorous development of internet technology, people's daily social activities, information transfer, shopping and the like can be completed in network space, and the process currently uses encryption algorithms such as advanced encryption standard (Advanced Encryption Standard, AES), data encryption standard (Data Encryption Standard, DES), RSA and the like to protect private information such as payment passwords of people from being stolen. However, considering quantum computing and rapid development of quantum information theory and technology, the key of some encryption algorithms can be searched by quantum algorithms, and research on possibility of cracking the encryption algorithms becomes a research direction. The existing technology for searching symmetric encryption keys by classical and quantum is mainly divided into the following three types: 1. The method comprises the steps of (1) carrying out exhaustive search, namely, carrying out encryption on all possible keys by using an encryption algorithm, namely, carrying out encryption on the keys which are consistent with ciphertext and are used by users, 2, carrying out quantum search based on Grover oracle circuit, carrying out Grover iteration for a plurality of times to search the keys, 3, carrying out Hamiltonian quantity H corresponding to ciphertext by constructing a variable component eigenvalue solver (VQE), carrying out solving by using the VQE to obtain the ground state energy of H, measuring the circuit at the moment, and corresponding the key to the measurement result, wherein a loss function used by the VQE is the final quantum state of the circuit and the expected value of H, and the effect of the loss function is mainly used for updating variable parameters in the circuit. For exhaustive search, the number of searches is large, the consumption of classical resources is large, for Grover-based quantum search, an n-bit (bit) key is usually required For searching based on VQE, n-bit keys and plaintext generally need 2n quantum bits to construct a variational circuit, but the used variational circuit is more complex, the process of constructing Hamiltonian quantity H is more complex, and the final searching form is also more complex. Therefore, how to ensure that the complexity of the construction of the search process is reduced under the condition of ensuring that the search key occupies lower quantum resources, so that the improvement of the search efficiency becomes a problem to be solved. Disclosure of Invention In view of the above, the embodiments of the present application provide a method, an apparatus, a device, and a medium for searching a quantum symmetric encryption key, so as to solve the problem of how to reduce the complexity of the search process construction and thus improve the search efficiency under the condition that the search key occupies a lower quantum resource. In a first aspect, an embodiment of the present application provides a method for searching a quantum symmetric encryption key, where the method includes: Converting the initial quantum state into an initial key superposition state based on the H gate and the initial rotation gate, and encoding a plaintext by using a ground state encoding to obtain a plaintext quantum state; Based on the initial key superposition state, carrying out quantum encryption on the plaintext quantum state by using a quantum encryption circuit constructed by a preset symmetric encryption algorithm to obtain a corresponding ciphertext quantum state, and measuring the ciphertext quantum state to obtain a first measurement result; Constructing a loss function according to the first measurement result and the real ciphertext corresponding to the plaintext, and adjusting the rotation angle parameter of the initial revolving door based on the loss function so that the loss function meets a preset condition; Based on the rotation angle parameter of the initial revolving door and the H door when the loss function meets preset conditions, converting the initial quantum state into a search key superposition state, measuring the search key superposition state to obtain a second measurement result, and determining a key with the largest occurrence number in the second measurement result as a searched key. In a second aspect, an embodiment of the present application provides a search apparatus for a quantum symmetric encryption key, the search apparatus including: the quantum state conversion module is used for converting an initial quantum state into an initial key superposition state based on the H gate and the initial rotation gate, and encoding a plaintext by using a ground