Doubled-point quantum computing method in elliptic curve, generic-point-addition quantum computing method in elliptic curve, and decryption method
By constructing a constant modular subtraction operator and quantum circuit in quantum computing, general point addition, double point operation and ECC ciphertext decryption of elliptic curves are realized, which solves the problem of difficulty in performing these operations efficiently in the existing technology and achieves Efficient ciphertext decryption and elliptic curve operations.
Patent Information
- Application Number
- PCT/CN2023/137893
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2022-12-28
- Filing Date
- 2023-12-11
- Publication Date
- 2024-10-03
AI Technical Summary
It is difficult to efficiently implement general point addition, double point operation and ECC ciphertext decryption in elliptic curves in quantum computing with existing technology, and there is a lack of methods for using quantum circuits to decrypt ciphertext.
By determining the quantum states of points P and Q, construct a constant modular subtraction operator, calculate the slope to implement general point addition and double point operations on the elliptic curve, and build a quantum circuit based on the base point and public key, and run to obtain discrete pairs Numerical value is used to decrypt ECC ciphertext.
It realizes efficient elliptic curve operation and ECC ciphertext decryption in quantum computing, and uses the efficient processing capabilities of quantum circuits to solve the problem of ciphertext decryption without knowing the private key.
Smart Images

Figure CN2023137893_03102024_PF_FP_ABST
Abstract
Description
Double point and general point in elliptic curve plus quantum operation method and decryption method
[0001] This application claims priority to the Chinese patent application with application number 202211716263.3 filed with the Patent Office of China on December 28, 2022, entitled “General point-added quantum operation method and related device in elliptic curve”, the Chinese patent application with application number 202211692081.7 filed with the Patent Office of China on December 28, 2022, entitled “Double point quantum operation method and related device in elliptic curve”, and the Chinese patent application with application number 202211716349.6 filed with the Patent Office of China on December 28, 2022, entitled “ECC ciphertext decryption method, device, medium and electronic device based on quantum circuit”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application belongs to the field of quantum computing technology, and in particular relates to a method for adding quantum operations and decryption methods to double points and general points in elliptic curves. Background Art
[0003] Elliptic curve cryptography (ECC) is a very important public-key cryptography system, widely used in digital currencies, mobile phone chips, communication applications (APPs), bank cards, and banking systems. While the key length of RSA (an asymmetric encryption algorithm) increases sub-exponentially with increasing security levels, the key length of ECC increases linearly. For example, 128-bit encryption requires a 3072-bit RSA key, but only a 256-bit ECC key. ECC's superior bit-rate encryption performance has made it a key focus for the National Security Agency.
[0004] In related technologies, it is necessary to encrypt ciphertext based on publicly available information without knowing the decryption private key, for example, to restore the corresponding plaintext when the private key is forgotten or lost. Based on this, a quantum circuit-based ECC ciphertext decryption method is proposed.
[0005] Summary of the Invention
[0006] One embodiment of the present application provides a general point addition quantum operation method in an elliptic curve, the method comprising: determining the quantum state corresponding to point P, and constructing a constant modular operator based on point Q, wherein point P and point Q are any two points in the elliptic curve that do not overlap and are not symmetric about the x-axis except for the point at infinity; determining the slope of the straight line determined by point P and point Q based on the quantum state corresponding to point P and the constant modular subtraction operator; and determining the general point addition operation result of point P and point Q based on the slope.
[0007] Another embodiment of the present application provides a general point addition quantum operation device in an elliptic curve, the device including a processing unit, configured to: determine the quantum state corresponding to a point P, and construct a constant modular subtraction operator based on a point Q, wherein the point P and the point Q are any two points in the elliptic curve that do not overlap and are not symmetric about the x-axis except for the point at infinity; determine the slope of the straight line determined by the point P and the point Q based on the quantum state corresponding to the point P and the constant modular subtraction operator; and determine the result of the general point addition operation of the point P and the point Q based on the slope.
[0008] Another embodiment of the present application provides a double-point quantum operation method in an elliptic curve, the method comprising: determining the quantum state corresponding to a point P, where the point P is any point in the elliptic curve whose vertical coordinate is not 0; determining the slope of the tangent of the elliptic curve at the point P based on the quantum state corresponding to the point P; and determining the double-point operation result of the point P based on the slope.
[0009] Another embodiment of the present application provides a double-point quantum operation device in an elliptic curve, the device including a processing unit for: determining the quantum state corresponding to a point P, where the point P is any point in the elliptic curve whose vertical coordinate is not 0; determining the slope of the tangent of the elliptic curve at the point P based on the quantum state corresponding to the point P; and determining the double-point operation result of the point P based on the slope.
[0010] Another embodiment of the present application provides an ECC ciphertext decryption method based on a quantum circuit, the method comprising: obtaining a base point and a public key corresponding to an ECC ciphertext; constructing a controlled point addition operation based on the base point and the public key; constructing a quantum circuit based on the controlled point addition operation; running the quantum circuit to obtain a discrete logarithmic value; and decrypting the ECC ciphertext based on the discrete logarithmic value.
[0011] Another embodiment of the present application provides an ECC ciphertext decryption device based on a quantum circuit, the device comprising: an acquisition unit, configured to acquire a base point and a public key corresponding to an ECC ciphertext; a construction unit, configured to construct a controlled point addition operation based on the base point and the public key; a quantum circuit constructed based on the controlled point addition operation; an operation unit, configured to execute the quantum circuit to obtain a discrete logarithmic value; and a decryption unit, configured to decrypt the ECC ciphertext based on the discrete logarithmic value.
[0012] Yet another embodiment of the present application provides a storage medium storing a computer program, wherein the computer program is configured to execute any one of the methods described in the present application when run.
[0013] Yet another embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute any one of the methods described in the present application.
[0014] Compared with the prior art, the present application provides a quantum circuit-based ECC ciphertext decryption method, device, medium, and electronic device. The method first obtains the base point and public key corresponding to the ECC ciphertext, constructs a controlled point addition operation based on the base point and public key, and then constructs a quantum circuit. The discrete logarithm value is obtained through the result of the quantum circuit operation. This discrete logarithm value is the private key. Finally, the ECC ciphertext is decrypted based on the discrete logarithm value, thereby realizing the decryption of the ECC ciphertext by constructing a quantum circuit through the base point and public key without knowing the private key. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The drawings described herein are used to provide further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute improper limitations on the present application.
[0016] FIG1 is a block diagram of the hardware structure of a computer terminal provided in an embodiment of the present application;
[0017] FIG2 is a schematic diagram of a flow chart of a general point-based quantum operation method in an elliptic curve provided in an embodiment of the present application;
[0018] FIG3 is a schematic diagram of a quantum circuit for a general point addition operation in an elliptic curve provided by an embodiment of the present application;
[0019] FIG4 is a schematic diagram of a flow chart of a general point-based quantum computing device in an elliptic curve according to an embodiment of the present application;
[0020] FIG5 is a schematic diagram of a flow chart of a double-point quantum operation method in an elliptic curve provided in an embodiment of the present application;
[0021] FIG6 is a schematic diagram of a quantum circuit for a double point operation in an elliptic curve provided by an embodiment of the present application;
[0022] FIG7 is a schematic structural diagram of a double-point quantum operation device in an elliptic curve provided by an embodiment of the present application;
[0023] FIG8 is a schematic diagram of a flow chart of an ECC ciphertext decryption method based on quantum circuits provided in an embodiment of the present application;
[0024] FIG9 is a schematic diagram of the structure of a quantum circuit provided in an embodiment of the present application;
[0025] FIG10 is a schematic diagram of the structure of another quantum circuit provided in an embodiment of the present application;
[0026] FIG11 is a schematic diagram of the structure of an ECC ciphertext decryption device based on quantum circuits provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] To make the objectives, technical solutions, and advantages of this application more clearly understood, the present application is further described below with reference to the accompanying drawings and examples. It is apparent that the described examples are only a portion of the embodiments of this application, and not all of them. All other embodiments derived by persons of ordinary skill in the art based on the examples in this application are intended to fall within the scope of protection of this application.
[0028] Elliptic curves are a special type of algebraic curve. All rational points on them form an additive group, and addition operates on them like geometric addition. Take two points P(x1, y1) and Q(x2, y2) on an elliptic curve. If P ≠ ±Q and P and Q are not points at infinity O, then draw a straight line connecting P and Q. This line will intersect the elliptic curve at a third point, G. Then, draw a line perpendicular to the x-axis through G, passing through another point R on the elliptic curve (generally a point symmetric about the x-axis). Point R is defined as the result of P + Q, i.e., P + Q = R. This operation is called the general point addition operation on an elliptic curve. Take two points P(x1, y1) and Q(x2, y2) on the elliptic curve. If P=Q and y1≠0, then determine the tangent of the elliptic curve at point P. This tangent will intersect at point G on the elliptic curve. Draw a straight line perpendicular to the x-axis through point G, passing through another point R on the elliptic curve (generally a point symmetrical about the x-axis). Point R is defined as the result of doubling P, that is, 2P=R. This operation process is called the doubling point operation of the elliptic curve.
[0029] General point addition and doubling operations based on elliptic curves are one of the core principles of ECC. Its security is mainly based on the elliptic curve discrete logarithm problem: given two points P and Q on an elliptic curve, and satisfying [d]P=Q, solve the discrete logarithm d.
[0030] A quantum computer is a physical device that follows the laws of quantum mechanics to perform high-speed mathematical and logical operations, and to store and process quantum information. When a device processes and calculates quantum information and runs quantum algorithms, it is considered a quantum computer. Quantum computers offer greater efficiency than conventional computers in solving mathematical problems. However, implementing general point addition and doubling operations on elliptic curves, as well as ECC ciphertext decryption, through quantum computing has become a pressing technical challenge.
[0031] The following is a detailed description of the method using a computer terminal as an example. Figure 1 is a hardware block diagram of a computer terminal for a general point plus quantum operation method in an elliptic curve, a double point quantum operation method in an elliptic curve, or an ECC ciphertext decryption method based on a quantum circuit, provided in an embodiment of the present application. As shown in Figure 1, the computer terminal may include one or more (only one is shown in Figure 1) processors 102 (the processor 102 may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing the general point plus quantum operation method in an elliptic curve, the double point quantum operation method in an elliptic curve, or the ECC ciphertext decryption method based on a quantum circuit. Optionally, the computer terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It will be understood by those skilled in the art that the structure shown in Figure 1 is merely illustrative and does not limit the structure of the computer terminal. For example, the computer terminal may also include more or fewer components than shown in Figure 1, or have a configuration different from that shown in Figure 1.
[0032] Memory 104 can be used to store software programs and modules for application software, such as the program instructions / modules corresponding to the general point-plus-quantum operation method in elliptic curves, the double-point quantum operation method in elliptic curves, or the quantum circuit-based ECC ciphertext decryption method in the embodiments of the present application. Processor 102 executes the software programs and modules stored in memory 104 to execute various functional applications and data processing, thereby implementing the aforementioned methods. 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, memory 104 may further include memory remotely located relative to processor 102, and these remote memories may be connected to the 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.
[0033] The transmission device 106 is used to receive or send data via a network. A specific example of the aforementioned network may include a wireless network provided by a communications provider of a computer terminal. In one embodiment, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0034] It's important to note that a true quantum computer has a hybrid architecture, consisting of two main components: a classical computer, responsible for performing classical computations and control, and a quantum device, responsible for running quantum programs and thus achieving quantum computations. A quantum program is a sequence of instructions written in a quantum language, such as QRunes, that can be executed on a quantum computer. This supports quantum logic gate operations and ultimately enables quantum computations. Specifically, a quantum program is a sequence of instructions that operate quantum logic gates in a specific time sequence.
[0035] In practical applications, due to the development of quantum device hardware, it is usually necessary to perform quantum computing simulation to verify quantum algorithms, quantum applications, etc. Quantum computing simulation is the process of simulating the operation of quantum programs corresponding to specific problems using a virtual architecture (i.e., quantum virtual machine) built with the resources of an ordinary computer. Generally, it is necessary to build a quantum program corresponding to a specific problem. The quantum program referred to in the embodiment of the present application is a program that characterizes quantum bits and their evolution written in classical language, in which quantum bits, quantum logic gates, etc. related to quantum computing are represented by corresponding classical codes.
[0036] Quantum circuits, as a manifestation of quantum programs, also known as quantum logic circuits, are the most commonly used general quantum computing model. They represent circuits that operate on quantum bits in an abstract concept. Their components include quantum bits, circuits (timelines), and various quantum logic gates. Finally, the results often need to be read out through quantum measurement operations.
[0037] Unlike traditional circuits, which are connected by metal wires to transmit voltage or current signals, in quantum circuits, the circuits can be seen as connected by time. In other words, the state of the quantum bit naturally evolves over time, following the instructions of the Hamiltonian operator until it encounters a logic gate and is operated.
[0038] A quantum program as a whole corresponds to a total quantum circuit. The quantum program described in this application refers to this total quantum circuit, wherein the total number of quantum bits in the total quantum circuit is the same as the total number of quantum bits in the quantum program. It can be understood that a quantum program can be composed of a quantum circuit, measurement operations on the quantum bits in the quantum circuit, registers for storing measurement results, and control flow nodes (jump instructions). A quantum circuit can contain dozens, hundreds, or even thousands of quantum logic gate operations. The execution process of a quantum program is the process of executing all quantum logic gates in a certain time sequence. It should be noted that the time sequence is the time order in which individual quantum logic gates are executed.
[0039] It should also be noted that the present application relates to quantum computers. In ordinary computing devices based on silicon chips, the units that process the chips are CMOS tubes. This type of computing unit is not restricted by time and intermittency, that is, this type of computing unit is not restricted by the length of use and is available at any time. In addition, at present, the number of such computing units in silicon chips is sufficient, that is, the number of computing units in a single chip is currently in the tens of thousands. The number of computing units is sufficient and the computing logic that can be selected by CMOS tubes is fixed, for example: AND logic. When performing calculations with the help of CMOS tubes, a large number of CMOS tubes are combined with limited logical functions to achieve the computing effect.
[0040] Unlike the logic units in conventional computing devices, the fundamental computing unit in current quantum computers is the qubit. The input to a qubit is limited by coherence and coherence time, meaning that a qubit is time-limited and not always available. Fully utilizing qubits within their available lifetime is a key challenge in quantum computing. Furthermore, the number of qubits in a quantum computer is a key performance indicator. Each qubit performs computational functions through on-demand logic functions. Given the limited number of qubits, the logical functions in quantum computing are diverse, including 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, CNOT gates, CR gates, iSWAP gates, and Toffoli gates. Quantum logic gates are generally represented using unitary matrices. Unitary matrices are not only a matrix form but also a type of operation and transformation. Generally, quantum logic gates operate on quantum states by multiplying a unitary matrix on the left by the matrix corresponding to the quantum state's right vector. Quantum computations utilize a limited number of quantum bits combined with a variety of logical functions to achieve computational effects.
[0041] Given these differences in quantum computers, the design of how logical functions are applied to qubits (including whether or not qubits are used, and how efficiently each qubit is used) is key to improving their computing performance and requires specialized design. However, this qubit-specific design is a technical issue that conventional computing devices don't need to consider or address.
[0042] Based on this, in order to realize the general point addition operation in elliptic curves in quantum computing, this application proposes a general point addition operation method and related devices in elliptic curves, aiming to realize the general point addition operation in elliptic curves through quantum circuits, thereby facilitating the use of the efficient processing power of quantum computing to decrypt ciphertext.
[0043] In the elliptic curve cryptography system, the elliptic curve on the finite field is mainly used. This application mainly considers the elliptic curve E / F on the prime field. P , where p is the characteristic of the finite field and is a prime number greater than 3. Therefore, all operations in this application are operations under the modulo p. This application considers general point addition operations: if P≠±Q and P and Q are not infinite points O, that is, points P and Q are any two points in the elliptic curve that do not coincide with each other and are not symmetric about the x-axis except for infinite points, then: x3=(λ 2 -x1-x2)mod p, y3=(λ(x1-x3)-y1)mod p,
[0044] in, (x1, y1) are the coordinates of point P, (x2, y2) are the coordinates of point Q, (x3, y3) are the coordinates of point R, P+Q=R, and λ is the slope of the straight line determined by points P and Q.
[0045] Therefore, if λ can be determined, the horizontal and vertical coordinates of point R can be expressed using λ and the coordinates of points P and Q.
[0046] See Figure 2, which is a flow chart of a general point-based quantum computation method in an elliptic curve according to an embodiment of the present application. The method includes the following steps:
[0047] Step 201: Determine the quantum state corresponding to point P, and construct a constant modular subtraction operator based on point Q, where point P and point Q are any two points on the elliptic curve that do not overlap and are not symmetric about the x-axis except for the point at infinity;
[0048] The quantum states corresponding to the point P(x1, y1) are |x1> and |y1>, which are stored by the first quantum register and the second quantum register respectively.
[0049] A set of quantum bits is called a quantum register, and the first quantum register and the second quantum register include at least one quantum bit.
[0050] Optionally, constructing a constant modular subtraction operator based on point Q includes:
[0051] Construct a first constant modular subtraction operator with a constant of x2 and a modulus of p and a second constant modular subtraction operator with a constant of y2 and a modulus of p.
[0052] The constant modular subtraction operator can be constructed based on the inverse quantum circuit corresponding to the constant modular addition operator. Specifically, performing a transpose conjugation operation on the quantum logic gates in the constant modular addition operator and then applying it to the qubits can generate the quantum circuit corresponding to the constant modular subtraction operator. The constant modular subtraction operator is the quantum logic gates acting in sequence in this quantum circuit. For information on the constant modular addition operator, please refer to the Chinese patent application number '202211114261.7', entitled 'Constant modular addition operator, method, and related device based on quantum Fourier transform'. Of course, other implementations are also possible and are not limited here.
[0053] Step 202: determining the slope of the straight line defined by the point P and the point Q based on the quantum state corresponding to the point P and the constant modular subtraction operator;
[0054] Optionally, determining the slope of a straight line defined by the point P and the point Q based on the quantum state corresponding to the point P and the constant modular subtraction operator includes:
[0055] Applying the first constant modular subtraction operator to the first quantum register and applying the second constant modular subtraction operator to the second quantum register to obtain a first quantum register with a quantum state of |(x1-x2) mod p> and a second quantum register with a quantum state of |(y1-y2) mod p>;
[0056] Perform the inverse modular multiplication operation on the first quantum register to obtain the quantum state |(x1-x2) -1 mod p>'s first quantum register;
[0057] Perform variable modular multiplication on the first quantum register, the second quantum register and the auxiliary quantum register with quantum state |0> to obtain the quantum state The auxiliary quantum register, The slope λ of the straight line determined by the point P and the point Q.
[0058] Among them, the constant modular subtraction operator is a series of quantum logic gates acting on quantum bits in a certain order. Therefore, here the first constant modular subtraction operator is applied to the first quantum register and the second constant modular subtraction operator is applied to the second quantum register, that is, the quantum logic gate corresponding to the first constant modular subtraction operator is applied to the quantum bits included in the first quantum register, and the quantum logic gate corresponding to the second constant modular subtraction operator is applied to the quantum bits included in the second quantum register, so that the quantum states of the quantum bits in the first quantum register and the second quantum register evolve.
[0059] Here, the quantum state of the first quantum register evolves from |x1> to |(x1-x2) mod p>, and the quantum state of the second quantum register evolves from |y1> to |(y1-y2) mod p>. The inverse modular multiplication operation is performed on the first quantum register. The inverse modular multiplication operation also applies its corresponding quantum logic gate to the quantum bits included in the first quantum register. The quantum state of the first quantum register evolves from |(x1-x2) mod p> to |(x1-x2) -1 mod p>, the quantum state of the second quantum register remains unchanged, still |(y1-y2) mod p>. The specific implementation of the inverse operation of modular multiplication can be found in Chinese patent application number "202211465261.1," entitled "Construction Method, Apparatus, Medium, and Electronic Device for Modular Inverse Quantum Circuit."
[0060] The variable modular multiplication operation is performed on the first quantum register, the second quantum register, and the auxiliary quantum register whose quantum state is |0>, that is, the quantum logic gate corresponding to the variable modular multiplication operation is applied to the quantum bits included in the first quantum register, the second quantum register, and the auxiliary quantum register, and the quantum states of the first quantum register and the second quantum register remain unchanged, which are |(x1-x2) respectively. -1 Mod p> and |(y1-y2) mod p>, the quantum state of the auxiliary quantum register evolves from |0> to |λ mod p>. The specific implementation of the variable modular multiplication operation can be found in the Chinese patent application number "202211465294.6," entitled "Variable modular multiplication operator, operation method, and related device."
[0061] Step 203: Determine a general point addition result of the point P and the point Q based on the slope.
[0062] Optionally, determining a general point addition result of the point P and the point Q based on the slope includes:
[0063] Evolving the quantum state of the first quantum register into a quantum state including the coordinates of the point R based on the slope, and evolving the quantum state of the second quantum register into a quantum state including the coordinates of the point R based on the slope;
[0064] A general point addition result of the point P and the point Q is determined based on the first quantum register and the second quantum register including the quantum state of the coordinate of the point R.
[0065] Specifically, evolving the quantum state of the first quantum register into a quantum state including the coordinates of the point R based on the slope includes:
[0066] Performing an inverse modular multiplication operation on the first quantum register to obtain a first quantum register with a quantum state of |(x1-x2) mod p>;
[0067] The quantum state of the second quantum register |(y1-y2) mod p> is reset to |0>, and the variable square modulus operation is performed on the auxiliary quantum register and the second quantum register to obtain the quantum state |λ 2 the second quantum register mod p>;
[0068] Perform a variable modular subtraction operation on the first quantum register and the second quantum register to obtain the quantum state |(x1-x2-λ 2 )mod p>'s first quantum register;
[0069] A constant modular addition operation with a constant of 3x2 is performed on the first quantum register to obtain a first quantum register with a quantum state of |-(x3-x2)mod p>.
[0070] Furthermore, resetting the quantum state |(y1-y2) mod p> of the second quantum register to |0> comprises:
[0071] An inverse variable modular multiplication operation is performed on the auxiliary quantum register, the first quantum register, and the second quantum register to obtain a second quantum register with a quantum state of |0>.
[0072] The quantum logic gate corresponding to the inverse variable modular multiplication operation is transposed conjugate with the quantum logic gate corresponding to the variable modular multiplication operation. An inverse variable modular multiplication operation is performed on the auxiliary quantum register, the first quantum register, and the second quantum register. That is, the quantum logic gate corresponding to the inverse variable modular multiplication operation is applied to the quantum bits included in the auxiliary quantum register, the first quantum register, and the second quantum register. The quantum states of the first quantum register and the auxiliary quantum register remain unchanged, namely, |(x1-x2) mod p> and |λ mod p>, respectively. The quantum state of the second quantum register evolves from |(y1-y2) mod p> to |0>.
[0073] Of course, there are other ways to implement the resetting of the quantum state of the second quantum register |(y1-y2) mod p> to |0>. Here, the inverse variable modular multiplication operation is only a preferred implementation method provided by the embodiment of the present application. When implemented by other methods, this step can be performed by performing a variable modular subtraction operation on the first quantum register and the second quantum register to obtain a quantum state of |(x1-x2-λ 2 )mod p>, a variable modular subtraction operation can also be performed on the first quantum register and the second quantum register to obtain a quantum state of |(x1-x2-λ 2 )mod p>after the first quantum register.
[0074] Wherein, the auxiliary quantum register and the second quantum register are subjected to variable square modulo operation to obtain the quantum state |λ 2 mod p>, that is, the quantum logic gate corresponding to the square modulo operation of the variable acts on the auxiliary quantum bit and the quantum bit included in the second quantum register. The quantum state of the auxiliary quantum register is |λmod p>, which remains unchanged. The quantum state of the second quantum register evolves from |0> to |λ 2 For the specific implementation of the variable square modulo operation, please refer to the Chinese patent document with application number "202211464665.9" and titled "Variable square modulo operator, operation method and related device".
[0075] The inverse modular multiplication operation is performed on the first quantum register to obtain a first quantum register with a quantum state of |(x1-x2) mod p>, that is, the quantum logic gate of the inverse modular multiplication operation is applied to the quantum bits included in the first quantum register, and the quantum state of the first quantum register is |(x1-x2) mod p>. -1 mod p> evolves to |(x1-x2)mod p>. For the specific implementation of the inverse operation of modular multiplication, please refer to the Chinese patent application number "202211465261.1" and titled "Construction Method, Apparatus, Medium and Electronic Device for Modular Inverse Quantum Circuit."
[0076] The first quantum register and the second quantum register are subjected to a variable modular subtraction operation, and the quantum state obtained is |(x1-x2-λ 2 )mod p>, that is, the quantum logic gate corresponding to the variable modular reduction operation acts on the quantum bits included in the first quantum register and the second quantum register, and the quantum state of the second quantum register is |λ 2mod p>, remains unchanged, and the quantum state of the first quantum register evolves from |(x1-x2)mod p> to |(x1-x2-λ 2 The quantum logic gate corresponding to the variable modular subtraction operation is transposed conjugate with the quantum logic gate corresponding to the variable modular addition operation. The specific implementation of the variable modular addition operation can be found in the Chinese patent application number "202211465284.2" and the title "Variable modular addition operator, operation method and related device based on constant addition and subtraction".
[0077] A constant modular addition operation with a constant of 3x2 is performed on the first quantum register to obtain a first quantum register with a quantum state of |-(x3-x2) mod p>, that is, the quantum logic gate corresponding to the constant modular addition operation is applied to the quantum bits included in the first quantum register, and the quantum state of the first quantum register is |(x1-x2-λ 2 ) mod p> evolves to |-(x3-x2) mod p>. For the specific implementation of the constant modular addition operation, refer to the Chinese patent application number "202211114261.7" and titled "Constant modular addition operator, method and related device based on quantum Fourier transform."
[0078] Specifically, evolving the quantum state of the second quantum register into a quantum state including the coordinates of the point R based on the slope includes:
[0079] The quantum state of the second quantum register |λ 2 mod p> is reset to |0>, and a variable modular multiplication operation is performed on the auxiliary quantum register, the first quantum register, and the second quantum register to obtain a second quantum register with a quantum state of |(y2+y3)mod p>.
[0080] Furthermore, the quantum state of the second quantum register |λ 2 mod p> is reset to |0>, including:
[0081] An inverse variable square modulo operation is performed on the second quantum register and the auxiliary quantum register to obtain a second quantum register with a quantum state of |0>.
[0082] The second quantum register and the auxiliary quantum register are subjected to an inverse variable square modulo operation to obtain a second quantum register with a quantum state of |0>, that is, the quantum logic gate corresponding to the inverse variable square modulo operation is applied to the quantum bits included in the second quantum register and the auxiliary quantum register, and the quantum state of the auxiliary register is |λmod p>, which remains unchanged. The quantum state of the second quantum register is changed from |λ 2mod p> evolves to |0>. The quantum logic gate corresponding to the inverse variable square modulo operation is the transposed conjugate of the quantum logic gate corresponding to the variable square modulo operation. The specific implementation of the variable square modulo operation can be found in Chinese patent application number "202211464665.9," entitled "Variable Square Modulo Operator, Operation Method, and Related Device."
[0083] A variable modular multiplication operation is performed on the auxiliary quantum register, the first quantum register, and the second quantum register to obtain a second quantum register with a quantum state of |(y²+y³) mod p>. This operation involves applying the quantum logic gate corresponding to the variable modular multiplication operation to the qubits included in the auxiliary quantum register and the first quantum register. The quantum states of the auxiliary quantum register and the first quantum register remain unchanged, namely |λ mod p> and |-(x³-x²) mod p>, respectively. The quantum state of the second quantum register evolves from |0> to |(y²+y³) mod p>. For a specific implementation of the variable modular multiplication operation, see Chinese patent application number 202211465294.6, entitled "Variable modular multiplication operator, operation method, and related device."
[0084] Specifically, determining the general point addition result of the point P and the point Q based on the first quantum register and the second quantum register including the quantum state of the coordinate of the point R includes:
[0085] Performing an inverse modular addition operation on the first quantum register to obtain a first quantum register with a quantum state of |(x3-x2) mod p>;
[0086] Performing a constant modular addition operation with a constant x2 on the first quantum register and a constant modular subtraction operation with a constant y2 on the second quantum register to obtain a first quantum register with a quantum state of |x3 mod p> and a second quantum register with a quantum state of |y3 mod p>;
[0087] A general point addition result of the point P and the point Q is determined based on the |x3mod p> and |y3mod p>.
[0088] A modular inverse addition operation is performed on the first quantum register to obtain a first quantum register with a quantum state of |(x3-x2) mod p>. This means that the quantum logic gate corresponding to the modular inverse addition operation is applied to the qubits included in the first quantum register, and the quantum state of the first quantum register evolves from |-(x3-x2) mod p> to |(x3-x2) mod p>. The specific implementation of the modular inverse addition operation can be found in Chinese patent application number "202211465261.1," entitled "Construction Method, Apparatus, Medium, and Electronic Device for Modular Inverse Quantum Circuit."
[0089] Furthermore, for any number x, finding -x mod p is equivalent to calculating (p-1)·x mod p, thus the inverse modular addition operation can also be implemented via a constant modular multiplication operation with a constant value of (p-1). For a specific implementation of the constant modular multiplication operation, see Chinese patent application number "202211125591.6," titled "Constant modular addition and modular multiplication operator, modular multiplication operator, operation method, and related device."
[0090] In which, a constant modular addition operation with a constant x2 is performed on the first quantum register, and a constant modular subtraction operation with a constant y2 is performed on the second quantum register, to obtain a first quantum register with a quantum state of |x3mod p> and a second quantum register with a quantum state of |y3mod p>, that is, the quantum logic gate corresponding to the constant modular addition operation is applied to the quantum bits included in the first quantum register, and the quantum state of the first quantum register evolves from |(x3-x2)mod p> to |x3mod p>; the quantum logic gate corresponding to the constant modular subtraction operation is applied to the quantum bits included in the second quantum register, and the quantum state of the second quantum register evolves from |(y2+y3)mod p> to |y3mod p>.
[0091] The general point addition result of the point P and the point Q is determined based on |x3mod p> and |y3mod p>, that is, (x3, y3) is used as the general point addition result of the point P and the point Q.
[0092] Furthermore, in order to save quantum bit resources, the auxiliary quantum register can be reset to facilitate the use of the quantum bits included in the auxiliary quantum register for other data calculations or storage. The method further includes:
[0093] Resetting the quantum state |λ mod p> of the auxiliary quantum register to |0>.
[0094] Here, resetting the quantum state |λ mod p> of the auxiliary quantum register to |0> may be performed before or after the step of performing the inverse modular addition operation on the first quantum register to obtain the first quantum register with the quantum state |(x3-x2) mod p>, and is not limited here.
[0095] In a specific implementation of the present application, after performing the inverse modular addition operation on the first quantum register to obtain the first quantum register with a quantum state of |(x3-x2) mod p>, resetting the quantum state |λ mod p> of the auxiliary quantum register to |0> includes:
[0096] Perform the inverse modular multiplication operation on the first quantum register to obtain the quantum state |(x3-x2)-1 mod p>'s first quantum register;
[0097] Performing an inverse variable modular multiplication operation on the first quantum register, the second quantum register, and the auxiliary quantum register to obtain an auxiliary quantum register with a quantum state of |0>;
[0098] Perform an inverse modular multiplication operation on the first quantum register to obtain a first quantum register with a quantum state of |(x3-x2)mod p>.
[0099] The inverse modular multiplication operation is performed on the first quantum register to obtain the quantum state |(x3-x2) -1 mod p>, that is, the quantum logic gate corresponding to the inverse operation of modular multiplication acts on the quantum bits included in the first quantum register, and the quantum state of the first quantum register evolves from |(x3-x2)mod p> to |(x3-x2) -1 mod p>.
[0100] The inverse variable modular multiplication operation is performed on the first quantum register, the second quantum register, and the auxiliary quantum register to obtain an auxiliary quantum register with a quantum state of |0>. That is, the quantum logic gate corresponding to the inverse variable modular multiplication operation is applied to the quantum bits included in the first quantum register, the second quantum register, and the auxiliary quantum register. The quantum states corresponding to the first quantum register and the second quantum register remain unchanged, which are |(x3-x2) respectively. -1 mod p> and |(y2+y3)mod p>, the auxiliary quantum register evolves from |λmod p> to |0>. The quantum logic gate corresponding to the inverse variable modular multiplication operation is transposed conjugate with the quantum logic gate corresponding to the variable modular multiplication operation.
[0101] The first quantum register is subjected to a modular inverse multiplication operation to obtain a first quantum register with a quantum state of |(x3-x2) mod p>, that is, the quantum logic gate corresponding to the modular inverse multiplication operation is applied to the quantum bits included in the first quantum register, and the quantum state of the first quantum register is changed from |(x3-x2) -1 mod p> evolves to |(x3-x2)mod p>.
[0102] As shown in FIG3 , FIG3 is a schematic diagram of a quantum circuit for a general point addition operation in an elliptic curve provided by an embodiment of the present application. |x1> and |y1> are stored by the first quantum register and the second quantum register, respectively, and the initial quantum state of the auxiliary quantum register is |0>. The first quantum register, the second quantum register, and the auxiliary quantum register each include n quantum bits. In the figure, -x2 and -y2 are the first constant modular subtraction operator and the second constant modular subtraction operator, respectively, Inv is the inverse operation of modular multiplication or the inverse operation of modular addition, and Mul is the variable modular multiplication operation. is the inverse variable modular multiplication operation, Sqr is the variable square modular operation, is a variable modulo subtraction operation (i.e., an inverse variable modulo addition operation), +3x2 is a constant modulo addition operation, is the inverse variable square modulo operation, Neg is the inverse modular addition operation, +x2 is the constant modular addition operation, and -y2 is the constant modular subtraction operation.
[0103] Compared with the prior art, the present application provides a general point addition quantum operation method and related device in an elliptic curve. The method determines the quantum state corresponding to point P and constructs a constant modular subtraction operator based on point Q. The point P and the point Q are any two points in the elliptic curve that do not overlap and are not symmetric about the x-axis except the point at infinity; based on the quantum state corresponding to the point P and the constant modular subtraction operator, the slope of the straight line determined by the point P and the point Q is determined; based on the slope, the general point addition operation result of the point P and the point Q is determined, thereby realizing the general point addition operation in the elliptic curve through a quantum circuit, which is conducive to the subsequent use of the efficient processing power of quantum computing for ciphertext decryption.
[0104] Referring to Figure 4, Figure 4 is a schematic flow diagram of a general point addition quantum operation device on an elliptic curve provided in an embodiment of the present application. The device includes a first processing unit 401, which is configured to: determine the quantum state corresponding to point P; construct a constant modular subtraction operator based on point Q, where point P and point Q are any two points on the elliptic curve that do not coincide with each other and are not symmetric about the x-axis, except for the point at infinity; determine the slope of the line defined by point P and point Q based on the quantum state corresponding to point P and the constant modular subtraction operator; and determine the result of the general point addition operation on point P and point Q based on the slope.
[0105] Optionally, the quantum states corresponding to the point P(x1, y1) are |x1> and |y1>, and |x1> and |y1> are stored by the first quantum register and the second quantum register respectively.
[0106] Optionally, the coordinates of the point Q are (x2, y2). In constructing a constant modular subtraction operator based on point Q, the first processing unit 401 is specifically used to: construct a first constant modular subtraction operator with a constant of x2 and a modulus of p and a second constant modular subtraction operator with a constant of y2 and a modulus of p.
[0107] Optionally, in determining the slope of the straight line determined by the point P and the point Q based on the quantum state corresponding to the point P and the constant modular subtraction operator, the first processing unit 401 is specifically configured to:
[0108] Applying the first constant modular subtraction operator to the first quantum register and applying the second constant modular subtraction operator to the second quantum register to obtain a first quantum register with a quantum state of |(x1-x2) mod p> and a second quantum register with a quantum state of |(y1-y2) mod p>;
[0109] Perform the inverse modular multiplication operation on the first quantum register to obtain the quantum state |(x1-x2) -1 mod p>'s first quantum register;
[0110] Perform variable modular multiplication on the first quantum register, the second quantum register and the auxiliary quantum register with quantum state |0> to obtain the quantum state The auxiliary quantum register, The slope λ of the straight line determined by the point P and the point Q.
[0111] Optionally, in the case of P+Q=R, in terms of determining the general point addition result of the point P and the point Q based on the slope, the first processing unit 401 is specifically configured to: evolve the quantum state of the first quantum register into a quantum state including the coordinates of the point R based on the slope, and evolve the quantum state of the second quantum register into a quantum state including the coordinates of the point R based on the slope; and determine the general point addition result of the point P and the point Q based on the first quantum register and the second quantum register including the quantum state of the coordinates of the point R.
[0112] Optionally, the coordinates of the point R are (x3, y3). In evolving the quantum state of the first quantum register into a quantum state including the coordinates of the point R based on the slope, the first processing unit 401 is specifically configured to: perform a modular multiplication inverse operation on the first quantum register to obtain a first quantum register with a quantum state of |(x1-x2) mod p>; reset the quantum state of the second quantum register |(y1-y2) mod p> to |0>, and perform a variable square modular operation on the auxiliary quantum register and the second quantum register to obtain a quantum state of |λ 2 mod p> the second quantum register; perform a variable modular subtraction operation on the first quantum register and the second quantum register to obtain a quantum state of |(x1-x2-λ 2 )mod p>; performing a constant modular addition operation with a constant of 3x2 on the first quantum register to obtain a first quantum register with a quantum state of |-(x3-x2)mod p>.
[0113] Optionally, in terms of resetting the quantum state |(y1-y2) mod p> of the second quantum register to |0>, the first processing unit 401 is specifically used to: perform an inverse variable modular multiplication operation on the auxiliary quantum register, the first quantum register, and the second quantum register to obtain a second quantum register with a quantum state of |0>.
[0114] Optionally, in the aspect of evolving the quantum state of the second quantum register into a quantum state including the coordinates of the point R based on the slope, the first processing unit 401 is specifically configured to: transform the quantum state of the second quantum register |λ 2 mod p> is reset to |0>, and a variable modular multiplication operation is performed on the auxiliary quantum register, the first quantum register, and the second quantum register to obtain a second quantum register with a quantum state of |(y2+y3)mod p>.
[0115] Optionally, in the step of setting the quantum state of the second quantum register |λ 2 In terms of resetting mod p> to |0>, the first processing unit 401 is specifically used to: perform an inverse variable square modulo operation on the second quantum register and the auxiliary quantum register to obtain a second quantum register with a quantum state of |0>.
[0116] Optionally, in terms of determining the general point addition operation result of the point P and the point Q based on the first quantum register and the second quantum register including the quantum state of the coordinate of the point R, the first processing unit 401 is specifically used to: perform an inverse modular addition operation on the first quantum register to obtain a first quantum register with a quantum state of |(x3-x2)mod p>; perform a constant modular addition operation with a constant of x2 on the first quantum register, and perform a constant modular subtraction operation with a constant of y2 on the second quantum register to obtain a first quantum register with a quantum state of |x3mod p> and a second quantum register with a quantum state of |y3mod p>; and determine the general point addition operation result of the point P and the point Q based on the |x3mod p> and |y3mod p>.
[0117] Optionally, the first processing unit 401 is further configured to: reset the quantum state |λ mod p> of the auxiliary quantum register to |0>.
[0118] Optionally, in resetting the quantum state |λmod p> of the auxiliary quantum register to |0>, the first processing unit 401 is configured to: perform an inverse modular multiplication operation on the first quantum register to obtain a quantum state of |(x3-x2) -1mod p>; performing an inverse variable modular multiplication operation on the first quantum register, the second quantum register and the auxiliary quantum register to obtain an auxiliary quantum register with a quantum state of |0>; performing an inverse modular multiplication operation on the first quantum register to obtain a first quantum register with a quantum state of |(x3-x2)mod p>.
[0119] The device may further include a first communication unit 402 and a first storage unit 403 . The first communication unit 402 may be a touch screen or a receiver. The first storage unit 403 may be a memory for storing program codes and data of the electronic device.
[0120] Yet another embodiment of the present application provides a storage medium, wherein the storage medium stores a computer program, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.
[0121] Specifically, in this embodiment, the above-mentioned storage medium can be configured to store a computer program for performing the following steps: determining the quantum state corresponding to point P, and constructing a constant modular subtraction operator based on point Q, wherein point P and point Q are any two points in the elliptic curve that do not overlap and are not symmetric about the x-axis except the point at infinity; determining the slope of the straight line determined by point P and point Q based on the quantum state corresponding to point P and the constant modular subtraction operator; and determining the general point addition operation result of point P and point Q based on the slope.
[0122] Specifically, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0123] Yet another embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above method embodiments.
[0124] Specifically, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor. Specifically, in this embodiment, the processor may be configured to perform the following steps through a computer program: determining the quantum state corresponding to point P, and constructing a constant modular subtraction operator based on point Q, wherein point P and point Q are any two points in the elliptic curve that do not overlap and are not symmetric about the x-axis except for the point at infinity; determining the slope of the straight line determined by point P and point Q based on the quantum state corresponding to point P and the constant modular subtraction operator; and determining the result of a general point addition operation of point P and point Q based on the slope.
[0125] Regarding how to implement double-point operations in elliptic curves in quantum computing, this application proposes a double-point quantum operation method and related devices in elliptic curves, aiming to realize double-point operations in elliptic curves through quantum circuits, thereby facilitating the use of the efficient processing capabilities of quantum computing for ciphertext decryption.
[0126] In elliptic curve cryptography, elliptic curves over finite fields are mainly used. This application mainly considers the elliptic curve E / FP over prime fields, where p is the characteristic of the finite field and is a prime number greater than 3. Therefore, all operations in this application are performed modulo p. This application considers double point operations: if P = Q and the ordinate of P is not 0, then: x3 = λ 2 -2x1mod p, y3=(λ(x1-x3)-y1)mod p,
[0127] in, (x1, y1) are the coordinates of points P and Q, (x3, y3) are the coordinates of point R, 2P=R, λ is the slope of the tangent line of the elliptic curve at point P, and the elliptic curve is y 2 =x 3 +Ax+B.
[0128] Therefore, if λ can be determined, the horizontal and vertical coordinates of point R can be expressed using λ and the coordinates of point P.
[0129] See Figure 5, which is a flow chart of a method for double-point quantum operation in an elliptic curve provided in an embodiment of the present application. The method includes the following steps:
[0130] Step 501: Determine the quantum state corresponding to point P, where point P is any point on the elliptic curve whose ordinate is not 0;
[0131] The quantum states corresponding to the point P(x1, y1) are |x1> and |y1>, which are stored by the first quantum register and the second quantum register respectively.
[0132] A set of quantum bits is called a quantum register, and the first quantum register and the second quantum register include at least one quantum bit.
[0133] Step 502: Determine the slope of the tangent of the elliptic curve at the point P based on the quantum state corresponding to the point P;
[0134] Optionally, determining the slope of the tangent of the elliptic curve at the point P based on the quantum state corresponding to the point P includes:
[0135] Determine a numerator of a slope of a tangent line of the elliptic curve at the point P based on the quantum state |x1> corresponding to the point P, and determine a denominator of a slope of a tangent line of the elliptic curve at the point P based on the quantum state |y1> corresponding to the point P;
[0136] The slope of the tangent line of the elliptic curve at the point P is determined based on the numerator and the denominator.
[0137] The numerator of the slope of the tangent line of the elliptic curve at the point P is 3x1 2 +A mod p, the denominator of the slope of the tangent line of the elliptic curve at the point P is 2y1mod p, and the slope of the tangent line of the elliptic curve at the point P is (3x1 2 +A)(2y1) -1 mod p.
[0138] In a specific embodiment provided in the present application, the numerator for determining the slope of the tangent of the elliptic curve at the point P based on the quantum state |x1> corresponding to the point P includes:
[0139] Get the first auxiliary register and the second auxiliary register;
[0140] Perform variable square modulo operation on the first quantum register and the first auxiliary register to obtain the quantum state |x1 2 mod p>'s first auxiliary register;
[0141] Perform a constant modular multiplication operation of 3 on the first auxiliary register and the second auxiliary register to obtain a quantum state of |3x1 2 mod p>'s first auxiliary register;
[0142] Perform a constant modular addition operation with a constant A on the first auxiliary register to obtain a quantum state of |3x1 2 +A mod p>, where A is the coefficient of the first term of the independent variable in the elliptic curve, and the 3x1 2 +A mod p is the numerator of the slope of the tangent line of the elliptic curve at the point P.
[0143] The initial quantum states of the first auxiliary register and the second auxiliary register are |0>.
[0144] The first quantum register and the first auxiliary register are subjected to variable square modulo operation to obtain the quantum state |x1 2 mod p>, that is, the quantum logic gate corresponding to the square modulo operation of the variable acts on the quantum bits included in the first quantum register and the first auxiliary register. The quantum state of the first quantum register is |x1>, which remains unchanged. The quantum state of the first auxiliary register evolves from |0> to |x1 2 mod p>.
[0145] The first auxiliary register and the second auxiliary register are subjected to a constant modular multiplication operation with a constant of 3, and the quantum state obtained is |3x1 2 mod p>, that is, the quantum logic gate corresponding to the constant modular multiplication operation acts on the quantum bits included in the first auxiliary register and the second auxiliary register, and the quantum state of the first auxiliary register is represented by |x1 2 mod p>Evolved to |3x1 2 mod p>, the quantum state of the second auxiliary register is |0> and remains unchanged.
[0146] Among them, the equation of the elliptic curve is y 2 =x 3 +Ax+B, where A is the coefficient of the linear term of the independent variable x in the elliptic curve, and B is the constant term in the elliptic curve.
[0147] Among them, the constant modulo addition operation with constant A is performed on the first auxiliary register to obtain the quantum state |3x1 2 +A mod p>, that is, the quantum logic gate corresponding to the constant modulo addition operation with constant A acts on the quantum bits included in the first auxiliary register, and the quantum state of the first auxiliary register is composed of |3x1 2 mod p) evolves to |3x1 2 +A mod p>.
[0148] In a specific embodiment provided in the present application, determining the denominator of the slope of the tangent of the elliptic curve at the point P based on the quantum state |y1> corresponding to the point P includes:
[0149] A constant modular multiplication operation with a constant of 2 is performed on the second quantum register and the second auxiliary register to obtain a second quantum register with a quantum state of |2y1mod p>, where 2y1mod p is the denominator of the slope of the tangent of the elliptic curve at the point P.
[0150] A constant modular multiplication operation with a constant of 2 is performed on the second quantum register and the second auxiliary register to obtain a second quantum register with a quantum state of |2y1mod p>, that is, a quantum logic gate corresponding to the constant modular multiplication operation is applied to the quantum bits included in the second quantum register and the second auxiliary register, and the quantum state of the second quantum register evolves from |y1> to |2y1mod p>, and the quantum state of the second auxiliary register is |0>, which remains unchanged.
[0151] In a specific embodiment provided in the present application, determining the slope of the tangent line of the elliptic curve at the point P based on the numerator and the denominator includes:
[0152] Perform the inverse modular multiplication operation on the second quantum register to obtain the quantum state |(2y1) -1 the second quantum register mod p>;
[0153] Perform variable modular multiplication on the second quantum register, the first auxiliary register, and the second auxiliary register to obtain the quantum state |(3x1 2 +A)(2y1) -1 mod p> the second quantum register, the (3x1 2 +A)(2y1) -1 mod p is the slope λ of the tangent line of the elliptic curve at the point P.
[0154] Among them, the second quantum register is subjected to the inverse modular multiplication operation, and the quantum state obtained is |(2y1) -1 mod p>, that is, the quantum logic gate corresponding to the inverse operation of modular multiplication acts on the quantum bits included in the second quantum register, and the quantum state of the second quantum register evolves from |2y1mod p> to |(2y1) -1 mod p>.
[0155] The second quantum register, the first auxiliary register and the second auxiliary register are subjected to a variable modular multiplication operation to obtain a quantum state of |(3x1 2 +A)(2y1) -1 mod p>, that is, the quantum logic gate corresponding to the variable modular multiplication operation acts on the quantum bits included in the second quantum register, the first auxiliary register and the second auxiliary register, and the quantum state of the second auxiliary register is represented by |(2y1) -1 mod p>Evolved to |(3x1 2 +A)(2y1) -1 mod p>, the quantum states of the first auxiliary register and the second quantum register remain unchanged, which are |3x1 2 +A mod p> and |(2y1)-1 mod p>.
[0156] Step 503: Determine a doubling point operation result of the point P based on the slope.
[0157] Optionally, 2P=R, and determining a doubling point operation result of the point P based on the slope includes:
[0158] Evolving the quantum state of the first quantum register into a quantum state including the coordinates of the point R based on the slope, and evolving the quantum state of the second quantum register into a quantum state including the coordinates of the point R based on the slope;
[0159] A double point operation result of the point P is determined based on the first quantum register and the second quantum register including the quantum state of the coordinate of the point R.
[0160] In a specific embodiment of the present application, before evolving the quantum state of the first quantum register into a quantum state including the coordinates of the point R based on the slope, the method further includes:
[0161] The quantum state of the first auxiliary register |3x1 2 +A mod p>, the quantum state of the first quantum register |x1>, the quantum state of the second quantum register |(2y1) -1 mod p> is reset to |0>.
[0162] Specifically, the quantum state of the first auxiliary register |3x1 2 +A mod p> reset to |0>, including:
[0163] Perform a constant modulo subtraction operation with a constant A on the first auxiliary register, and perform a constant modulo subtraction operation with a constant x1 on the first quantum register, and obtain a quantum state of |3x1 2 a first auxiliary register mod p> and a first quantum register with quantum state |0>;
[0164] Perform a constant modulus division operation of 3 on the first quantum register and the first auxiliary register to obtain a quantum state of |x1 2 mod p>'s first auxiliary register;
[0165] Performing a constant modular addition operation with a constant x1 on the first quantum register to obtain a first quantum register with a quantum state of |x1>;
[0166] An inverse variable square modulo operation is performed on the first quantum register and the first auxiliary register to obtain a first auxiliary register with a quantum state of |0>.
[0167] A constant modulo subtraction operation with a constant of A is performed on the first auxiliary register, and a constant modulo subtraction operation with a constant of x1 is performed on the first quantum register, and the quantum state obtained is |3x1 2 mod p> and the first quantum register with a quantum state of |0>, that is, the quantum logic gate corresponding to the constant modulo subtraction operation with a constant A acts on the quantum bits included in the first auxiliary register, and the quantum state of the first auxiliary register is |3x1 2 +A mod p>Evolves to |3x1 2 mod p>, the quantum logic gate corresponding to the constant modular subtraction operation with the constant x1 is applied to the quantum bits included in the first quantum register, and the quantum state of the first quantum register evolves from |x1> to |0>.
[0168] The first quantum register and the first auxiliary register are subjected to a constant modulo division operation of 3, and the quantum state obtained is |x1 2 mod p>, that is, the quantum logic gate corresponding to the constant modulus operation of constant 3 acts on the quantum bits included in the first quantum register and the first auxiliary register, and the quantum state of the first auxiliary register is composed of |3x1 2 mod p>Evolved to|x1 2 mod p>, the quantum state of the first quantum register is |0> and remains unchanged. The quantum logic gate corresponding to the constant modular division operation is transposed conjugate with the quantum logic gate corresponding to the constant modular multiplication operation.
[0169] In which, a constant modular addition operation with a constant x1 is performed on the first quantum register to obtain a first quantum register with a quantum state of |x1>, that is, the quantum logic gate corresponding to the constant modular addition operation with a constant x1 is applied to the quantum bits included in the first quantum register, and the quantum state of the first quantum register evolves from |0> to |x1>.
[0170] The first quantum register and the first auxiliary register are subjected to an inverse variable square modulo operation to obtain a first auxiliary register with a quantum state of |0>, that is, the quantum logic gate corresponding to the inverse variable square modulo operation is applied to the quantum bits included in the first quantum register and the first auxiliary register, and the quantum state of the first auxiliary register is |x1 2 mod p> evolves to |0>, and the quantum state of the first quantum register is |x1>, which remains unchanged.
[0171] Specifically, resetting the quantum state |x1> of the first quantum register to |0> includes:
[0172] A constant modular subtraction operation with a constant x1 is performed on the first quantum register to obtain a first quantum register with a quantum state of |0>.
[0173] In which, a constant modular subtraction operation with a constant x1 is performed on the first quantum register to obtain a first quantum register with a quantum state of |0>, that is, the quantum logic gate corresponding to the constant modular subtraction operation with a constant x1 is applied to the quantum bits included in the first quantum register, and the quantum state of the first quantum register evolves from |x1> to |0>.
[0174] Specifically, the quantum state of the second quantum register |(2y1) -1 mod p> is reset to |0>, including:
[0175] Performing an inverse modular multiplication operation on the second quantum register to obtain a second quantum register with a quantum state of |2y1mod p>;
[0176] A constant modular subtraction operation with a constant of 2y1 is performed on the second quantum register to obtain a second quantum register with a quantum state of |0>.
[0177] The second quantum register is subjected to an inverse modular multiplication operation to obtain a second quantum register with a quantum state of |2y1mod p>, that is, the quantum logic gate corresponding to the inverse modular multiplication operation is applied to the quantum bits included in the second quantum register, and the quantum state of the second quantum register is |(2y1) -1 mod p> evolved to |2y1mod p>.
[0178] In which, a constant modular subtraction operation with a constant of 2y1 is performed on the second quantum register to obtain a second quantum register with a quantum state of |0>, that is, the quantum logic gate corresponding to the constant modular subtraction operation with a constant of 2y1 is applied to the quantum bits included in the second quantum register, and the quantum state of the second quantum register evolves from |2y1mod p> to |0>.
[0179] Optionally, evolving the quantum state of the first quantum register into a quantum state including the coordinates of the point R based on the slope includes:
[0180] Perform variable square modulo operation on the first quantum register and the second auxiliary register to obtain the quantum state |λ 2 mod p>'s first quantum register;
[0181] A constant modular subtraction operation of 3x1 is performed on the first quantum register to obtain a first quantum register with a quantum state of |(x3-x1)mod p>, where (x3-x1)mod p=(λ 2 -3x1)mod p.
[0182] Wherein, the variable square modulus operation is performed on the first quantum register and the second auxiliary register to obtain the quantum state |λ 2mod p>, that is, the quantum logic gate corresponding to the square modulo operation of the variable acts on the quantum bits included in the first quantum register and the second auxiliary register, and the quantum state of the first quantum register evolves from |0> to |λ 2 mod p>, the quantum state of the second auxiliary register is |λmod p>, which remains unchanged.
[0183] A constant modular subtraction operation with a constant of 3x1 is performed on the first quantum register to obtain a first quantum register with a quantum state of |(x3-x1)mod p>, that is, the quantum logic gate corresponding to the constant modular subtraction operation with a constant of 3x1 is applied to the quantum bits included in the first quantum register, and the quantum state of the first quantum register is changed from |λ 2 mod p> evolves to |(λ 2 -3x1)mod p>, that is, |(x3-x1)mod p>.
[0184] Optionally, evolving the quantum state of the second quantum register into a quantum state including the coordinates of the point R based on the slope includes:
[0185] Perform a variable modular multiplication operation on the first quantum register, the second quantum register, and the second auxiliary register to obtain a second quantum register with a quantum state of |-(y1+y3)mod p>, where -(y1+y3)mod p=-λ(x3-x1)mod p.
[0186] The first quantum register, the second quantum register, and the second auxiliary register are subjected to a variable modular multiplication operation to obtain a second quantum register with a quantum state of |-(y1+y3)mod p>, that is, the quantum logic gate corresponding to the variable modular multiplication operation is applied to the quantum bits included in the first quantum register and the second auxiliary register, and the quantum states of the first quantum register and the second quantum register remain unchanged, which are |(λ 2 -3x1)mod p> and |λmod p>, the quantum state of the second quantum register evolves from |0> to |-(y1+y3)mod p>.
[0187] Optionally, determining the double point operation result of the point P based on the first quantum register and the second quantum register including the quantum state of the coordinate of the point R includes:
[0188] Performing a constant modular addition operation with a constant x1 on the first quantum register to obtain a first quantum register with a quantum state of |x3 mod p>;
[0189] Performing an inverse modular addition operation on the second quantum register to obtain a second quantum register with a quantum state of |(y1+y3)mod p>;
[0190] Performing a constant modular subtraction operation with a constant y1 on the second quantum register to obtain a second quantum register with a quantum state of |y3 mod p>;
[0191] The doubling point operation result of the point P is determined based on the |x3mod p> and |y3mod p>.
[0192] In which, a constant modular addition operation with a constant x1 is performed on the first quantum register to obtain a first quantum register with a quantum state of |x3mod p>, that is, the quantum logic gate corresponding to the constant modular addition operation with a constant x1 is applied to the quantum bits included in the first quantum register, and the quantum state of the first quantum register evolves from |(x3-x1)mod p> to |x3mod p>.
[0193] In which, a modular addition inverse operation is performed on the second quantum register to obtain a second quantum register with a quantum state of |(y1+y3)mod p>, that is, the quantum logic gate corresponding to the modular addition inverse operation is applied to the quantum bits included in the second quantum register, and the quantum state of the second quantum register evolves from |-(y1+y3)mod p> to |(y1+y3)mod p>.
[0194] In which, a constant modular subtraction operation with a constant y1 is performed on the second quantum register to obtain a second quantum register with a quantum state of |y3mod p>, that is, the quantum logic gate corresponding to the constant modular subtraction operation with a constant y1 is applied to the quantum bits included in the second quantum register, and the quantum state of the second quantum register evolves from |(y1+y3)mod p> to |y3mod p>.
[0195] Optionally, the method further includes:
[0196] The quantum state |λ mod p> of the second auxiliary register is reset to |0>.
[0197] Resetting the quantum state |λ mod p> of the second auxiliary register to |0> can be performed before performing a constant modular addition operation with a constant x1 on the first quantum register to obtain the first quantum register with a quantum state |x3 mod p>, or after performing a constant modular addition operation with a constant x1 on the first quantum register to obtain the first quantum register with a quantum state |x3 mod p>, without limitation herein. This operation allows the second auxiliary register to be reused for other quantum computations or storage.
[0198] In a specific embodiment of the present application, before performing a constant modular addition operation with a constant x1 on the first quantum register to obtain a first quantum register with a quantum state of |x3 mod p>, the quantum state |λ mod p> of the second auxiliary register is reset to |0>.
[0199] Specifically, resetting the quantum state |λ mod p> of the second auxiliary register to |0> includes:
[0200] Perform the inverse modular multiplication operation on the first quantum register to obtain the quantum state |(x3-x1) -1 mod p>'s first quantum register;
[0201] performing an inverse variable modular multiplication operation on the first quantum register, the second quantum register, and the second auxiliary register to obtain a second auxiliary quantum register with a quantum state of |0>;
[0202] Perform an inverse modular multiplication operation on the first quantum register to obtain a first quantum register with a quantum state of |(x3-x1)mod p>.
[0203] The inverse modular multiplication operation is performed on the first quantum register to obtain the quantum state |(x3-x1) -1 mod p>, that is, the quantum logic gate corresponding to the inverse operation of modular multiplication acts on the quantum bits included in the first quantum register, and the quantum state of the first quantum register evolves from |(x3-x1)mod p> to |(x3-x1) -1 mod p>.
[0204] The first quantum register, the second quantum register, and the second auxiliary register are subjected to an inverse variable modular multiplication operation to obtain a second auxiliary quantum register with a quantum state of |0>. That is, the quantum logic gate corresponding to the variable modular multiplication operation is applied to the quantum bits included in the first quantum register, the second quantum register, and the second auxiliary register. The quantum states of the first quantum register and the second quantum register remain unchanged, which are |(x3-x1) respectively. -1 mod p> and |-(y1+y3)mod p>, the quantum state of the second auxiliary register evolves from |λmod p> to |0>.
[0205] The first quantum register is subjected to a modular inverse multiplication operation to obtain a first quantum register with a quantum state of |(x3-x1) mod p>. That is, the quantum logic gate corresponding to the modular inverse multiplication operation is applied to the quantum bits included in the first quantum register, and the quantum state of the first quantum register is |(x3-x1) mod p>. -1mod p> evolves to |(x3-x1) mod p>. This step restores the quantum state of the first quantum register, facilitating the subsequent determination of the double point operation result of the point P based on the first quantum register and the second quantum register including the quantum state of the coordinates of the point R.
[0206] The specific implementation of the variable square modulo operation can be found in Chinese patent application number 202211464665.9, titled "Variable Square Modulo Arithmetic Device, Operation Method, and Related Device." The quantum logic gate corresponding to the inverse variable square modulo operation is the transposed conjugate of the quantum logic gate corresponding to the variable square modulo operation.
[0207] Among them, the specific implementation method of the constant modular multiplication operation can be referred to the Chinese patent document with application number "202211125591.6" and name "Constant modular addition and modular multiplication operator, modular multiplication operator, operation method and related device".
[0208] The specific implementation of the constant modular addition operation can be found in Chinese patent application number 202211114261.7, titled "Constant modular addition operator, method, and related device based on quantum Fourier transform." The quantum logic gate corresponding to the constant modular subtraction operation is the transposed conjugate of the quantum logic gate corresponding to the constant modular addition operation.
[0209] Among them, the specific implementation methods of modular inverse multiplication operations and modular inverse addition operations can be referred to the Chinese patent document with application number "202211465261.1" and titled "Construction method, device, medium and electronic device for modular inverse quantum circuit".
[0210] The specific implementation of the variable modular multiplication operation can be found in Chinese patent application number "202211465294.6," titled "Variable modular multiplication operator, operation method, and related device." The quantum logic gate corresponding to the inverse variable modular multiplication operation is the transposed conjugate of the quantum logic gate corresponding to the variable modular multiplication operation.
[0211] In addition, for any number x, finding -x mod p is equivalent to calculating (p-1)·x mod p, so the inverse operation of modular addition can also be implemented by a constant modular multiplication operation with a constant of (p-1).
[0212] As shown in Figure 6, Figure 6 is a schematic diagram of a quantum circuit for a double point operation in an elliptic curve provided by an embodiment of the present application. |x1> and |y1> are stored by the first quantum register and the second quantum register respectively, and the initial quantum states of the first auxiliary register and the second auxiliary register are |0>. The first quantum register, the second quantum register, the first auxiliary register and the second auxiliary register all include n quantum bits. Sqr is a variable square modulo operation, ×3 is a constant modular multiplication operation with a constant of 3, +A is a constant modular addition operation with a constant of A, ×2 is a constant modular multiplication operation with a constant of 2, Inv is the inverse operation of modular multiplication, Mul is a variable modular multiplication operation, -A is a constant modular subtraction operation with a constant of A, -x1 is a constant modular subtraction operation with a constant of x1, ÷3 is a constant modular division operation with a constant of 3, +x1 is a constant modular addition operation with a constant of x1, is the inverse variable square modulus operation, -2y1 is the constant modulus subtraction operation with a constant of 2y1, -3x1 is the constant modulus subtraction operation with a constant of 3x1, is the inverse variable modular multiplication operation, Neg is the inverse modular addition operation, and -y1 is the constant modular subtraction operation with the constant y1.
[0213] Compared with the prior art, the present application provides a method and related apparatus for performing a double-point quantum operation in an elliptic curve. The method determines the quantum state corresponding to a point P, where point P is any point in the elliptic curve whose ordinate is not 0; determines the slope of the tangent of the elliptic curve at point P based on the quantum state corresponding to point P; and determines the double-point operation result at point P based on the slope. This method realizes the double-point operation in the elliptic curve through a quantum circuit, which is beneficial for the subsequent decryption of ciphertext using the efficient processing power of quantum computing.
[0214] See Figure 7, which is a flow chart of a double point quantum operation device in an elliptic curve provided by an embodiment of the present application. The device includes a second processing unit 701, which is used to:
[0215] Determine the quantum state corresponding to point P, where point P is any point on the elliptic curve whose ordinate is not 0;
[0216] Determine the slope of the tangent of the elliptic curve at the point P based on the quantum state corresponding to the point P;
[0217] A doubling point operation result of the point P is determined based on the slope.
[0218] Optionally, the quantum states corresponding to the point P(x1, y1) are |x1> and |y1>, and |x1> and |y1> are stored by the first quantum register and the second quantum register respectively.
[0219] Optionally, in determining the slope of the tangent of the elliptic curve at the point P based on the quantum state corresponding to the point P, the second processing unit 701 is specifically configured to:
[0220] Determine a numerator of a slope of a tangent line of the elliptic curve at the point P based on the quantum state |x1> corresponding to the point P, and determine a denominator of a slope of a tangent line of the elliptic curve at the point P based on the quantum state |y1> corresponding to the point P;
[0221] The slope of the tangent line of the elliptic curve at the point P is determined based on the numerator and the denominator.
[0222] Optionally, in determining the numerator of the slope of the tangent of the elliptic curve at the point P based on the quantum state |x1> corresponding to the point P, the second processing unit 701 is specifically configured to:
[0223] Get the first auxiliary register and the second auxiliary register;
[0224] Perform variable square modulo operation on the first quantum register and the first auxiliary register to obtain the quantum state |x1 2 mod p>'s first auxiliary register;
[0225] Perform a constant modular multiplication operation of 3 on the first auxiliary register and the second auxiliary register to obtain a quantum state of |3x1 2 mod p);
[0226] Perform a constant modular addition operation with a constant A on the first auxiliary register to obtain a quantum state of |3x1 2 +A mod p>, where A is the coefficient of the first term of the independent variable in the elliptic curve, and the 3x1 2 +A mod p is the numerator of the slope of the tangent line of the elliptic curve at the point P.
[0227] Optionally, in determining the denominator of the slope of the tangent of the elliptic curve at the point P based on the quantum state |y1> corresponding to the point P, the second processing unit 701 is specifically configured to:
[0228] A constant modular multiplication operation with a constant of 2 is performed on the second quantum register and the second auxiliary register to obtain a second quantum register with a quantum state of |2y1mod p>, where 2y1mod p is the denominator of the slope of the tangent of the elliptic curve at the point P.
[0229] Optionally, in determining the slope of the tangent of the elliptic curve at the point P based on the numerator and the denominator, the second processing unit 701 is specifically configured to:
[0230] Perform the inverse modular multiplication operation on the second quantum register to obtain the quantum state |(2y1) -1 the second quantum register mod p>;
[0231] Perform variable modular multiplication on the second quantum register, the first auxiliary register, and the second auxiliary register to obtain the quantum state |(3x1 2 +A)(2y1) -1 mod p> the second auxiliary register, the (3x1 2 +A)(2y1) -1 mod p is the slope λ of the tangent line of the elliptic curve at the point P.
[0232] Optionally, 2P=R. In determining the double point operation result of the point P based on the slope, the second processing unit 701 is specifically configured to:
[0233] Evolving the quantum state of the first quantum register into a quantum state including the coordinates of the point R based on the slope, and evolving the quantum state of the second quantum register into a quantum state including the coordinates of the point R based on the slope;
[0234] A double point operation result of the point P is determined based on the first quantum register and the second quantum register including the quantum state of the coordinate of the point R.
[0235] Optionally, before evolving the quantum state of the first quantum register into a quantum state including the coordinates of the point R based on the slope, the second processing unit 701 is further configured to:
[0236] The quantum state of the first auxiliary register |3x1 2 +A mod p>, the quantum state of the first quantum register |x1>, the quantum state of the second quantum register |(2y1) -1 mod p> is reset to |0>.
[0237] Optionally, in the step of setting the quantum state of the first auxiliary register to |3x1 2 In terms of resetting the value of +A mod p> to |0>, the second processing unit 701 is specifically configured to:
[0238] Perform a constant modulo subtraction operation with a constant A on the first auxiliary register, and perform a constant modulo subtraction operation with a constant x1 on the first quantum register, and obtain a quantum state of |3x1 2 a first auxiliary register mod p> and a first quantum register with quantum state |0>;
[0239] Perform a constant modulus division operation of 3 on the first quantum register and the first auxiliary register to obtain a quantum state of |x1 2 mod p>'s first auxiliary register;
[0240] Performing a constant modular addition operation with a constant x1 on the first quantum register to obtain a first quantum register with a quantum state of |x1>;
[0241] An inverse variable square modulo operation is performed on the first quantum register and the first auxiliary register to obtain a first auxiliary register with a quantum state of |0>.
[0242] Optionally, in the aspect of resetting the quantum state |x1> of the first quantum register to |0>, the second processing unit 701 is specifically configured to:
[0243] A constant modular subtraction operation with a constant x1 is performed on the first quantum register to obtain a first quantum register with a quantum state of |0>.
[0244] Optionally, in the step of setting the quantum state of the second quantum register |(2y1) -1 In terms of resetting mod p> to |0>, the second processing unit 701 is specifically configured to:
[0245] Performing an inverse modular multiplication operation on the second quantum register to obtain a second quantum register with a quantum state of |2y1mod p>;
[0246] A constant modular subtraction operation with a constant of 2y1 is performed on the second quantum register to obtain a second quantum register with a quantum state of |0>.
[0247] Optionally, in evolving the quantum state of the first quantum register into a quantum state including the coordinates of the point R based on the slope, the second processing unit 701 is specifically configured to:
[0248] Perform variable square modulo operation on the first quantum register and the second auxiliary register to obtain the quantum state |λ 2 mod p>'s first quantum register;
[0249] A constant modular subtraction operation of 3x1 is performed on the first quantum register to obtain a first quantum register with a quantum state of |(x3-x1)mod p>, where (x3-x1)mod p=(λ 2 -3x1)mod p.
[0250] Optionally, in evolving the quantum state of the second quantum register into a quantum state including the coordinates of the point R based on the slope, the second processing unit 701 is specifically configured to:
[0251] Perform a variable modular multiplication operation on the first quantum register, the second quantum register, and the second auxiliary register to obtain a second quantum register with a quantum state of |-(y1+y3)mod p>, where -(y1+y3)mod p=-λ(x3-x1)mod p.
[0252] Optionally, in determining the double point operation result of the point P based on the first quantum register and the second quantum register including the quantum state of the coordinate of the point R, the second processing unit 701 is specifically configured to:
[0253] Performing a constant modular addition operation with a constant x1 on the first quantum register to obtain a first quantum register with a quantum state of |x3 mod p>;
[0254] Performing an inverse modular addition operation on the second quantum register to obtain a second quantum register with a quantum state of |(y1+y3)mod p>;
[0255] Performing a constant modular subtraction operation with a constant y1 on the second quantum register to obtain a second quantum register with a quantum state of |y3 mod p>;
[0256] The doubling point operation result of the point P is determined based on the |x3mod p> and |y3mod p>.
[0257] Optionally, the second processing unit 701 is further configured to:
[0258] The quantum state |λ mod p> of the second auxiliary register is reset to |0>.
[0259] Optionally, in the aspect of resetting the quantum state |λ mod p> of the second auxiliary register to |0>, the second processing unit 701 is specifically configured to:
[0260] Perform the inverse modular multiplication operation on the first quantum register to obtain the quantum state |(x3-x1) -1 mod p>'s first quantum register;
[0261] performing an inverse variable modular multiplication operation on the first quantum register, the second quantum register, and the second auxiliary register to obtain a second auxiliary quantum register with a quantum state of |0>;
[0262] Perform an inverse modular multiplication operation on the first quantum register to obtain a first quantum register with a quantum state of |(x3-x1)mod p>.
[0263] The device may further include a second communication unit 702 and a second storage unit 703 . The second communication unit 702 may be a touch screen or a receiver. The second storage unit 703 may be a memory for storing program codes and data of the electronic device.
[0264] Yet another embodiment of the present application provides a storage medium, wherein the storage medium stores a computer program, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.
[0265] Specifically, in this embodiment, the above-mentioned storage medium may be configured to store a computer program for performing the following steps:
[0266] Determine the quantum state corresponding to point P, where point P is any point on the elliptic curve whose ordinate is not 0;
[0267] Determine the slope of the tangent of the elliptic curve at the point P based on the quantum state corresponding to the point P;
[0268] A doubling point operation result of the point P is determined based on the slope.
[0269] Specifically, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0270] Yet another embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above method embodiments.
[0271] Specifically, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0272] Specifically, in this embodiment, the processor may be configured to execute the following steps through a computer program:
[0273] Determine the quantum state corresponding to point P, where point P is any point on the elliptic curve whose ordinate is not 0;
[0274] Determine the slope of the tangent of the elliptic curve at the point P based on the quantum state corresponding to the point P;
[0275] A doubling point operation result of the point P is determined based on the slope.
[0276] See Figure 8, which is a flow chart of a quantum circuit-based ECC ciphertext decryption method provided in an embodiment of the present application. The method includes:
[0277] Step 801: Obtain the base point and public key corresponding to the ECC ciphertext;
[0278] The security of ECC is based on the Elliptic Curve Discrete Logarithm Problem (ECDLP): It is defined in a finite field The elliptic curve on is a cyclic additive group of order r. Let Q∈ And Q = [m]P, solve for m, where P is the base point corresponding to the ECC ciphertext, Q is the public key corresponding to the ECC ciphertext, and m is the discrete logarithm value, that is, the private key.
[0279] Step 802: Constructing a controlled point addition operation based on the base point and the public key;
[0280] Elliptic curves are a special type of algebraic curve. All rational points on them form an additive group, and addition operates on them like geometric addition. Take two points A(x1, y1) and B(x2, y2) on an elliptic curve. If A ≠ ±B and neither A nor B is at infinity, draw a straight line connecting A and B. This line will intersect the elliptic curve at a third point, G. Then, draw a line perpendicular to the x-axis through G, passing through another point R on the elliptic curve (generally a point symmetric about the x-axis). Point R is defined as the sum of A and B, i.e., A + B = R. This operation is called the general point addition operation on an elliptic curve.
[0281] If A=B and y1≠0, then determine the tangent of the elliptic curve at point A. This tangent will intersect the elliptic curve at point G. Then draw a straight line perpendicular to the x-axis through point G, passing through another point R on the elliptic curve (usually a point symmetrical about the x-axis). Point R is defined as the result of doubling A, that is, 2A=R. This operation process is called the doubling point operation of the elliptic curve.
[0282] Among them, the controlled point addition operation is a point addition operation controlled by another register (qubit). If the quantum state of the control register or qubit is |1>, the point addition operation will be executed, which is real control; if the quantum state of the control register or qubit is |0>, the point addition operation will be executed, which is virtual control; the point addition operation can be a general point addition operation of an elliptic curve or a double point operation of an elliptic curve.
[0283] Step 803: constructing a quantum circuit based on the controlled point addition operation;
[0284] Step 804: running the quantum circuit to obtain a discrete logarithm value;
[0285] Running the quantum circuit to obtain a discrete logarithmic value includes measuring the quantum bits in the quantum circuit after running, and obtaining the discrete logarithmic value according to the measurement result.
[0286] For example, if the measurement result is the quantum state |x, y>, the group order r is known in advance through classical calculation, and u and ν are calculated, then the discrete logarithm m = ν / u can be obtained, where:
[0287] Among them, n = log2(p), that is, n is a prime number domain bit length.
[0288] Step 805: Decrypt the ECC ciphertext based on the discrete logarithm value.
[0289] Among them, the decryption of the ECC ciphertext based on the discrete logarithmic value can be specifically referred to Zhang Guo’s patent document with application number 202111365914.4 and patent name “Ciphertext Decryption Method and Related Equipment”.
[0290] Compared with the prior art, the present application provides a quantum circuit-based ECC ciphertext decryption method, device, medium, and electronic device. The method first obtains the base point and public key corresponding to the ECC ciphertext, constructs a controlled point addition operation based on the base point and public key, and then constructs a quantum circuit. The discrete logarithm value is obtained through the result of the quantum circuit operation. Finally, the ECC ciphertext is decrypted based on the discrete logarithm value, thereby realizing the decryption of the ECC ciphertext by constructing a quantum circuit through the base point and public key without knowing the private key.
[0291] Optionally, the controlled point addition operation includes a first controlled point addition operation and a second controlled point addition operation, and constructing a quantum circuit based on the controlled point addition operation includes:
[0292] Get the first register, the second register, the third register, the H gate and the Fourier transform operation;
[0293] The H gate is applied to the first register and the second register respectively, the first controlled point addition operation is applied to the second register and the third register, the second controlled point addition operation is applied to the first register and the third register, and the Fourier transform operation is applied to the first register and the second register respectively, to obtain a quantum circuit, wherein the first controlled point addition operation and the second controlled point addition operation are controlled by the second register and the first register respectively.
[0294] The H gate is a single quantum logic gate, and the H gate is applied to the first register and the second register respectively, that is, the H gate is applied to the first register, and the H gate is applied to the second register; the Fourier transform operation is applied to the first register and the second register respectively, that is, the Fourier transform operation is applied to the first register, and the Fourier transform operation is applied to the second register.
[0295] As shown in FIG9 , FIG9 is a schematic structural diagram of a quantum circuit provided in an embodiment of the present application.
[0296] Optionally, the first register and the second register both include n+1 quantum bits, the third register includes 2n quantum bits, and the initial quantum states of the quantum bits are all |0>.
[0297] Optionally, the number of the first controlled point addition operation and the second controlled point addition operation is n+1, and the step of constructing the controlled point addition operation based on the base point and the public key includes:
[0298] Based on the base point 2 i times to construct the i-th first controlled point addition operation, and 2 based on the public key j The j-th addition operation of the second controlled point is constructed times to obtain n+1 addition operations of the first controlled point and the second controlled point, where i and j are both integers greater than or equal to 0 and less than or equal to n.
[0299] For example, when i=0, the 0th first controlled point addition operation is used to perform a general point addition operation on point P and the previous operation result; when i=1, the 1st first controlled point addition operation is used to perform a general point addition operation on the 2 times point operation result of point P and the previous operation result; ...; when i=n, the nth first controlled point addition operation is used to perform a general point addition operation on the 2 times point operation result of point P and the previous operation result; ...; when i=n, the nth first controlled point addition operation is used to perform a general point addition operation on the 2 times point P n The doubling point operation result and the previous operation result are subjected to a general point addition operation; the general point addition operation is controlled by the quantum bits in the second register.
[0300] When j=0, the 0th second controlled point addition operation is used to perform a general point addition operation on point Q and the previous operation result; when i=1, the 1st second controlled point addition operation is used to perform a general point addition operation on the 2 times point operation result of point Q and the previous operation result; ...; when i=n, the nth second controlled point addition operation is used to perform a general point addition operation on the 2 times point operation result of point Q and the previous operation result; ...; when i=n, the nth second controlled point addition operation is used to perform a general point addition operation on the 2 times point Q n The doubling point operation result and the previous operation result are subjected to a general point addition operation; the general point addition operation is controlled by the quantum bits in the first register.
[0301] Optionally, performing the first controlled point addition operation on the second register and the third register includes:
[0302] The i-th first controlled point addition operation is applied to the (ni)-th quantum bit included in the second register and the 2n quantum bits included in the third register, so as to realize the application of n+1 first controlled point addition operations to the second register and the third register.
[0303] For example, the 0th first controlled point addition operation (+P) is applied to the nth qubit included in the second register and the 2n qubits included in the third register, and the nth qubit included in the second register is the control bit; the 1st first controlled point addition operation (+2P) is applied to the n-1th qubit included in the second register and the 2n qubits included in the third register, and the n-1th qubit included in the second register is the control bit; ...; the nth first controlled point addition operation (+2 n P) acts on the 0th quantum bit included in the second register and the 2n quantum bits included in the third register, and the 0th quantum bit included in the second register is a control bit.
[0304] Optionally, performing the second controlled point addition operation on the first register and the third register includes:
[0305] The jth second-controlled point addition operation is applied to the (nj)th quantum bit included in the first register and the 2n quantum bits included in the third register, so as to achieve n+1 second-controlled point addition operations on the first register and the third register.
[0306] For example, the 0th second controlled point addition operation (+Q) is applied to the nth qubit included in the first register and the 2n qubits included in the third register, and the nth qubit included in the first register is a control bit; the 1st second controlled point addition operation (+2Q) is applied to the n-1th qubit included in the first register and the 2n qubits included in the third register, and the n-1th qubit included in the first register is a control bit; ...; the nth second controlled point addition operation (+2Q) is applied to the n-1th qubit included in the first register and the 2n qubits included in the third register, and the n-1th qubit included in the first register is a control bit; ... n Q) acts on the 0th quantum bit included in the first register and the 2n quantum bits included in the third register, where the 0th quantum bit included in the first register is a control bit.
[0307] As shown in FIG10, FIG10 is a schematic diagram of the structure of another quantum circuit provided by an embodiment of the present application. It should be noted that when executing the zeroth first controlled point addition operation, that is, performing the point addition of point P and the infinite point O, this situation is not considered in the general point addition quantum circuit, but it can still be performed. Although the obtained point is not on the elliptic curve, as long as the point addition of some multiples of P and Q is done within a period (r < 2 n+1 ) point operation, and then the periodic information can be obtained through QFT (quantum Fourier transform), which will not affect the final m solution. It indicates that the initial quantum states of the 2n quantum bits of the third register are all |0>.
[0308] Optionally, the specific implementation of the doubling point operation in the controlled point addition operation is as follows:
[0309] Determine the doubling point operation result of the target point, and determine the 2 k The target point is the base point or the public key, and k=i or j.
[0310] Among them, any doubling operation can be decomposed into the sum of a doubling operation and a general point addition operation. For example, 4P=2P+2P, first determine the doubling operation result, and then perform a general point addition operation on the doubling operation result.
[0311] Optionally, the target point is any point on the elliptic curve whose ordinate is not 0; and the result of the double point operation for determining the target point includes:
[0312] determining the slope of the tangent line of the elliptic curve at the target point;
[0313] A double point operation result of the target point is determined based on the slope of the tangent line.
[0314] In the elliptic curve cryptography system, the elliptic curve on the finite field is mainly used. This application mainly considers the elliptic curve E / F on the prime field. P , where p is the characteristic of the finite field and is a prime number greater than 3. Therefore, all operations in this application are operations under the modulo p. This application considers double point operations: x3=λ 2 -2x1mod p, y3=(λ(x1-x3)-y1)mod p,
[0315] in, (x1, y1) is the coordinate of the target point, (x3, y3) is the coordinate of the double point of the target point, λ is the slope of the tangent line of the elliptic curve at the target point, and the elliptic curve is y 2 =x 3 +Ax+B.
[0316] Therefore, if λ can be determined, the horizontal and vertical coordinates of the double point of the target point can be expressed using λ and the coordinates of the target point. It should be noted that the double point operation result of the target point can be pre-calculated by classical calculation or by quantum calculation, which is not limited here.
[0317] In a specific embodiment of the present application, the double point operation result of the target point is calculated by quantum computing. The specific implementation method can refer to the double point quantum operation method in the above-mentioned elliptic curve. In an example, refer to Figure 6, which is a structural diagram of a quantum circuit for double point operation provided by the present application. |x1> and |y1> are stored by the fourth register and the fifth register respectively, and the initial quantum state of the first auxiliary register and the second auxiliary register is |0>. The fourth register, the fifth register, the first auxiliary register and the second auxiliary register all include n quantum bits. Sqr is a variable square modular operation, ×3 is a constant modular multiplication operation with a constant of 3, +A is a constant modular addition operation with a constant of A, ×2 is a constant modular multiplication operation with a constant of 2, Inv is the inverse operation of modular multiplication, Mul is a variable modular multiplication operation, -A is a constant modular subtraction operation with a constant of A, -x1 is a constant modular subtraction operation with a constant of x1, ÷3 is a constant modular division operation with a constant of 3, +x1 is a constant modular addition operation with a constant of x1, is the inverse variable square modulus operation, -2y1 is the constant modulus subtraction operation with a constant of 2y1, -3x1 is the constant modulus subtraction operation with a constant of 3x1, is the inverse variable modular multiplication operation, Neg is the inverse modular addition operation, and -y1 is the constant modular subtraction operation with the constant y1.
[0318] Among them, the operations Sqr, ×3, +A, ×2, Inv, Mul, etc. that are applied in sequence are used to obtain the slope of the tangent line of the elliptic curve at the target point, and the operations -A, -x1, ÷3, +x1, -2y1, -3x1, Operations such as Neg and -y1 are used to determine the double point operation result of the target point based on the slope of the tangent line.
[0319] Optionally, the controlled point addition operation and the general point addition quantum operation at any point are specifically implemented as follows:
[0320] Determining a quantum state corresponding to the arbitrary point, and constructing a constant modular subtraction operator based on a target point, wherein the arbitrary point and the target point are any two points on the elliptic curve that do not overlap and are not symmetric about the x-axis except for the point at infinity, and the target point is the base point or the public key;
[0321] Determining a slope of a straight line defined by the arbitrary point and the target point based on the quantum state corresponding to the arbitrary point and the constant modular subtraction operator;
[0322] A general point addition result of the arbitrary point and the target point is determined based on the slope of the straight line.
[0323] This application considers the general point addition operation: x3=(λ 2 -x1-x2)mod p, y3=(λ(x1-x3)-y1)mod p,
[0324] in, (x1, y1) are the coordinates of any point, (x2, y2) are the coordinates of the target point, (x3, y3) are the coordinates of the result of general point addition operation, and λ is the slope of the straight line determined by the arbitrary point and the target point.
[0325] Therefore, if λ can be determined, the horizontal and vertical coordinates of the general point addition result can be expressed using λ and the coordinates of the arbitrary point and the target point.
[0326] For specific implementation methods, please refer to the general point addition quantum operation method in the above-mentioned elliptic curve. In an example, refer to Figure 3, which is a structural diagram of a quantum circuit for general point addition operation provided by this application. |x1> and |y1> are stored by the sixth register and the seventh register respectively, and the initial quantum state of the auxiliary quantum register is |0>. The sixth register, the seventh register and the auxiliary quantum register all include n quantum bits. In the figure, -x2 and -y2 are the first constant modular subtraction operator and the second constant modular subtraction operator respectively, Inv is the inverse operation of modular multiplication or the inverse operation of modular addition, and Mul is the variable modular multiplication operation. is the inverse variable modular multiplication operation, Sqr is the variable square modular operation, is a variable modulo subtraction operation (i.e., an inverse variable modulo addition operation), +3x2 is a constant modulo addition operation, is the inverse variable square modulo operation, Neg is the inverse modular addition operation, +x2 is the constant modular addition operation, and -y2 is the constant modular subtraction operation.
[0327] Among them, the operations such as -x2, -y2, Inv, and Mul that are applied in sequence are used to obtain the slope of the straight line determined by the arbitrary point and the target point, and the operations that are applied in sequence later are used to obtain the slope of the straight line determined by the arbitrary point and the target point. Sqr, +3x2, Operations such as Neg, +x2, and -y2 are used to determine the general point addition result of the arbitrary point and the target point.
[0328] Based on the controlled general point plus quantum circuit, the present application can implement the Shor algorithm for solving the elliptic curve discrete logarithm problem when the number of quantum bits is less than or equal to 5n+8.
[0329] Referring to FIG. 11 , FIG. 11 is a schematic diagram of the structure of an ECC ciphertext decryption device based on a quantum circuit provided in an embodiment of the present application, wherein the device includes:
[0330] An acquisition unit 1101 is configured to acquire a base point and a public key corresponding to an ECC ciphertext;
[0331] A construction unit 1102 is configured to construct a controlled point addition operation based on the base point and the public key; and construct a quantum circuit based on the controlled point addition operation.
[0332] An operating unit 1103 is configured to operate the quantum circuit to obtain a discrete logarithm value;
[0333] The decryption unit 1104 is configured to decrypt the ECC ciphertext based on the discrete logarithm value.
[0334] Optionally, the controlled point addition operation includes a first controlled point addition operation and a second controlled point addition operation. In constructing a quantum circuit based on the controlled point addition operation, the construction unit 1102 is specifically configured to:
[0335] Get the first register, the second register, the third register, the H gate and the Fourier transform operation;
[0336] The H gate is applied to the first register and the second register respectively, the first controlled point addition operation is applied to the second register and the third register, the second controlled point addition operation is applied to the first register and the third register, and the Fourier transform operation is applied to the first register and the second register respectively, to obtain a quantum circuit, wherein the first controlled point addition operation and the second controlled point addition operation are controlled by the second register and the first register respectively.
[0337] Optionally, the first register and the second register both include n+1 quantum bits, the third register includes 2n quantum bits, and the initial quantum states of the quantum bits are all |0>.
[0338] Optionally, the number of the first controlled point addition operation and the second controlled point addition operation is n+1. In constructing the controlled point addition operation based on the base point and the public key, the constructing unit 1102 is specifically configured to:
[0339] Based on the base point 2 i times to construct the i-th first controlled point addition operation, and 2 based on the public key j The j-th addition operation of the second controlled point is constructed times to obtain n+1 addition operations of the first controlled point and the second controlled point, where i and j are both integers greater than or equal to 0 and less than or equal to n.
[0340] Optionally, in terms of performing the first controlled point addition operation on the second register and the third register, the constructing unit 1102 is specifically configured to:
[0341] The i-th first controlled point addition operation is applied to the (ni)-th quantum bit included in the second register and the 2n quantum bits included in the third register, so as to realize the application of n+1 first controlled point addition operations to the second register and the third register.
[0342] Optionally, in terms of performing the second controlled point addition operation on the first register and the third register, the constructing unit 1102 is specifically configured to:
[0343] The jth second-controlled point addition operation is applied to the (nj)th quantum bit included in the first register and the 2n quantum bits included in the third register, so as to achieve n+1 second-controlled point addition operations on the first register and the third register.
[0344] Optionally, the specific implementation of the doubling point operation in the controlled point addition operation is as follows:
[0345] Determine the doubling point operation result of the target point, and determine the 2 k The target point is the base point or the public key, and k=i or j.
[0346] Optionally, the target point is any point on the elliptic curve whose ordinate is not 0; and the result of the double point operation for determining the target point includes:
[0347] determining the slope of the tangent line of the elliptic curve at the target point;
[0348] A double point operation result of the target point is determined based on the slope of the tangent line.
[0349] Optionally, the controlled point addition operation and the general point addition quantum operation at any point are specifically implemented as follows:
[0350] Determining a quantum state corresponding to the arbitrary point, and constructing a constant modular subtraction operator based on a target point, wherein the arbitrary point and the target point are any two points on the elliptic curve that do not overlap and are not symmetric about the x-axis except for the point at infinity, and the target point is the base point or the public key;
[0351] Determining a slope of a straight line defined by the arbitrary point and the target point based on the quantum state corresponding to the arbitrary point and the constant modular subtraction operator;
[0352] A general point addition result of the arbitrary point and the target point is determined based on the slope of the straight line.
[0353] Yet another embodiment of the present application provides a storage medium, wherein the storage medium stores a computer program, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.
[0354] Specifically, in this embodiment, the above-mentioned storage medium may be configured to store a computer program for performing the following steps:
[0355] Get the base point and public key corresponding to the ECC ciphertext;
[0356] Constructing a controlled point addition operation based on the base point and the public key;
[0357] Constructing a quantum circuit based on the controlled point addition operation;
[0358] Running the quantum circuit to obtain a discrete logarithm value;
[0359] The ECC ciphertext is decrypted based on the discrete logarithm value.
[0360] Specifically, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0361] Yet another embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above method embodiments.
[0362] Specifically, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0363] Specifically, in this embodiment, the processor may be configured to execute the following steps through a computer program:
[0364] Get the base point and public key corresponding to the ECC ciphertext;
[0365] Constructing a controlled point addition operation based on the base point and the public key;
[0366] Constructing a quantum circuit based on the controlled point addition operation;
[0367] Running the quantum circuit to obtain a discrete logarithm value;
[0368] The ECC ciphertext is decrypted based on the discrete logarithm value.
[0369] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A general point plus quantum operation method in an elliptic curve, the method comprising: Determine the quantum state corresponding to point P, and construct a constant modular subtraction operator based on point Q, wherein point P and point Q are any two points in the elliptic curve that do not overlap and are not symmetric about the x-axis except for the point at infinity; Determine the slope of the straight line determined by the point P and the point Q based on the quantum state corresponding to the point P and the constant modular subtraction operator; A general point addition result of the point P and the point Q is determined based on the slope.
2. The method of claim 1, wherein: The quantum states corresponding to the point P (x1, y1) are |x1> and |y1>, and |x1> and |y1> are stored by the first quantum register and the second quantum register respectively.
3. The method of claim 2, wherein: The coordinates of the point Q are (x2, y2), and the constant modulus subtraction operator is constructed based on the point Q, including: Construct a first constant modular subtraction operator with a constant of x2 and a modulus of p and a second constant modular subtraction operator with a constant of y2 and a modulus of p.
4. The method of claim 3, wherein: The determining the slope of the straight line determined by the point P and the point Q based on the quantum state corresponding to the point P and the constant modular subtraction operator comprises: Applying the first constant modular subtraction operator to the first quantum register and applying the second constant modular subtraction operator to the second quantum register to obtain a first quantum register with a quantum state of |(x1-x2) mod p> and a second quantum register with a quantum state of |(y1-y2) mod p>; Perform the inverse modular multiplication operation on the first quantum register to obtain the quantum state |(x1-x2) -1 mod p>'s first quantum register; Perform variable modular multiplication operation on the first quantum register, the second quantum register and the auxiliary quantum register with quantum state |0> to obtain the quantum state The auxiliary quantum register The slope λ of the straight line determined by the point P and the point Q.
5. The method of claim 4, wherein: The P+Q=R, the determining of the general point addition result of the point P and the point Q based on the slope, comprises: Evolving the quantum state of the first quantum register into a quantum state including the coordinates of the point R based on the slope, and evolving the quantum state of the second quantum register into a quantum state including the coordinates of the point R based on the slope; A general point addition result of the point P and the point Q is determined based on the first quantum register and the second quantum register including the quantum state of the coordinate of the point R.
6. The method of claim 5, wherein: The coordinates of the point R are (x3, y3), and the step of evolving the quantum state of the first quantum register into a quantum state including the coordinates of the point R based on the slope comprises: Performing an inverse modular multiplication operation on the first quantum register to obtain a first quantum register with a quantum state of |(x1-x2)mod p>; The quantum state of the second quantum register |(y1-y2) mod p> is reset to |0>, and the auxiliary quantum register and the second quantum register are subjected to variable square modulo operation to obtain a quantum state of |λ 2 The second quantum register of mod p>; Perform a variable modular subtraction operation on the first quantum register and the second quantum register to obtain a quantum state of |(x1-x2-λ 2 )mod p>'s first quantum register; A constant modular addition operation with a constant of 3x2 is performed on the first quantum register to obtain a first quantum register with a quantum state of |-(x3-x2)mod p>.
7. The method of claim 6, wherein: The step of resetting the quantum state |(y1-y2) mod p> of the second quantum register to |0> comprises: An inverse variable modular multiplication operation is performed on the auxiliary quantum register, the first quantum register, and the second quantum register to obtain a second quantum register whose quantum state is |0>.
8. The method according to claim 6 or 7, wherein: The step of evolving the quantum state of the second quantum register into a quantum state including the coordinate of the point R based on the slope comprises: The quantum state of the second quantum register |λ 2 mod p> is reset to |0>, and a variable modular multiplication operation is performed on the auxiliary quantum register, the first quantum register and the second quantum register to obtain a second quantum register with a quantum state of |(y2+y3)mod p>.
9. The method of claim 8, wherein: The quantum state of the second quantum register |λ 2 mod p> is reset to |0>, including: An inverse variable square modulo operation is performed on the second quantum register and the auxiliary quantum register to obtain a second quantum register with a quantum state of |0>.
10. The method of claim 9, wherein: The determining of the general point addition result of the point P and the point Q based on the first quantum register and the second quantum register including the quantum state of the coordinate of the point R comprises: Performing an inverse modular addition operation on the first quantum register to obtain a first quantum register with a quantum state of |(x3-x2)mod p>; Performing a constant modular addition operation with a constant of x2 on the first quantum register and performing a constant modular subtraction operation with a constant of y2 on the second quantum register to obtain a first quantum register with a quantum state of |x3mod p> and a second quantum register with a quantum state of |y3mod p>; The general point addition result of the point P and the point Q is determined based on the |x3mod p> and |y3mod p>.
11. The method of claim 10, wherein: The method further comprises: The quantum state |λmod p> of the auxiliary quantum register is reset to |0>.
12. The method of claim 11, wherein: The resetting the quantum state |λmod p> of the auxiliary quantum register to |0> comprises: Perform the inverse modular multiplication operation on the first quantum register to obtain the quantum state |(x3-x2) -1 mod p>'s first quantum register; Performing an inverse variable modular multiplication operation on the first quantum register, the second quantum register, and the auxiliary quantum register to obtain an auxiliary quantum register whose quantum state is |0>; Performing an inverse modular multiplication operation on the first quantum register, obtaining a first quantum register whose quantum state is |(x3-x2)mod p>.
13. A general point-based quantum computing device in an elliptic curve, the device comprising a first processing unit, configured to: Determine the quantum state corresponding to point P, and construct a constant modular subtraction operator based on point Q, wherein point P and point Q are any two points in the elliptic curve that do not overlap and are not symmetric about the x-axis except for the point at infinity; Determine the slope of the straight line determined by the point P and the point Q based on the quantum state corresponding to the point P and the constant modular subtraction operator; A general point addition result of the point P and the point Q is determined based on the slope.
14. A double point quantum operation method in an elliptic curve, the method comprising: Determine the quantum state corresponding to point P, where point P is any point in the elliptic curve whose ordinate is not 0; Determine the slope of the tangent line of the elliptic curve at the point P based on the quantum state corresponding to the point P; A double point operation result of the point P is determined based on the slope.
15. The method of claim 14, wherein: The quantum states corresponding to the point P (x1, y1) are |x1> and |y1>, and |x1> and |y1> are stored by the first quantum register and the second quantum register respectively.
16. The method of claim 15, wherein: The determining the slope of the tangent of the elliptic curve at the point P based on the quantum state corresponding to the point P comprises: Determine the numerator of the slope of the tangent line of the elliptic curve at the point P based on the quantum state |x1> corresponding to the point P, and determine the denominator of the slope of the tangent line of the elliptic curve at the point P based on the quantum state |y1> corresponding to the point P; The slope of the tangent line of the elliptic curve at the point P is determined based on the numerator and the denominator.
17. The method of claim 16, wherein: The numerator of determining the slope of the tangent line of the elliptic curve at the point P based on the quantum state |x1> corresponding to the point P comprises: Get the first auxiliary register and the second auxiliary register; Perform variable square modulo operation on the first quantum register and the first auxiliary register to obtain a quantum state of |x1 2 mod p> the first auxiliary register; Perform a constant modular multiplication operation of the first auxiliary register and the second auxiliary register with a constant of 3, and obtain a quantum state of |3x1 2 mod p> the first auxiliary register; Perform a constant modulo addition operation with constant A on the first auxiliary register to obtain a quantum state of |3x1 2 +A mod p>, where A is the coefficient of the first term of the independent variable in the elliptic curve, and the 3x1 2 +A mod p is the numerator of the slope of the tangent line of the elliptic curve at the point P.
18. The method of claim 17, wherein: The determining the denominator of the slope of the tangent line of the elliptic curve at the point P based on the quantum state |y1> corresponding to the point P comprises: A constant modular multiplication operation with a constant of 2 is performed on the second quantum register and the second auxiliary register to obtain a second quantum register with a quantum state of |2y1mod p>, where 2y1mod p is the denominator of the slope of the tangent of the elliptic curve at the point P.
19. The method of claim 18, wherein: The determining, based on the numerator and the denominator, the slope of the tangent line of the elliptic curve at the point P comprises: Perform the inverse modular multiplication operation on the second quantum register to obtain the quantum state |(2y1) -1 The second quantum register of mod p>; Perform variable modular multiplication operation on the second quantum register, the first auxiliary register and the second auxiliary register to obtain a quantum state of |(3x1 2 +A)(2y1) -1 mod p> the second auxiliary register, the (3x1 2 +A)(2y1) -1 mod p is the slope λ of the tangent line of the elliptic curve at the point P.
20. The method of claim 19, wherein: 2P=R, the step of determining the doubling point operation result of the point P based on the slope includes: Evolving the quantum state of the first quantum register into a quantum state including the coordinates of the point R based on the slope, and evolving the quantum state of the second quantum register into a quantum state including the coordinates of the point R based on the slope; A double point operation result of the point P is determined based on the first quantum register and the second quantum register including the quantum state of the coordinate of the point R.
21. The method of claim 20, wherein: Before evolving the quantum state of the first quantum register into a quantum state including the coordinates of the point R based on the slope, the method further includes: The quantum state of the first auxiliary register |3x1 2 +A mod p>, the quantum state of the first quantum register |x1>, the quantum state of the second quantum register |(2y1) -1 mod p> is reset to |0>.
22. The method of claim 21, wherein: The quantum state of the first auxiliary register is |3x1 2 +A mod p> reset to |0>, including: A constant modulo subtraction operation with a constant A is performed on the first auxiliary register, and a constant modulo subtraction operation with a constant x1 is performed on the first quantum register, and the quantum state obtained is |3x1 2 mod p> the first auxiliary register and the first quantum register with quantum state |0>; Perform a constant modulus division operation of 3 on the first quantum register and the first auxiliary register to obtain a quantum state of |x1 2 mod p> the first auxiliary register; Performing a constant modular addition operation with a constant x1 on the first quantum register to obtain a first quantum register with a quantum state of |x1>; An inverse variable square modulo operation is performed on the first quantum register and the first auxiliary register to obtain a first auxiliary register whose quantum state is |0>.
23. The method of claim 22, wherein: The resetting the quantum state |x1> of the first quantum register to |0> comprises: A constant modular subtraction operation with a constant x1 is performed on the first quantum register to obtain a first quantum register with a quantum state of |0>.
24. The method of claim 23, wherein: The quantum state of the second quantum register |(2y1) -1 mod p> is reset to |0>, including: Performing an inverse modular multiplication operation on the second quantum register to obtain a second quantum register with a quantum state of |2y1mod p>; A constant modular subtraction operation with a constant of 2y1 is performed on the second quantum register to obtain a second quantum register with a quantum state of |0>.
25. The method of claim 24, wherein: The step of evolving the quantum state of the first quantum register into a quantum state including the coordinate of the point R based on the slope comprises: Perform variable square modulo operation on the first quantum register and the second auxiliary register to obtain a quantum state of |λ 2 mod p>'s first quantum register; A constant modulo subtraction operation with a constant of 3x1 is performed on the first quantum register to obtain a first quantum register with a quantum state of |(x3-x1)mod p>, where (x3-x1)mod p=(λ 2 -3x1)mod p.
26. The method of claim 25, wherein: The step of evolving the quantum state of the second quantum register into a quantum state including the coordinate of the point R based on the slope comprises: A variable modular multiplication operation is performed on the first quantum register, the second quantum register and the second auxiliary register to obtain a second quantum register with a quantum state of |-(y1+y3)mod p>, where -(y1+y3)mod p=-λ(x3-x1)mod p.
27. The method of claim 26, wherein: The determining of the double point operation result of the point P based on the first quantum register and the second quantum register including the quantum state of the coordinate of the point R comprises: Performing a constant modular addition operation with a constant x1 on the first quantum register to obtain a first quantum register with a quantum state of |x3mod p>; Performing an inverse modular addition operation on the second quantum register to obtain a second quantum register with a quantum state of |(y1+y3)mod p>; Performing a constant modular subtraction operation with a constant y1 on the second quantum register to obtain a second quantum register with a quantum state of |y3mod p>; The doubling point operation result of the point P is determined based on the |x3mod p> and |y3mod p>.
28. The method of claim 27, wherein: The method further comprises: The quantum state |λmod p> of the second auxiliary register is reset to |0>.
29. The method of claim 28, wherein: The resetting the quantum state |λmod p> of the second auxiliary register to |0> comprises: Perform the inverse modular multiplication operation on the first quantum register to obtain the quantum state |(x3-x1) -1 mod p>'s first quantum register; Performing an inverse variable modular multiplication operation on the first quantum register, the second quantum register, and the second auxiliary register to obtain a second auxiliary quantum register with a quantum state of |0>; Performing an inverse modular multiplication operation on the first quantum register, obtaining a first quantum register whose quantum state is |(x3-x1)mod p>.
30. A double point quantum operation device in an elliptic curve, the device comprising a second processing unit, for: Determine the quantum state corresponding to point P, where point P is any point in the elliptic curve whose ordinate is not 0; Determine the slope of the tangent line of the elliptic curve at the point P based on the quantum state corresponding to the point P; A double point operation result of the point P is determined based on the slope.
31. A method for decrypting ECC ciphertext based on quantum circuits, the method comprising: Get the base point and public key corresponding to the ECC ciphertext; Constructing a controlled point addition operation based on the base point and the public key; Constructing a quantum circuit based on the controlled point addition operation; Running the quantum circuit to obtain a discrete logarithmic value; The ECC ciphertext is decrypted based on the discrete logarithmic value.
32. The method of claim 31, wherein: The controlled point addition operation includes a first controlled point addition operation and a second controlled point addition operation, and constructing a quantum circuit based on the controlled point addition operation includes: Get the first register, the second register, the third register, the H gate and the Fourier transform operation; The H gate is applied to the first register and the second register respectively, the first controlled point addition operation is applied to the second register and the third register, the second controlled point addition operation is applied to the first register and the third register, and the Fourier transform operation is applied to the first register and the second register respectively, to obtain a quantum circuit, wherein the first controlled point addition operation and the second controlled point addition operation are controlled by the second register and the first register respectively.
33. The method of claim 32, wherein: The first register and the second register each include n+1 quantum bits, the third register includes 2n quantum bits, and the initial quantum states of the quantum bits are all |0>.
34. The method of claim 33, wherein: The number of the first controlled point addition operation and the second controlled point addition operation is n+1, and the controlled point addition operation is constructed based on the base point and the public key, including: Based on the base point 2 i times construct the i-th first controlled point addition operation, and based on the public key 2 j The j-th addition operation of the second controlled point is constructed times to obtain n+1 addition operations of the first controlled point and the second controlled point, wherein i and j are both integers greater than or equal to 0 and less than or equal to n.
35. The method of claim 34, wherein: The step of performing the first controlled point addition operation on the second register and the third register includes: The i-th addition operation of the first controlled point is applied to the (ni)-th quantum bit included in the second register and the 2n quantum bits included in the third register, so as to realize the application of n+1 addition operations of the first controlled point to the second register and the third register.
36. The method of claim 34, wherein: The step of performing the second controlled point addition operation on the first register and the third register includes: The jth addition operation of the second controlled point is applied to the (nj)th quantum bit included in the first register and the 2n quantum bits included in the third register, so as to realize the application of n+1 addition operations of the second controlled point to the first register and the third register.
37. The method according to any one of claims 31 to 36, wherein: The specific implementation method of the doubling point operation in the controlled point addition operation is: Determine the doubling point operation result of the target point, and determine the doubling point of the target point based on the doubling point operation result. k The target point is the base point or the public key, and k=i or j.
38. The method of claim 37, wherein: The target point is any point in the elliptic curve whose ordinate is not 0; The double point operation result of determining the target point includes: Determine the slope of the tangent line of the elliptic curve at the target point; A double point operation result of the target point is determined based on the slope of the tangent line.
39. The method of any one of claims 31 to 36, wherein: The specific implementation of the controlled point addition operation and the general point addition quantum operation at any point is as follows: Determine the quantum state corresponding to the arbitrary point, and construct a constant modular subtraction operator based on the target point, wherein the arbitrary point and the target point are any two points in the elliptic curve that do not overlap and are not symmetric about the x-axis except the point at infinity, and the target point is the base point or the public key; Determining the slope of a straight line determined by the arbitrary point and the target point based on the quantum state corresponding to the arbitrary point and the constant modular subtraction operator; A general point addition result of the arbitrary point and the target point is determined based on the slope of the straight line.
40. An ECC ciphertext decryption device based on quantum circuits, the device comprising: An acquisition unit, used to obtain a base point and a public key corresponding to an ECC ciphertext; A construction unit, configured to construct a controlled point addition operation based on the base point and the public key; Constructing a quantum circuit based on the controlled point addition operation; An operating unit, used for operating the quantum circuit to obtain a discrete logarithmic value; A decryption unit is used to decrypt the ECC ciphertext based on the discrete logarithm value.
41. A storage medium storing a computer program, wherein: The computer program is configured to execute the method described in any one of claims 1-12, 14-29, 31-39 when executed.
42. An electronic device comprising 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 method described in any one of claims 1-12, 14-29, and 31-39.
