Method for solving discrete logarithm problem and related device
Patent Information
- Application Number
- CN202111365896.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-18
- Publication Date
- 2026-09-15
- Estimated Expiration
- 2041-11-18
AI Technical Summary
[0004]本发明的目的是提供一种求解离散对数问题的方法及相关设备,旨在解决相关技术中解密密钥未知的情况下,难以求解离散对数问题进而不能对密文进行解密恢复明文的技术问题
[0073]Based on the above technical solution, the input data of the discrete logarithm problem is transformed into an initial quantum state. Leveraging the powerful computing capabilities of quantum computing, a quantum computing module for solving the discrete logarithm problem is applied to this initial quantum state to obtain a first target quantum state storing the solution to the discrete logarithm problem. The solution is then extracted from this first target quantum state, thus completing the solution to the discrete logarithm problem. In this way, the discrete logarithm problem can be solved using only publicly available input data, which can be used to recover the decryption key and decrypt the plaintext. This solves the technical problem that the discrete logarithm problem is difficult to solve, making it difficult to recover the plaintext when the private key is unknown, thus filling a related technological gap.
Smart Images

Figure CN116136969B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of quantum computing technology, and in particular relates to a method and related equipment for solving discrete logarithm problems. Background Technology
[0002] To ensure the security of information transmission, information is encrypted with a key at the sending end before being sent to the receiving end. The encrypted information itself is jumbled data, making it impossible to directly read useful information. Furthermore, the encryption process is often based on intractable mathematical problems such as large number factorization and discrete logarithm problems. For example, Elliptic curve cryptography (ECC) is based on the discrete logarithm problem of elliptic curves, and the Rivest-Shamir-Adleman algorithm (RSA) is based on the large number factorization problem, which can be transformed into the discrete logarithm problem. Therefore, given the current difficulty in solving the discrete logarithm problem, encryption algorithms are difficult to crack, ensuring the security of encrypted information. Only when the discrete logarithm problem can be solved can the private key be recovered, allowing decryption of the ciphertext to obtain the plaintext.
[0003] In related technologies, it is necessary to decrypt ciphertext based on publicly available information, such as when the decryption key is forgotten or lost, in order to recover the corresponding plaintext. This requires the ability to solve the discrete logarithm problem. Based on this, a method and related equipment for solving the discrete logarithm problem are proposed. Summary of the Invention
[0004] The purpose of this invention is to provide a method and related equipment for solving the discrete logarithm problem, aiming to solve the technical problem that it is difficult to solve the discrete logarithm problem and thus cannot decrypt the ciphertext to recover the plaintext when the decryption key is unknown in related technologies.
[0005] To achieve the above objectives, a first aspect of the present invention provides a method for solving the discrete logarithm problem, the method comprising:
[0006] Obtain the input data for the discrete logarithm problem and convert the input data into an initial quantum state;
[0007] The initial quantum state is input into a quantum computing module that solves the discrete logarithm problem to obtain a first target quantum state that stores the solution to the discrete logarithm problem.
[0008] The solution result is extracted from the first target quantum state.
[0009] Optionally, the initial quantum state is prepared by an information quantum register including a first number of qubits, the quantum computing module includes a quantum Fourier transform module and a quantum mathematical operation module, and the step of inputting the initial quantum state into the quantum computing module to solve the discrete logarithm problem to obtain a first target quantum state storing the solution result of the discrete logarithm problem includes:
[0010] Obtain a parametric quantum register comprising a second number of qubits, and prepare the parametric quantum register into a superposition state formed by qubit states of equal amplitude;
[0011] The initial quantum state and the superposition state are input into the quantum mathematical operation module to obtain the second target quantum state. When in the second target quantum state, the quantum state of the information quantum register and the quantum state of the parameter quantum register satisfy the entanglement relationship corresponding to the preset mathematical operation.
[0012] The quantum state of the parameter quantum register in the second target quantum state is input into the quantum Fourier transform module to obtain the first target quantum state.
[0013] Optionally, the quantum mathematical operation module includes a first mathematical operation module and a second mathematical operation module cascaded together; the information quantum register includes a first information quantum register and a second information quantum register; the parameter quantum register includes a first parameter quantum register and a second parameter quantum register; and the step of inputting the initial quantum state and the superposition state into the quantum mathematical operation module to obtain the second target quantum state includes:
[0014] The quantum state of the first information quantum register in the initial quantum state and the quantum state of the first parameter quantum register in the superposition state are input into the first mathematical operation module to obtain the intermediate quantum state;
[0015] The quantum state of the second information quantum register in the initial quantum state, the quantum state of the second parameter quantum register in the superposition state, and the intermediate quantum state are input into the second mathematical operation module to obtain the second target quantum state.
[0016] Optionally, both the first mathematical operation module and the second mathematical operation module are modular exponentiation modules.
[0017] Optionally, both the first mathematical operation module and the second mathematical operation module are elliptic curve multiplication modules.
[0018] Optionally, the quantum Fourier transform module includes a module for implementing the forward quantum Fourier transform and / or a module for implementing the inverse quantum Fourier transform.
[0019] Optionally, extracting the solution result from the first target quantum state includes:
[0020] The parameter quantum register in the first target quantum state is measured to obtain the measurement result;
[0021] Based on the measurement results, a matrix L is constructed, and the matrix L satisfies the following form:
[0022]
[0023] Where A:=diag(u,…,u), is the maximum number of eigenstates of the first parameter quantum register, a vector. The elements in the array are the measurement results corresponding to the first parameter quantum register;
[0024] The generator subspace of matrix L is obtained based on the row vectors of matrix L;
[0025] For any vector in the generated subspace, the last element of the vector is taken as the logarithm to be verified.
[0026] Determine that the logarithm to be verified satisfies the logarithmic relation of the discrete logarithm problem;
[0027] The logarithm to be verified is determined as the solution result.
[0028] Optionally, there are multiple measurement results, and the construction of matrix L based on the measurement results includes:
[0029] A matrix L is constructed by obtaining a preset number of measurement results from all the measurement results.
[0030] Optionally, before obtaining the last element of any vector in the generated subspace as the logarithm to be verified, the method further includes:
[0031] Calculate the target distance between each vector in the generated subspace and the reference vector, where the last element of the reference vector is 0 and the remaining elements are -2. n The product of the measurement results corresponding to the second quantum register, where n is the difference between the number of qubits in the first quantum register and the second quantum register;
[0032] Determine that the distance to each target is less than a preset distance.
[0033] Optionally, the method further includes:
[0034] Determine that any of the target distances is greater than or equal to the preset distance;
[0035] A predetermined number of new measurement results are obtained from all the measurement results to construct matrix L′;
[0036] Take the matrix L′ as the matrix L, and return to the step of performing the generation subspace of the matrix L based on the row vectors of the matrix L.
[0037] Optionally, the preset distance is Where s is the preset quantity.
[0038] A second aspect of the present invention provides an apparatus for solving the discrete logarithm problem, the apparatus comprising:
[0039] The acquisition and transformation module is used to acquire the input data of the discrete logarithm problem and transform the input data into an initial quantum state;
[0040] The input module is used to input the initial quantum state into the quantum computing module that solves the discrete logarithm problem, so as to obtain a first target quantum state that stores the solution result of the discrete logarithm problem;
[0041] An extraction module is used to extract the solution result from the first target quantum state.
[0042] Optionally, the initial quantum state is prepared by an information quantum register including a first number of qubits, the quantum computing module includes a quantum Fourier transform module and a quantum mathematical operation module, and the input module is further used for:
[0043] Obtain a parametric quantum register comprising a second number of qubits, and prepare the parametric quantum register into a superposition state formed by qubit states of equal amplitude;
[0044] The initial quantum state and the superposition state are input into the quantum mathematical operation module to obtain the second target quantum state. When in the second target quantum state, the quantum state of the information quantum register and the quantum state of the parameter quantum register satisfy the entanglement relationship corresponding to the preset mathematical operation.
[0045] The quantum state of the parameter quantum register in the second target quantum state is input into the quantum Fourier transform module to obtain the first target quantum state.
[0046] Optionally, the quantum mathematical operation module includes a first mathematical operation module and a second mathematical operation module cascaded together; the information quantum register includes a first information quantum register and a second information quantum register; the parameter quantum register includes a first parameter quantum register and a second parameter quantum register; and the input module is further used for:
[0047] The quantum state of the first information quantum register in the initial quantum state and the quantum state of the first parameter quantum register in the superposition state are input into the first mathematical operation module to obtain the intermediate quantum state;
[0048] The quantum state of the second information quantum register in the initial quantum state, the quantum state of the second parameter quantum register in the superposition state, and the intermediate quantum state are input into the second mathematical operation module to obtain the second target quantum state.
[0049] Optionally, both the first mathematical operation module and the second mathematical operation module are modular exponentiation modules.
[0050] Optionally, both the first mathematical operation module and the second mathematical operation module are elliptic curve multiplication modules.
[0051] Optionally, the quantum Fourier transform module includes a module for implementing the forward quantum Fourier transform and / or a module for implementing the inverse quantum Fourier transform.
[0052] Optionally, the extraction module is also used for:
[0053] The parameter quantum register in the first target quantum state is measured to obtain the measurement result;
[0054] Based on the measurement results, a matrix L is constructed, and the matrix L satisfies the following form:
[0055]
[0056] Where A:=diag(u,…,u), is the maximum number of eigenstates of the first parameter quantum register, a vector. The elements in the array are the measurement results corresponding to the first parameter quantum register;
[0057] The generator subspace of matrix L is obtained based on the row vectors of matrix L;
[0058] For any vector in the generated subspace, the last element of the vector is taken as the logarithm to be verified.
[0059] Determine that the logarithm to be verified satisfies the logarithmic relation of the discrete logarithm problem;
[0060] The logarithm to be verified is determined as the solution result.
[0061] Optionally, the measurement results are multiple, and the extraction module is further used for:
[0062] A matrix L is constructed by obtaining a preset number of measurement results from all the measurement results.
[0063] Optionally, the device further includes:
[0064] The calculation module is used to calculate the target distance between each vector in the generated subspace and a reference vector before the extraction module obtains the last element of any vector in the generated subspace as the logarithm to be verified. The last element of the reference vector is 0, and the remaining elements are -2. n The product of the measurement results corresponding to the second quantum register, where n is the difference between the number of qubits in the first quantum register and the second quantum register;
[0065] The first determining module is used to determine that the distance to each target is less than a preset distance.
[0066] Optionally, the device further includes:
[0067] The second determining module is used to determine that any of the target distances is greater than or equal to the preset distance;
[0068] The reconstruction module obtains a preset number of new measurement results from all the measurement results to construct matrix L′;
[0069] Return to the execution module, which is used to take the matrix L′ as the matrix L, and return to the step of executing the generation subspace of the matrix L based on the row vectors of the matrix L.
[0070] Optionally, the preset distance is Where s is the preset quantity.
[0071] A third aspect of the present invention provides a storage medium storing a computer program, wherein the computer program is configured to execute the steps of the method described in any one of the first aspects above when running.
[0072] A fourth aspect of the present invention provides an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps of the method described in any of the first aspects above.
[0073] Based on the above technical solution, the input data of the discrete logarithm problem is transformed into an initial quantum state. Leveraging the powerful computing capabilities of quantum computing, a quantum computing module for solving the discrete logarithm problem is applied to this initial quantum state to obtain a first target quantum state storing the solution to the discrete logarithm problem. The solution is then extracted from this first target quantum state, thus completing the solution to the discrete logarithm problem. In this way, the discrete logarithm problem can be solved using only publicly available input data, which can be used to recover the decryption key and decrypt the plaintext. This solves the technical problem that the discrete logarithm problem is difficult to solve, making it difficult to recover the plaintext when the private key is unknown, thus filling a related technological gap. Attached Figure Description
[0074] Figure 1 This is a hardware structure block diagram of a computer terminal illustrating a method for solving discrete logarithm problems according to an exemplary embodiment.
[0075] Figure 2 This is a schematic diagram of an elliptic curve according to an exemplary embodiment.
[0076] Figure 3 This is a flowchart illustrating a method for solving the discrete logarithm problem according to an exemplary embodiment.
[0077] Figure 4 This is a flowchart illustrating step S32 of a method for solving a discrete logarithm problem according to an exemplary embodiment.
[0078] Figure 5 This is a schematic diagram illustrating a quantum computing module according to an exemplary embodiment.
[0079] Figure 6 This is a flowchart of step S322 in a method for solving a discrete logarithm problem according to an exemplary embodiment.
[0080] Figure 7 This is a flowchart of step S33 in a method for solving the discrete logarithm problem according to an exemplary embodiment.
[0081] Figure 8 This is another flowchart of step S33 in a method for solving a discrete logarithm problem according to an exemplary embodiment.
[0082] Figure 9 This is another flowchart of step S33 in a method for solving a discrete logarithm problem according to an exemplary embodiment.
[0083] Figure 10 This is a schematic diagram of an elliptic curve addition module according to an exemplary embodiment.
[0084] Figure 11This is another schematic diagram of an elliptic curve addition module according to an exemplary embodiment.
[0085] Figure 12 This is a block diagram illustrating an apparatus for solving the discrete logarithm problem according to an exemplary embodiment. Detailed Implementation
[0086] The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0087] This invention first provides a method for solving the discrete logarithm problem, which can be applied to electronic devices, such as computer terminals, specifically ordinary computers, quantum computers, etc.
[0088] The following detailed explanation uses a computer terminal as an example. Figure 1 This is a hardware block diagram of a computer terminal illustrating a method for solving discrete logarithm problems according to an exemplary embodiment. Figure 1 As shown, a computer terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing methods for solving discrete logarithm problems based on quantum circuits are also shown. Optionally, the computer terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the computer terminal described above. For example, the computer terminal may also include components that are more complex than those described above. Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0089] The memory 104 can be used to store software programs and modules for application software, such as the program instructions / modules corresponding to the method for solving the discrete logarithm problem in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to a computer terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0090] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider for the computer terminal. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0091] It's important to note that a true quantum computer has a hybrid structure, comprising two main parts: a classical computer responsible for performing classical computations and control, and a quantum device responsible for running quantum programs to achieve quantum computation. A quantum program is a sequence of instructions written in a quantum language such as QRunes that can run on a quantum computer, supporting operations on quantum logic gates and ultimately enabling quantum computing. Specifically, a quantum program is a sequence of instructions that operates on quantum logic gates according to a specific timing order.
[0092] In practical applications, due to limitations in the development of quantum device hardware, quantum computing simulations are often required to verify quantum algorithms, quantum applications, and so on. Quantum computing simulation is the process of simulating the execution of a quantum program corresponding to a specific problem using a virtual architecture (i.e., a quantum virtual machine) built with the resources of a regular computer. Typically, it is necessary to construct a quantum program corresponding to a specific problem. The quantum program referred to in this embodiment of the invention is a program written in a classical language that represents qubits and their evolution, wherein qubits, quantum logic gates, etc., related to quantum computing all have corresponding classical code representations.
[0093] Quantum circuits, also known as quantum logic circuits, are a manifestation of quantum programming and are the most commonly used general-purpose quantum computing model. They represent circuits that operate on qubits under an abstract concept. They consist of qubits, circuits (timelines), and various quantum logic gates. Finally, the results are often read out through quantum measurement operations.
[0094] Unlike traditional circuits that use metal wires to transmit voltage or current signals, in quantum circuits, the circuits can be seen as being connected by time. That is, the state of a quantum bit evolves naturally over time, following the instructions of the Hamiltonian operator until it encounters a logic gate and is operated on.
[0095] A quantum program corresponds to a single quantum circuit. The quantum program described in this invention refers to this single quantum circuit, where the total number of qubits in the single quantum circuit is the same as the total number of qubits in the quantum program. This can be understood as follows: a quantum program can consist of a quantum circuit, measurement operations on the qubits within the quantum circuit, registers storing the measurement results, and control flow nodes (jump instructions). A single quantum circuit can contain dozens, hundreds, or even thousands of quantum logic gate operations. The execution of a quantum program is the process of executing all the quantum logic gates in a specific timing order. It should be noted that the timing order refers to the chronological sequence in which individual quantum logic gates are executed.
[0096] It's important to note that in classical computing, the most basic unit is the bit, and the most fundamental control mode is the logic gate. Circuit control can be achieved through combinations of logic gates. Similarly, the way to process qubits is through quantum logic gates. Quantum logic gates enable the evolution of quantum states and are the foundation of quantum circuits. Quantum logic gates include single-qubit gates, such as Hadamard gates (H-gates), Pauli-X gates (X-gates), Pauli-Y gates (Y-gates), Pauli-Z gates (Z-gates), RX gates, RY gates, RZ gates, etc.; and multi-qubit gates, such as CNOT gates, CR gates, iSWAP gates, Tofoli gates, etc. Quantum logic gates are generally represented using unitary matrices, which are not only matrix forms but also operations and transformations. Generally, the effect of a quantum logic gate on a quantum state is calculated by left-multiplying the unitary matrix by the matrix corresponding to the right vector of the quantum state.
[0097] In related technologies, in order to ensure the security of communication data, it is generally necessary to encrypt the communication data. For example, ECC encryption algorithm and RSA encryption algorithm are both asymmetric encryption algorithms used to encrypt data.
[0098] In the ECC encryption algorithm, both elliptic curve addition and elliptic curve multiplication are based on the following elliptic curve definition:
[0099] y 2 =x 3 +ix+j(mod p)
[0100] Where i, j, and p are all non-negative integers, and i and j satisfy the relation 4i 3 +27j 2 ≠0 (mod p), see also Figure 2 , Figure 2 The curve in the equation is an elliptic curve. The sum of the elliptic curves at points A and B on the elliptic curve is defined as the point C, which is the reflection of the intersection of the lines containing points A and B with the elliptic curve about the x-axis. The product of the constant n and the elliptic curve of point C is the result of the above elliptic curve addition of n points C.
[0101] Due to the properties of elliptic curves, all points on the elliptic curve can be obtained by performing elliptic curve multiplication on a base point and itself. During communication, the receiving end selects a base point P and a random number k on the elliptic curve and generates a public key Q = k⊙P, where Q is the product of the base point P and the random number k. The receiving end then sends the information of points Q and P to the sending end for encrypting the plaintext, while retaining k as its private key for decrypting the ciphertext sent by the sending end. Even with known information about points Q and P, it is difficult to calculate the private key k in the operation Q = k⊙P, thus ensuring the security of the communication process. This problem is known as the discrete logarithm problem of elliptic curves.
[0102] In communication encrypted using the RSA algorithm, the receiving end sends the public key corresponding to its private key to the sending end. The sending end uses the public key to encrypt the plaintext to obtain ciphertext, which is then sent to the receiving end. The receiving end then uses its own private key to decrypt the ciphertext to obtain the plaintext. Calculating the private key from the public key requires prime factorization of large numbers in the public key, which is difficult to implement, thus ensuring communication security. The large number factorization in the RSA algorithm can be transformed into prime factorization for y = x. r In the (mod p) operation, even when y and x are known, it is difficult to calculate r, which is the discrete logarithm problem in the RSA encryption algorithm.
[0103] Figure 3 This is a flowchart illustrating a method for solving the discrete logarithm problem according to an exemplary embodiment, such as... Figure 3 As shown in the figure, this embodiment provides a method for solving the discrete logarithm problem, the method including:
[0104] S31, Obtain the input data of the discrete logarithm problem and convert the input data into an initial quantum state.
[0105] S32, the initial quantum state is input into the quantum computing module that solves the discrete logarithm problem to obtain the first target quantum state that stores the solution result of the discrete logarithm problem.
[0106] S33, extract the solution result from the first target quantum state.
[0107] In step S31, for the general form of the discrete logarithm problem, y = mx (mod p), where m is the logarithm to be solved, and x and y are the input data of the discrete logarithm problem. Since x and y are generally known for the discrete logarithm problem and are made public, the purpose is to solve m based on x and y. Therefore, the input data x and y can be obtained through public channels.
[0108] For the ECC encryption algorithm, the input data may include a public key and corresponding base point information. The public key must include at least the aforementioned point Q, for example, only point Q, or both point Q and the aforementioned elliptic curve, depending on the specific circumstances. This invention does not impose any specific limitations on this. Since both the public key and the base point information are publicly available, this information can be obtained through these public channels.
[0109] For the RSA encryption algorithm, the large number factorization problem is transformed into a discrete logarithm problem, and then the input data for this discrete logarithm problem is obtained. That is, for a large number in the RSA encryption algorithm's public key, an integer greater than 1 and less than that large number is selected as the base of the discrete logarithm problem, which is the logarithmic relationship y = x in the RSA encryption algorithm's discrete logarithm problem. r x in (mod p) is used, and 1 is selected as the base x. The result of the modular exponentiation operation is y, and the base x and the base y are used as input data for the discrete logarithm problem of the RSA encryption algorithm.
[0110] After acquiring the input data, a quantum register containing multiple qubits can be selected or invoked, and prepared into the initial quantum state representing the input data as described above. For example, for the RSA encryption algorithm, the base x can be transformed into the initial quantum state |x>, and the result of the exponentiation operation y can be transformed into |y>, where y=1. For the ECC encryption algorithm, the x and y coordinates of point Q in the public key can be selected to form coordinate information Q, and the x and y coordinates of the base point P can be selected to form coordinate information P, and prepared into quantum states |Q> and |P> respectively as the initial quantum states.
[0111] In step S32, solving the discrete logarithm problem is the problem of finding m given the general form of the discrete logarithm problem y = mx (mod p), where x and y are known. For example, for the ECC encryption algorithm, solving the discrete logarithm problem is the problem of finding the random number k given points P and Q, which is the solution obtained above. For the RSA encryption algorithm, solving the discrete logarithm problem is the problem of finding the random number k given the logarithmic relationship y = x. r The process of finding the order r from x and y in (mod p).
[0112] After the initial quantum state is prepared, it is input into a quantum computing module that solves the discrete logarithm problem, outputting a first target quantum state. At this point, the solution to the discrete logarithm problem is stored directly or indirectly in the first target quantum state. This solution can exist in the complex amplitudes of the quantum states of the first target quantum state, or in the entanglement relationships of the quantum states. Alternatively, the solution itself can exist in the first target quantum state, or information related to the solution, such as information decomposed from the solution, can exist in the first target quantum state. The solution can then be calculated based on this information. It should be noted that the quantum states of a quantum state are the basis states that superimpose to constitute that quantum state. For example, for a quantum state... |0> and |1> are their quantum states.
[0113] Optionally, see Figure 5 The initial quantum state is prepared by an information quantum register comprising a first number of qubits, and the quantum computing module includes a quantum Fourier transform module 520 and a quantum mathematical operation module 510. Specifically, the first number can be determined according to the initial quantum state to be prepared. It should be noted that the quantum register described in this invention is a collection of one or more qubits.
[0114] Optionally, Figure 4 The initial quantum state is input into a quantum computing module that solves the discrete logarithm problem, resulting in a first target quantum state storing the solution to the discrete logarithm problem, including:
[0115] S321, Obtain a parameter quantum register including a second number of qubits, and prepare the parameter quantum register into a superposition state formed by qubit states of equal amplitude.
[0116] S322, the initial quantum state and the superposition state are input into the quantum mathematical operation module to obtain the second target quantum state. When in the second target quantum state, the quantum state of the information quantum register and the quantum state of the parameter quantum register satisfy the entanglement relationship corresponding to the preset mathematical operation.
[0117] S323, input the quantum state of the parameter quantum register in the second target quantum state into the quantum Fourier transform module to obtain the first target quantum state.
[0118] In step S321, to facilitate the solution of the discrete logarithm problem by the quantum computing module, a parametric quantum register is introduced to construct parameters about the initial quantum state in the following entanglement relationship. Obtaining the parametric quantum register can be done by calling an existing quantum register. The above superposition state can be prepared by applying an H-gate to each qubit of the parametric quantum register in the quantum state |0>. In one possible implementation, the parametric quantum register may include a first parametric quantum register and a second parametric quantum register.
[0119] Following the example above, a first-parameter quantum register containing l+n qubits can be selected, see [link to example]. Figure 5 The quantum register on the fourth line from the top in the middle, among which, The minimum number of qubits that can represent the solution m can be estimated using relevant information. If no relevant information is available, the number of elements in the group corresponding to the discrete logarithm problem can be considered as m. s is a preset number. It should be noted that for the ECC encryption algorithm, m is the aforementioned random number k, and for the RSA encryption algorithm, m is the aforementioned r. Furthermore, a second parameter quantum register containing l qubits can be selected, i.e. Figure 5 The last line from top to bottom in the middle uses a quantum register to prepare each qubit of the first-parameter quantum register and the second-parameter quantum register into the quantum state |0>. Then, an H gate is applied to each qubit in the quantum state |0>, resulting in a superposition of quantum states with equal amplitude as follows:
[0120]
[0121] Where u = 2 l+n v=2 l a and b correspond to the quantum states of the first-parameter quantum register and the second-parameter quantum register, respectively.
[0122] In step S322, the quantum mathematical operation module 510 is used to realize the aforementioned entanglement relationship. After the initial quantum state and superposition state are input into the quantum mathematical operation module 510, they continuously evolve under the action of quantum logic gates in the quantum mathematical operation module 510, eventually obtaining the second target quantum state, so that the qubits of the information quantum register and the qubits of the parameter quantum register are mutually entangled according to a preset entanglement relationship. The entanglement relationship corresponding to the aforementioned mathematical operation refers to the entanglement relationship corresponding to the operation relationship composed of at least one of the algebraic operations such as modular multiplication, modular exponentiation, elliptic curve addition, and elliptic curve multiplication. The quantum mathematical operation module 510 is the module used to realize this entanglement relationship.
[0123] Optionally, see Figure 5The quantum mathematical operation module 510 includes a first mathematical operation module 511 and a second mathematical operation module 512 cascaded together. The information quantum register includes a first information quantum register and a second information quantum register. The parameter quantum register includes a first parameter quantum register and a second parameter quantum register. The first mathematical operation module 511 and the second mathematical operation module 512 can be modules that perform the same mathematical operations on the corresponding evolution of the quantum state.
[0124] Optionally, see Figure 6 The initial quantum state and the superposition state are input into the quantum mathematical operation module to obtain the second target quantum state, including:
[0125] S3221, input the quantum state of the first information quantum register in the initial quantum state and the quantum state of the first parameter quantum register in the superposition state into the first mathematical operation module to obtain the intermediate quantum state.
[0126] S3222, input the quantum state of the second information quantum register in the initial quantum state, the quantum state of the second parameter quantum register in the superposition state, and the intermediate quantum state into the second mathematical operation module to obtain the second target quantum state.
[0127] In one possible implementation, to solve the discrete logarithm problem of the ECC encryption algorithm, both the first mathematical operation module 511 and the second mathematical operation module 512 can be elliptic curve multiplication modules, i.e., modules used to implement the above-mentioned elliptic curve multiplication operation. Furthermore, in step S3221, for example, the initial quantum state of the first information quantum register can be |P>, and the quantum state of the first parameter quantum register in the superposition state is |a>. Inputting |P> and |a> into the first mathematical operation module 511 yields an intermediate quantum state. Optionally, the elliptic curve multiplication module can include cascaded elliptic curve addition modules, which can employ existing technology or subsequent... Figure 10 and Figure 11 The quantum circuit is implemented by the elliptic curve addition module 110 in the middle.
[0128] After obtaining the intermediate quantum state, step S3222 is executed. Continuing with the above example, the initial quantum state of the second information quantum register can be |Q>, and the quantum state of the second parameter quantum register in the superposition state is |b>. Then, |Q>, |b>, and the intermediate quantum state are input into the second mathematical operation module 512 to obtain the second target quantum state. The symbol ⊙ represents the elliptic curve addition operation, and ⊙ represents the elliptic curve multiplication operation. Elliptic curve multiplication has higher priority than elliptic curve addition. It should be noted that since elliptic curve multiplication is actually implemented through multiple elliptic curve addition operations, step S3221 can be considered as multiple elliptic curve additions of P to obtain the entangled relationship P⊙a, while step S3222 can be considered as elliptic curve additions of P⊙a and multiple Qs to obtain the entangled relationship.
[0129] In another possible implementation, to solve the discrete logarithm problem of the RSA encryption algorithm, both the first mathematical operation module 511 and the second mathematical operation module 512 can be modular exponentiation modules, i.e., modules used to implement modular exponentiation. Furthermore, in step S3221, for example, the initial quantum state of the first information quantum register can be |x>, and the quantum state of the first parameter quantum register in the superposition state is |a>. Inputting |x> and |a> into the first mathematical operation module 511 yields an intermediate quantum state. Optionally, the modular exponentiation module can include cascaded modular multiplication modules, i.e., modules used to implement modular multiplication, and modular multiplication modules can include cascaded modular addition modules, i.e., modules used to implement modular addition. Specifically, the modular exponentiation module, modular multiplication module, and modular addition module are all basic operation modules and can be implemented using relevant technologies in the prior art.
[0130] After obtaining the intermediate quantum state, step S3222 is executed. Continuing with the above example, the initial quantum state of the second information quantum register can be |y>, and the quantum state of the second parameter quantum register in the superposition state is |b>. Then, |y>, |b>, and the intermediate quantum state are input into the second mathematical operation module 512 to obtain the second target quantum state. Where N is a large number in the aforementioned public key. It should be noted that, since modular exponentiation is actually implemented through multiple modular multiplications, step S3221 can be viewed as multiple modular multiplications of x to obtain the entangled relation x. a (mod N), and in step S3222, it is considered to be for x a Modular multiplication with multiple y yields an entangled relation x. a *y b (mod N).
[0131] In other possible implementations, the first mathematical operation module 511 and the second mathematical operation module 512 may be modules for implementing other algebraic operations, and the present invention does not impose specific limitations on this. Figure 5 In the diagram, the qubits in the first three rows from top to bottom all belong to the information quantum register. The qubits of the first and second information quantum registers both come from these registers. This invention does not impose specific restrictions on how they are divided.
[0132] In step S323, see Figure 5 In the second target quantum state, the parameter quantum register evolves into the first target quantum state under the action of the quantum Fourier transform module. The quantum Fourier transform module 520 is a module composed of quantum circuits for implementing Fourier transform. Optionally, the quantum Fourier transform module 520 includes a module for implementing forward quantum Fourier transform and / or a module for implementing inverse quantum Fourier transform.
[0133] Using the ECC encryption algorithm example above, the second target quantum state output by the quantum mathematics operation module 510 is... The quantum states of the first-parameter quantum register and the second-parameter quantum register are input into the quantum Fourier transform module 520 to obtain the following first target quantum state:
[0134]
[0135] Where c and d represent the quantum states of the first parameter quantum register and the second parameter quantum register after the quantum Fourier transform module 520 described above, i is an imaginary number, k is the random number used as the private key, and the other parameters can be found in the above description.
[0136] Using the RSA encryption algorithm example above, the second target quantum state output by the quantum mathematics operation module 510 is... The quantum states of the first-parameter quantum register and the second-parameter quantum register are input into the quantum Fourier transform module 520 to obtain the following first target quantum state:
[0137]
[0138] Where c and d represent the quantum states of the first parameter quantum register and the second parameter quantum register after the quantum Fourier transform module 520, respectively, i is an imaginary number, r is the order of the base x in the discrete logarithm problem of the RSA encryption algorithm, and the other parameters can be found in the above description.
[0139] After obtaining the first target quantum state, step S33 is executed to extract the solution result from the first target quantum state to complete the solution of the discrete logarithm problem. Measurement results related to the solution result can be obtained by measuring the first target quantum state, and then the measurement results can be transformed to extract the solution result.
[0140] Optionally, see Figure 7 Extracting the solution result from the first target quantum state includes:
[0141] S331, Measure the parameter quantum register in the first target quantum state to obtain the measurement result.
[0142] S332, Construct matrix L based on the measurement results, wherein matrix L satisfies the following form:
[0143]
[0144] Where A := diag(u,…,u), u is the maximum number of eigenstates of the first parameter quantum register, and the vector The elements in the table are the measurement results corresponding to the first parameter quantum register.
[0145] S333, the generating subspace of matrix L is obtained based on the row vectors of matrix L.
[0146] S334, for any vector in the generated subspace, obtain the last element of the vector as the logarithm to be verified.
[0147] S335, Determine that the logarithm to be verified satisfies the logarithmic relation of the discrete logarithm problem.
[0148] S336, determine the logarithm to be verified as the solution result.
[0149] In step S331, following the example of the above ECC encryption algorithm, the first parameter quantum register and the second parameter quantum register in the first target quantum state are measured. After the measurement, the first target quantum state collapses to the quantum state |c,d,e⊙P=(a+bk)⊙P>, with an amplitude of:
[0150]
[0151] Where q is the order of the elliptic curve, and the other parameters are described above.
[0152] Using the RSA encryption algorithm example above, measurements are performed on the first parameter quantum register and the second parameter quantum register in the first target quantum state. After the measurement, the first target quantum state collapses into the quantum state |c,d,x. (a+br) (mod N)>, the amplitude is:
[0153]
[0154] The parameters are described above.
[0155] The measurement of the first target quantum state can be performed using methods such as projection measurement. To ensure the accuracy of the measurement results, multiple measurements can be taken, and the resulting measurement results can include different quantum states and the number of times the quantum state collapses to the corresponding quantum state.
[0156] In step S332, the matrix L is constructed based on the measurement results. In matrix L, A is a diagonal matrix with diagonal elements u and vectors. The elements in the matrix can correspond to the number of occurrences of different collapsed quantum states. Then, in step S333, the row vectors of matrix L are linearly combined to obtain the generator subspace of matrix L. Next, step S334 is executed, where a vector is randomly selected from this generator subspace, and its last element is taken as the logarithm to be verified. In step S335, it is verified whether this logarithm satisfies the logarithmic relation of the discrete logarithm problem, such as the operation relation Q=k⊙P in the ECC encryption algorithm or the operation relation y=x in the RSA encryption algorithm. r (mod N) is used to substitute the obtained logarithm into the formula to verify whether the formula holds true. If it holds true, the logarithmic relationship is confirmed to hold. Then, in step S336, the logarithm that satisfies the logarithmic relationship is taken as the solution result, thus completing the solution of the discrete logarithm problem.
[0157] Optionally, there are multiple measurement results, and a matrix L is constructed based on the measurement results, including:
[0158] A matrix L is constructed by obtaining a preset number of measurement results from all the measurement results.
[0159] Using the ECC encryption algorithm example above, for the quantum state |c,d,e⊙P=(a+bk)⊙P> obtained after the above measurement, b is placed around the center point After localization, the amplitude can be expressed as:
[0160]
[0161] Among them, {kc+2 n d} u express The remaining elements can be found in the description above. When |c,d> satisfies {kc+2} n d} u ≤2 n-2 When |c,d> is defined as a well-formed state, its corresponding amplitude is more concentrated, making it easier to determine the logarithm to be solved. Similarly, for the RSA encryption algorithm example above, for the quantum state |c,d,x obtained from the above measurements... (a+br) (modN)>, move b around the center point After localization, the amplitude can be expressed as:
[0162]
[0163] Among them, {rc+2 n d} u express The remaining elements can be found in the description above. When |c,d> satisfies {rc+2 n d} u ≤2 n-2 When |c,d〉 is defined as a good state, its corresponding amplitude is more concentrated.
[0164] Since the number of benign states is at least 2 l+n-1 The probability of observing a specified good state is at least 2. -n-l-2 Therefore, the probability of observing any well-conditioned state in a single run is 2. -3 Therefore, after running 8s times, we can obtain s good-state measurement results with approximately a 50% probability. Then, in step S332, multiple measurements are performed to obtain multiple measurement results, and a certain number of measurement results are selected from these multiple results. There is a certain probability of obtaining a good-state result. For example, if the measurement results are 8s times, the preset number is s, and s measurement results are obtained. If all of these are good-state, the efficiency of subsequent calculations in obtaining the correct logarithm to be solved can be improved.
[0165] Optionally, see Figure 8 Extracting the solution result from the first target quantum state includes:
[0166] S33a, Measure the parameter quantum register in the first target quantum state to obtain the measurement result. S33b, Construct matrix L based on the measurement result, wherein matrix L satisfies the following form:
[0167]
[0168] Where A = diag(u,…,u), u is the maximum number of eigenstates of the first parameter quantum register, and the vector... The elements in the table are the measurement results corresponding to the first parameter quantum register.
[0169] S33c, the generating subspace of matrix L is obtained based on the row vectors of matrix L.
[0170] S33d, calculate the target distance between each vector in the generated subspace and the reference vector, where the last element of the reference vector is 0 and the remaining elements are -2. n The product of the measurement results corresponding to the second quantum register, where n is the difference in the number of qubits between the first quantum register and the second quantum register.
[0171] S33e, determine that the distance to each target is less than a preset distance.
[0172] S33f, for any vector in the generated subspace, obtain the last element of the vector as the logarithm to be verified.
[0173] S33g, determine that the logarithm to be verified satisfies the logarithmic relation of the discrete logarithm problem.
[0174] S33h, the logarithm to be verified is determined as the solution result.
[0175] For steps S33a to S33c above, please refer to steps S331 to S333 above.
[0176] In step S33d, following the example above, the reference vector is constructed as follows:
[0177]
[0178] Where d1,…,d s The second parameter, the quantum register, corresponds to the number of times different collapsed quantum states occur; the other parameters are described above. Then, lattice-based techniques are applied to each vector of the generated subspace. Calculate the target distance between the two
[0179] After calculating the target distance, step S33e is executed to determine whether the target distance is less than a preset distance. If it is less than the preset distance, it indicates that |c,d> are both in a good state, and then step S33f is executed. Optionally, the preset distance is... Wherein, s is the preset quantity. Steps S33f to S33h can be found in the description of steps S334 to S336 above.
[0180] Optionally, see Figure 9 Extracting the solution result from the first target quantum state includes:
[0181] S33A, measure the parameter quantum register in the first target quantum state to obtain the measurement result.
[0182] S33B, construct matrix L based on the measurement results, wherein matrix L satisfies the following form:
[0183]
[0184] Where A = diag(u,…,u), u is the maximum number of eigenstates of the first parameter quantum register, and the vector... The elements in the table are the measurement results corresponding to the first parameter quantum register.
[0185] S33C, the generating subspace of matrix L is obtained based on the row vectors of matrix L.
[0186] S33D, calculate the target distance between each vector in the generated subspace and the reference vector, where the last element of the reference vector is 0 and the remaining elements are -2. n The product of the measurement results corresponding to the second quantum register, where n is the difference in the number of qubits between the first quantum register and the second quantum register.
[0187] S33E, determine that the distance to each target is less than a preset distance.
[0188] S33F, for any vector in the generated subspace, obtain the last element of the vector as the logarithm to be verified.
[0189] S33G, determine that the logarithm to be verified satisfies the logarithmic relation of the discrete logarithm problem.
[0190] S33H, the logarithm to be verified is determined as the solution result.
[0191] S33 I, determine that any of the target distances is greater than or equal to the preset distance.
[0192] S33J, obtain a preset number of new measurement results from all the measurement results to construct matrix L′.
[0193] S33K, take the matrix L′ as the matrix L, and return to the step of performing the step of obtaining the generating subspace of the matrix L based on the row vectors of the matrix L.
[0194] For steps S33A to S33H above, please refer to the description of steps S33a to S33h above.
[0195] In step S33I, if the target distance is determined to be greater than or equal to a preset distance, it indicates that |c,d> are not all in a good state. Therefore, step S33F is not executed, and the process proceeds to step S33J. A preset number of measurement results are reselected from all measurement results to construct matrix L in the same way as matrix L. Matrix L' is constructed in the same way as matrix L, except that the element values are different. Then, in step S33K, matrix L' is used as matrix L, and the process returns to step S33C and subsequent steps until the target distance corresponding to the obtained matrix L is less than the preset distance, so that a correct solution result can be obtained.
[0196] After obtaining the solution, the decryption key can be obtained based on the solution in the appropriate way. For example, for the ECC encryption algorithm, the solution can be used as the private key to decrypt the ciphertext and obtain the plaintext. For the RSA encryption algorithm, the private key can be recovered from the solution based on the Shor algorithm.
[0197] Based on the above technical solution, the input data of the discrete logarithm problem is transformed into an initial quantum state. Leveraging the powerful computing capabilities of quantum computing, a quantum computing module for solving the discrete logarithm problem is applied to this initial quantum state to obtain a first target quantum state storing the solution to the discrete logarithm problem. The solution is then extracted from this first target quantum state, thus completing the solution to the discrete logarithm problem. In this way, the discrete logarithm problem can be solved using only publicly available input data, which can be used to recover the decryption key and decrypt the plaintext. This solves the technical problem that the discrete logarithm problem is difficult to solve, making it difficult to recover the plaintext when the private key is unknown, thus filling a related technological gap.
[0198] Optionally, see Figure 5 , Figure 10 and Figure 11 For the ECC encryption algorithm, the input of the elliptic curve addition module 110 is the input point information to be calculated, and the output of the elliptic curve addition module 110 is the output point information obtained by performing elliptic curve addition on the input point information. The elliptic curve addition module 110 includes a slope calculation module 111 for calculating the slope of the line corresponding to the input point information, and an output point calculation module 112 for calculating the output point information based on the slope of the line and the input point information.
[0199] For example, such as Figure 10 The input point information consists of the quantum states corresponding to the coordinates of points P and Q. After inputting into the elliptic curve addition module 110, the output is the quantum state corresponding to point R obtained by performing elliptic curve addition on points P and Q. The specific operation rules are as follows:
[0200] (X R Y R )=(λ 2 -X P -X Q ,λ(X P -X R )-Y P )
[0201] Among them, X Q Let x be the x-coordinate of point Q. P Y P These are the x and y coordinates of point P, respectively. R Y R Let R be the x-coordinate and y-coordinate of point P, and Q be the y-coordinate, respectively. λ is the slope of the line containing points P and Q. It should be noted that all operations in this rule are modulo operations.
[0202] From the above operational rules, it can be seen that the slopes of the lines containing points P and Q must be calculated first before the coordinates of the corresponding point R can be determined. Further details can be found in [link to documentation]. Figure 11The elliptic curve addition module 110 includes a slope calculation module 111, which calculates the slope of the line containing the input point, and an output point calculation module 112, which calculates the output point information based on the slope and the input point information.
[0203] Optionally, see Figure 11 The input point information includes information about a first input point and a second input point. The slope calculation module 111 includes a modular multiplication and inversion module 1111. The first modulus difference between the abscissas of the first input point and the second input point, and the second modulus difference between the ordinates of the first input point and the second input point are the inputs of the modular multiplication and inversion module 1111. The slope of the straight line is the output of the modular multiplication and inversion module 1111.
[0204] Continuing with the above example, the first input point is point P, and the second input point is point Q. The input point information includes the coordinates of points P and Q. The modular multiplication inverse module 1111 is used to implement the modular multiplication inverse operation, which is similar to the inverse operation of modular multiplication, similar to division. Then, X... P -X Q The first modulus difference, and Y P -Y Q The second modulus difference is input into the modulus multiplication inverse module 1111 to obtain the slope of the line, where Y Q Let Q be the ordinate of point Q, and the rest are as described above. It should be noted that the first and second modulus differences can be implemented using a module for modulus subtraction, which will not be elaborated upon here.
[0205] Optionally, see Figure 11 The output point arithmetic module 112 includes a first modular addition module 1121, a second modular addition module 1122, a third modular addition module 1123, a modular subtraction module 1124, a modular squaring module 1125, a modular squaring inverse module 1126, a modular multiplication module 1127, and a constant multiplication module 1128, wherein:
[0206] The product of the x-coordinate of the second input point and the modulus of 3, and the first modulus difference, are the inputs of the first modulus addition module 1121;
[0207] The slope of the straight line is the input of the modulus square module 1125;
[0208] The outputs of the first modular addition module 1121 and the modular squaring module 1125 are the inputs of the modular subtraction module 1124;
[0209] The output of the modulus squaring module 1125 is the input of the modulus squaring inverse module 1126;
[0210] The output of the modular subtraction module 1124 and the slope of the straight line are the inputs of the modular multiplication module 1127;
[0211] The output of the modular subtraction module 1124 is the input of the constant multiplication module 1128, and the constant of the constant multiplication module 1128 is -1;
[0212] The output of the constant multiplication module 1128 and the x-coordinate of the second input point are the inputs of the second modular addition module 1122;
[0213] The output of the multiplication module and the ordinate of the second input point are the inputs of the third modular addition module 1123;
[0214] The outputs of the second modular addition module 1122 and the third modular addition module 1123 are the output point information.
[0215] For example, participating Figure 11 X will be calculated R The line is called the x-coordinate calculation line, which will calculate Y. R The circuit is called the ordinate calculation circuit, and the first modulus difference X P -X Q With 3X Q Input the first modular addition module 1121 to perform modular addition operations and output X. P +2X Q The modular multiplication inverse module 1111 outputs the slope λ of the straight line, which is then input to the modular square module 1125. With the aid of the auxiliary qubit below, it outputs λ. 2 And input the modulus subtraction module 1124 and the modulus square inverse module 1126. λ 2 X output by the first modular addition module 1121 P +2X Q Input to the modulo-digit subtraction module 1124, output X from the modulo-digit subtraction module 1124. P -λ 2 +2X Q . λ 2 The input λ is fed into the modular square inverse module 1126, which restores the quantum state of the auxiliary qubit to its initial state. λ is then output into the modular multiplication module 1127, and X is added to it. P -λ 2 +2X Q The input is given to the modular multiplication module 1127, whose output X P -λ 2 +2X Q To the constant multiplication module 1128, and the output Y R -Y QUp to the third modular addition module 1123. For the constant multiplication module 1128, input X. P -λ 2 +2X Q Multiplying by -1 gives -X. P +λ 2 -2X Q Then with X Q Inputting both into the second modular addition module 1122 yields λ. 2 -X P -X Q That is, X R For the third modular addition module 1123, Y R -Y Q With Y Q The inputs are combined, and then the third modular addition module 1123 outputs Y. R This completes the elliptic curve addition operation for points P and Q. It should be noted that, for ease of description, some quantum circuits in the diagram have been simplified; for example, for the first modular addition module 1121, the input 3X is not shown. Q The circuit. Furthermore, the inputs and outputs described above are the quantum states of the corresponding information.
[0216] Figure 12 This is an apparatus 120 for solving discrete logarithm problems according to an exemplary embodiment, such as... Figure 12 As shown, the device 120 includes:
[0217] The conversion module 121 is used to acquire the input data of the discrete logarithm problem and convert the input data into an initial quantum state;
[0218] Input module 122 is used to input the initial quantum state into a quantum computing module that performs a discrete logarithm problem to obtain a first target quantum state that stores the solution result of the discrete logarithm problem;
[0219] Extraction module 123 is used to extract the solution result from the first target quantum state.
[0220] Optionally, the initial quantum state is prepared by an information quantum register including a first number of qubits, the quantum computing module includes a quantum Fourier transform module and a quantum mathematical operation module, and the input module 122 is further used for:
[0221] Obtain a parametric quantum register comprising a second number of qubits, and prepare the parametric quantum register into a superposition state formed by qubit states of equal amplitude;
[0222] The initial quantum state and the superposition state are input into the quantum mathematical operation module to obtain the second target quantum state. When in the second target quantum state, the quantum state of the information quantum register and the quantum state of the parameter quantum register satisfy the entanglement relationship corresponding to the preset mathematical operation.
[0223] The quantum state of the parameter quantum register in the second target quantum state is input into the quantum Fourier transform module to obtain the first target quantum state.
[0224] Optionally, the quantum mathematical operation module includes a first mathematical operation module and a second mathematical operation module cascaded together; the information quantum register includes a first information quantum register and a second information quantum register; the parameter quantum register includes a first parameter quantum register and a second parameter quantum register; and the input module 122 is further configured to:
[0225] The quantum state of the first information quantum register in the initial quantum state and the quantum state of the first parameter quantum register in the superposition state are input into the first mathematical operation module to obtain the intermediate quantum state;
[0226] The quantum state of the second information quantum register in the initial quantum state, the quantum state of the second parameter quantum register in the superposition state, and the intermediate quantum state are input into the second mathematical operation module to obtain the second target quantum state.
[0227] Optionally, both the first mathematical operation module and the second mathematical operation module are modular exponentiation modules.
[0228] Optionally, both the first mathematical operation module and the second mathematical operation module are elliptic curve multiplication modules.
[0229] Optionally, the quantum Fourier transform module includes a module for implementing the forward quantum Fourier transform and / or a module for implementing the inverse quantum Fourier transform.
[0230] Optionally, the extraction module 123 is also used for:
[0231] The parameter quantum register in the first target quantum state is measured to obtain the measurement result;
[0232] Based on the measurement results, a matrix L is constructed, and the matrix L satisfies the following form:
[0233]
[0234] Where A := diag(u,…,u), u is the maximum number of eigenstates of the first parameter quantum register, and the vector The elements in the array are the measurement results corresponding to the first parameter quantum register;
[0235] The generator subspace of matrix L is obtained based on the row vectors of matrix L;
[0236] For any vector in the generated subspace, the last element of the vector is taken as the logarithm to be verified.
[0237] Determine that the logarithm to be verified satisfies the logarithmic relation of the discrete logarithm problem;
[0238] The logarithm to be verified is determined as the solution result.
[0239] Optionally, the measurement results are multiple, and the extraction module 123 is further used for:
[0240] A matrix L is constructed by obtaining a preset number of measurement results from all the measurement results.
[0241] Optionally, the device 120 further includes:
[0242] The calculation module is used to calculate the target distance between each vector in the generated subspace and a reference vector before the extraction module obtains the last element of any vector in the generated subspace as the logarithm to be verified. The last element of the reference vector is 0, and the remaining elements are -2. n The product of the measurement results corresponding to the second quantum register, where n is the difference between the number of qubits in the first quantum register and the second quantum register;
[0243] The first determining module is used to determine that the distance to each target is less than a preset distance.
[0244] Optionally, the device 120 further includes:
[0245] The second determining module is used to determine that any of the target distances is greater than or equal to the preset distance;
[0246] The reconstruction module obtains a preset number of new measurement results from all the measurement results to construct matrix L′;
[0247] Return to the execution module, which is used to take the matrix L′ as the matrix L, and return to the step of executing the generation subspace of the matrix L based on the row vectors of the matrix L.
[0248] Optionally, the preset distance is Where s is the preset quantity.
[0249] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0250] Another embodiment of the present invention provides a storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when running.
[0251] Specifically, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0252] Another embodiment of the present invention provides an electronic device including a memory and a processor, the memory storing a computer program, the processor being configured to run the computer program to perform the steps in any of the method embodiments described above.
[0253] Specifically, the aforementioned electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the aforementioned processor, and the input / output device is connected to the aforementioned processor.
[0254] Specifically, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0255] The input data of the discrete logarithm problem is obtained and converted into an initial quantum state; the initial quantum state is input into a quantum computing module for solving the discrete logarithm problem to obtain a first target quantum state storing the solution result of the discrete logarithm problem; the solution result is extracted from the first target quantum state.
[0256] The above description, based on the embodiments shown in the figures, details the structure, features, and effects of the present invention. The above description is only a preferred embodiment of the present invention, but the present invention is not limited to the scope of implementation shown in the figures. Any changes made in accordance with the concept of the present invention, or equivalent embodiments modified to have equivalent changes, that do not exceed the spirit covered by the specification and figures, should be within the protection scope of the present invention.
Claims
1. A method for solving the discrete logarithm problem, characterized in that, The method includes: The input data of the discrete logarithm problem is obtained, and the input data is transformed into an initial quantum state, which is prepared by an information quantum register including a first number of qubits; A parameter quantum register comprising a second number of qubits is obtained, and the parameter quantum register is prepared to a superposition state formed by qubit states of equal amplitude. The parameter quantum register includes a first parameter quantum register and a second parameter quantum register, the information quantum register includes a first information quantum register and a second information quantum register, and the quantum computing module includes a quantum Fourier transform module and a quantum mathematical operation module. The quantum mathematical operation module includes a first mathematical operation module and a second mathematical operation module cascaded together. The quantum state of the first information quantum register in the initial quantum state and the quantum state of the first parameter quantum register in the superposition state are input into the first mathematical operation module to obtain the intermediate quantum state; The quantum state of the second information quantum register in the initial quantum state, the quantum state of the second parameter quantum register in the superposition state, and the intermediate quantum state are input into the second mathematical operation module to obtain the second target quantum state. When in the second target quantum state, the quantum state of the information quantum register and the quantum state of the parameter quantum register satisfy the entanglement relationship corresponding to the preset mathematical operation. The quantum state of the parameter quantum register in the second target quantum state is input into the quantum Fourier transform module to obtain the first target quantum state; The parameter quantum register in the first target quantum state is measured to obtain multiple measurement results; A matrix is constructed by obtaining a predetermined number of measurement results from all the measurement results. The matrix It must meet the following form: in, , The vector represents the maximum number of eigenstates of the first parameter quantum register. The elements in the array are the measurement results corresponding to the first parameter quantum register; Based on the matrix The matrix is obtained from the row vectors. The generated subspace; Calculate the target distance between each vector in the generated subspace and the reference vector, where the last element of the reference vector is 0 and the remaining elements are... The product of the measurement results corresponding to the second parameter quantum register, where n is the difference between the number of qubits in the first parameter quantum register and the second parameter quantum register; Determine whether the distance to each target is less than a preset distance, wherein the preset distance is... ,in, The preset quantity; If all target distances are less than the preset distance, for any vector in the generated subspace, the last element of that vector is taken as the logarithm to be verified. Determine that the logarithm to be verified satisfies the logarithmic relation of the discrete logarithm problem; The logarithm to be verified is determined as the solution result.
2. The method as described in claim 1, characterized in that, Both the first mathematical operation module and the second mathematical operation module are modular exponentiation modules.
3. The method as described in claim 1, characterized in that, Both the first mathematical operation module and the second mathematical operation module are elliptic curve multiplication modules.
4. The method as described in claim 1, characterized in that, The quantum Fourier transform module includes a module for implementing the forward quantum Fourier transform and / or a module for implementing the inverse quantum Fourier transform.
5. The method as described in claim 1, characterized in that, Before obtaining the last element of any vector in the generated subspace as the logarithm to be verified if all target distances are less than the preset distance, the method further includes: If any of the target distances is greater than or equal to the preset distance, then a preset number of new measurement results are obtained from all the measurement results to construct a matrix. ; The matrix As the matrix and return to the execution based on the matrix. The matrix is obtained from the row vectors. The process of generating subspaces continues until all target distances are less than the preset distance.
6. An apparatus for solving discrete logarithm problems, characterized in that, The device includes: A conversion module is used to acquire input data of the discrete logarithm problem and convert the input data into an initial quantum state, wherein the initial quantum state is prepared by an information quantum register including a first number of qubits. An input module is used to acquire a parameter quantum register including a second number of qubits and prepare the parameter quantum register to a superposition state formed by quantum states of equal amplitude. The parameter quantum register includes a first parameter quantum register and a second parameter quantum register, and the information quantum register includes a first information quantum register and a second information quantum register. The quantum computing module includes a quantum Fourier transform module and a quantum mathematical operation module. The quantum mathematical operation module includes a first mathematical operation module and a second mathematical operation module that are cascaded together. The quantum state of the first information quantum register in the initial quantum state and the quantum state of the first parameter quantum register in the superposition state are input into the first mathematical operation module to obtain the intermediate quantum state; The quantum state of the second information quantum register in the initial quantum state, the quantum state of the second parameter quantum register in the superposition state, and the intermediate quantum state are input into the second mathematical operation module to obtain the second target quantum state. When in the second target quantum state, the quantum state of the information quantum register and the quantum state of the parameter quantum register satisfy the entanglement relationship corresponding to the preset mathematical operation. The quantum state of the parameter quantum register in the second target quantum state is input into the quantum Fourier transform module to obtain the first target quantum state; An extraction module is used to measure the parameter quantum register in the first target quantum state and obtain multiple measurement results; A matrix is constructed by obtaining a predetermined number of measurement results from all the measurement results. The matrix It must meet the following form: in, , The vector represents the maximum number of eigenstates of the first parameter quantum register. The elements in the array are the measurement results corresponding to the first parameter quantum register; Based on the matrix The matrix is obtained from the row vectors. The generated subspace; Calculate the target distance between each vector in the generated subspace and the reference vector, where the last element of the reference vector is 0 and the remaining elements are... The product of the measurement results corresponding to the second parameter quantum register, where n is the difference between the number of qubits in the first parameter quantum register and the second parameter quantum register; It is determined that the distance to each target is less than a preset distance, where the preset distance is... ,in, The preset quantity; For any vector in the generated subspace, the last element of the vector is taken as the logarithm to be verified. Determine that the logarithm to be verified satisfies the logarithmic relation of the discrete logarithm problem; The logarithm to be verified is determined as the solution result.
7. A storage medium, characterized in that, The storage medium stores a computer program, wherein the computer program is configured to execute the method described in any one of claims 1 to 5 when it is run.
8. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Quantum resource estimates for computing elliptic curve discrete logarithms
US20180336015A1