Modular arithmetic, quantum circuit, decryption method, device, equipment and medium
By designing a modular indexing arithmetic unit and quantum circuits, the problem of modular indexing in quantum circuits was solved, enabling efficient periodic computation and private key decryption in quantum decryption.
Patent Information
- Application Number
- CN202311039403.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-17
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2043-08-17
AI Technical Summary
Existing technologies struggle to effectively implement modular exponentiation in quantum circuits, particularly the periodic calculation of constructing the function f(A) = KA(mod R), which impacts the efficiency of quantum decryption.
Design a modular indexing arithmetic unit containing multiple modular double multipliers corresponding to qubits in a register. Modular indexing of quantum states is realized through a combination of modular double multipliers, inverse multipliers, modular negative arithmetic units, and axis-flipping arithmetic units.
It implements modular exponentiation of two given numbers in a quantum circuit, can calculate the period of the function f(A) = KA(mod R), and supports private key decryption using the RSA algorithm.
Smart Images

Figure CN119494412B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of quantum technology, and in particular to a modular indexing arithmetic unit, quantum circuit, decryption method, device, equipment and medium. Background Technology
[0002] RSA (Ron Rivest-Adi Shamir-Leonard Adleman) is an asymmetric encryption algorithm. This technique was proposed to address the shortcomings of symmetric encryption algorithms. Asymmetric encryption generates two keys: a public key and a private key. Even without knowing the private key of the RSA algorithm, Shor's algorithm can be used to decrypt encrypted data. The problem that Shor's algorithm solves is calculating two prime factors of a large odd number R. Its core is: constructing f(A) = K A Find a function (mod R) and determine its period. Here, K is an integer less than R and coprime to R.
[0003] For example, an equal-probability quantum superposition state |A> can be constructed using H-gates and stored in register reg1, and a superposition state |f(A)> can be constructed and stored in register reg2, with both registers in an entangled state. Furthermore, by performing a quantum measurement on the Fourier transform of register reg1, and based on the measurement result using a continued fraction algorithm, the period of f(A) can be obtained.
[0004] Based on the above method, constructing a superposition state of |f(A)> requires realizing |X0> to |X0×K. A The evolution of mod R>, where |X0> represents the quantum state of register reg2. That is, to realize the modular indexing operation for a given K and R, and how to implement this part of the evolution through quantum circuitry has become an urgent problem to be solved. Summary of the Invention
[0005] The purpose of this application is to provide a modular indexing arithmetic unit, quantum circuit, decryption method, apparatus, device, and medium to perform modular indexing operations on two given numbers. The specific technical solution is as follows:
[0006] A first aspect of this application provides a modular index arithmetic unit, comprising: a plurality of modular double multipliers; each modular double multiplier corresponding one-to-one with a qubit in a first register; and the quantum state |A| of each qubit in the first register. m -1>、|A m -2>、|A m -3>...|A0> represent the bits of the quantum superposition state |A> from high to low, respectively;
[0007] With quantum state |A nThe corresponding modular double multiplier is used in quantum state |A n When the result is |1>, the result |X| of the previous modulo-digital double multiplier applied to the second register is used. n >Evolved into Where R represents the first preset value and K represents the second preset value; the input of the first modular double multiplier includes the initial state of the auxiliary qubit in the second register; n≤m-1.
[0008] Optional, with quantum state |A n The corresponding modular double multiplier is also used in quantum state |A n When the result is |1>, the result |B of the previous modulo-digital double multiplier applied to the third register is used. n >Evolved into
[0009] The input to the first modular double multiplier also includes the initial state of the auxiliary qubit in the third register.
[0010] Optionally, a modular double multiplier includes: two modular scalar multipliers, an inverse multiplier, and a modular negative multiplier; wherein the inverse multiplier is used to implement an evolution that is the inverse of the modular scalar multiplier;
[0011] With quantum state |A n The corresponding modular double multiplier is used in quantum state |A n When the result is |1>, the result |X| of the operation performed by the previous modular double multiplier on the second and third registers is multiplied by one of the modular double multipliers. n >|B n >Evolved into |X n mod R>|(B n +X n ×Q)mod R>;
[0012] Through the inverse multiplier in this modular double multiplier, |X n mod R>|(B n +X n ×Q)mod R> evolves into |-B n ×Q -1 mod R>|(B n +X n ×Q)mod R>;
[0013] Through another modular scalar multiplier in this modular double multiplier, |-B n ×Q -1 mod R>|(B n +X n×Q)mod R> evolves into |-B n ×Q -1 mod R>|X n ×Qmod R>;
[0014] After another modular scalar multiplier operation, the quantum states of the second register and the third register are swapped to obtain |X n ×Qmod R>|-B n ×Q -1 mod R>;
[0015] After performing the exchange process, the quantum state of the third register is evolved through the modulus negative operator to obtain |X n ×Qmod R>|B n ×Q -1 mod R>.
[0016] Optionally, a modulo negative operator includes: an increment operator, an axis flip operator for R-1, and a decrement operator that is the inverse of the increment operator;
[0017] The modulo-negation operator is used to perform operations on |-B| by the subtraction operator. n ×Q -1 Subtracting 1 from mod R> yields |(-B) n ×Q -1 -1)mod R>;
[0018] The axis flipping arithmetic unit is used to process |(-B) n ×Q -1 -1)mod R> performs an axis flip operation for R-1, resulting in |(R-1-1-(-B)|. n ×Q -1 -1))mod R>;
[0019] The increment operator is used to process |(R-1-1-(-B) n ×Q -1 Adding 1 to -1))mod R> yields |B n ×Q - 1 mod R>.
[0020] Optionally, the axis flipping operator is used for |(-B n ×Q -1 For each computational basis vector less than R-1 contained in the -1)mod R>, calculate the value obtained by taking the modulo of that computational basis vector with respect to R-1-1, invert the calculated value, and replace the computational basis vector with the inverted computational basis vector to obtain |(R-1-1-(-B)|. n×Q -1 -1))mod R>.
[0021] Optionally, the third register contains one qubit with an initial state of |0>, and the other qubits are dirty qubits with unknown initial states.
[0022] Optionally, the second register contains a preset number of auxiliary qubits; the third register contains a preset number of auxiliary qubits; the preset number is half the number of modular-digital multipliers contained in the modular index arithmetic unit.
[0023] A second aspect of this application provides a quantum circuit, the quantum circuit including a quantum Fourier operator, a first register, a second register, a third register, and a modular indexing operator as described in the first aspect; the quantum Fourier operator is used to perform a Fourier transform on the first register.
[0024] A third aspect of this application provides a decryption method, the method comprising:
[0025] Evolutionary operations are performed according to the pre-constructed quantum circuit as described in the second aspect above; wherein the initial state of the least significant qubit in the second register is |1>, and the initial state of the other qubits is |0>; the quantum superposition state |A> is an equally probable quantum superposition state; K is less than R, and K and R are coprime;
[0026] Measuring the qubits in the evolved first register yields f(A) = K A The period of the (mod R) function;
[0027] Based on the obtained period and the public key containing R in the RSA algorithm, calculate the private key for the RSA algorithm;
[0028] The encrypted data, which is encrypted using the public key, is decrypted based on the calculated private key to obtain the decryption result.
[0029] A fourth aspect of this application provides a decryption apparatus, the apparatus comprising:
[0030] An evolution module is used to perform evolution operations according to a pre-constructed quantum circuit as described in the second aspect above; wherein the initial state of the least significant qubit in the second register is |1>, and the initial state of the other qubits is |0>; the quantum superposition state |A> is an equally probable quantum superposition state; K is less than R, and K and R are coprime;
[0031] The periodic calculation module is used to measure the qubits in the evolved first register to obtain f(A) = K. A The period of the (mod R) function;
[0032] The private key calculation module is used to calculate the private key for the RSA algorithm based on the obtained period and the public key containing R for the RSA algorithm.
[0033] The decryption module is used to decrypt the encrypted data obtained by encrypting it according to the public key based on the calculated private key, and obtain the decryption result.
[0034] A fifth aspect of this application provides a quantum computer device including a decryption quantum circuit, the decryption quantum circuit comprising a quantum Fourier operator, a first register, a second register, a third register, and a modular index operator as described in any of the first aspects; the quantum computer device implements the above-described decryption method during operation.
[0035] A sixth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in the third aspect.
[0036] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to execute any of the decryption methods described above.
[0037] This application provides a modular index arithmetic unit, including: multiple modular double multipliers; each modular double multiplier corresponds one-to-one with a qubit in a first register; and the quantum state |A| of each qubit in the first register. m-1 >、|A m-2 >、|A m-3 >...|A0> represent the bits of the quantum superposition state |A> from high to low; and the quantum state |A n The corresponding modular double multiplier is used in quantum state |A n When the result is |1>, the result |X| of the previous modulo-digital double multiplier applied to the second register is used. n >Evolved into Where R represents the first preset value, and K represents the second preset value; the input of the first modular double multiplier includes the initial state of the auxiliary qubit in the second register; n ≤ m-1. That is, when |A n When the value is |0>, the modulus-number double multiplier does not evolve the result of the operation of the previous modulus-number double multiplier on the second register; that is, the state of the qubit in the second register remains unchanged.
[0038] Because of |A m-1 >、|A m-2 >、|A m-3 >...|A0> represent the bits of the quantum superposition state |A> from high to low, that is, A can be represented as A m-1 ×2m-1 +A m-2 ×2 m-2 +A m-3 ×2 m-3 +…A0×2 0 Therefore, K A This can also be expressed as That is, it can be expressed as Due to the quantum state |A n The corresponding modular double multiplier, in quantum state |A n When the value is |1>, the quantum state |X of the input of the modular double multiplier can be obtained. n >Evolved into Therefore, for the quantum state of the second register, after quantum state |A n The evolution of the corresponding modular double multiplier can achieve Through the evolution of all modular double multipliers, the quantum state of the qubits in the second register can be realized. The evolution, that is, after the evolution processing of each modular double multiplier, enables the realization of ×K quantum states of the qubits in the second register. A The evolution of mod R. It can be seen that the modulo operator provided in the embodiments of this application can perform modulo operations on two given numbers (i.e., K and R).
[0039] Of course, implementing any product or method of this application does not necessarily require achieving all of the advantages described above at the same time. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other embodiments can be obtained based on these drawings.
[0041] Figure 1 A structural diagram of a quantum circuit provided in an embodiment of this application;
[0042] Figure 2 A simplified diagram of a modular indexing arithmetic unit provided in an embodiment of this application;
[0043] Figure 3 A simplified diagram of a modular double multiplier provided in an embodiment of this application;
[0044] Figure 4 A structural diagram of a modular double multiplier provided in an embodiment of this application;
[0045] Figure 5 A simplified diagram of a modulo-number negativeing arithmetic unit provided in an embodiment of this application;
[0046] Figure 6 A structural diagram of a modulo-digit negative arithmetic unit provided in an embodiment of this application;
[0047] Figure 7 A structural diagram of an axis flipping arithmetic unit provided in an embodiment of this application;
[0048] Figure 8 A flowchart illustrating a decryption method provided in an embodiment of this application;
[0049] Figure 9 This is a structural diagram of a decryption device provided in an embodiment of this application. Detailed Implementation
[0050] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of this application.
[0051] In the scheme of implementing Shor's algorithm based on quantum circuits, in order to calculate the constructed f(A) = K A The period of the (mod R) function can be determined by constructing an equal-probability quantum superposition state |A> using an H-gate and storing it in register reg1 (which can be called the first register). A superposition state of |f(A)> can also be constructed and stored in register reg2 (which can be called the second register), with these two registers in an entangled state. Furthermore, by performing a quantum measurement on the Fourier transform of the first register and applying a continued fraction algorithm based on the measurement result, the period of f(A) can be obtained. Constructing the superposition state of |f(A)> requires realizing |X0> to |X0×K. A The evolution of mod R>, where |X0> represents the initial state of register reg2.
[0052] This application provides a modular index arithmetic unit, including: multiple modular double multipliers; each modular double multiplier corresponds one-to-one with a qubit in a first register; and the quantum state |A| of each qubit in the first register. m-1 >、|A m-2 >、|A m-3 >...|A0> represent the bits of the quantum superposition state |A> from high to low;
[0053] With quantum state |A n The corresponding modular double multiplier is used in quantum state |A nWhen the result is |1>, the result |X| of the previous modulo-digital double multiplier applied to the second register is used. n >Evolved into Where R represents the first preset value and K represents the second preset value; the input of the first modular double multiplier includes the initial state of the auxiliary qubit in the second register; n≤m-1.
[0054] Because of |A m-1 >、|A m-2 >、|A m-3 >...|A0> represent the bits of the quantum superposition state |A> from high to low, that is, A can be represented as A m-1 ×2 m-1 +A m-2 ×2 m-2 +A m-3 ×2 m-3 +…A0×2 0 Therefore, K A This can also be expressed as That is, it can be expressed as Due to the quantum state |A n The corresponding modular double multiplier, in quantum state |A n When the value is |1>, the quantum state |X of the input of the modular double multiplier can be obtained. n >Evolved into Therefore, for the quantum state of the second register, after quantum state |A n The evolution of the corresponding modular double multiplier can be... Through the evolution of all modular double multipliers, the quantum state of the qubits in the second register can be realized. The evolution, that is, after the evolution processing of each modular double multiplier, enables the realization of ×K quantum states of the qubits in the second register. A The evolution of mod R. It can be seen that the modulo operator provided in the embodiments of this application can perform modulo operations on two given numbers (i.e., K and R).
[0055] See Figure 1 , Figure 1 This is a structural diagram of a quantum circuit provided in an embodiment of this application.
[0056] Figure 1 In the middle, |A m-1 >、|A m-2>...|A0> represents the quantum state of each qubit in the first register. |X> represents the initial state of the qubit in the second register. The second register contains p qubits, and the number of qubits it contains can be called the second preset number. The number of qubits in the first register can be called the first preset number, where the second preset number can be half of the first preset number, that is, m can be 2p. For example, log2 R can be calculated, and the result can be rounded up to obtain p. Figure 1 In this context, m-3 represents the value excluding |A m-1 >、|A m-2 In addition to the qubits corresponding to each of the > and |A0>, there are m-3 qubits. Figure 1 The middle part is not shown | A m-3 >
[0057] In the modular arithmetic unit 101, each dashed box represents one p modular double multipliers. From Figure 1 It can also be seen that each modulus-number double multiplier corresponds one-to-one with the qubits in the first register, and thus one-to-one with the quantum state of each qubit.
[0058] It can be seen that, Figure 1 The modular index arithmetic unit 101 contains different parameters for each modular double multiplier. Therefore, before evolution based on the modular index arithmetic unit 101, m can be calculated based on a preset R, and combined with a preset K, the parameters of each modular double multiplier can be obtained. In this modular index arithmetic unit 101, each modular double multiplier performs evolution operations sequentially according to the execution timing. The execution timing is the order in which each arithmetic unit evolves the qubits in the quantum circuit. Figure 1 The order of the arithmetic units in the quantum circuit from left to right reflects the execution timing of the arithmetic units.
[0059] Figure 1 In the sequence of execution, the quantum state corresponding to the first modular double multiplier is |A m-1 Since, according to the execution timing, it does not have a preceding modular double multiplier, therefore, its input |X to the second register... m-1 That is, the initial state of the qubit in the second register.
[0060] Conversely, if the execution timing of each modular double multiplier is consistent with... Figure 1 Conversely, the quantum state corresponding to the first modular double multiplier is |A0>. Since there is no preceding modular double multiplier according to the execution timing, its input to the second register, |X0>, is the initial state of the qubit in the second register.
[0061] Figure 1 As can be seen from this, for the quantum state |A nA qubit with n ≤ m-1 corresponds to a modular double multiplier. This qubit serves as the control qubit, i.e., when the quantum state |A| of this qubit is... n When the result is |1>, the corresponding modular double multiplier performs an evolution operation to transform the evolution result |X of the previous modular double multiplier applied to the second register. n >Evolved into It is understandable that the input of the first modular double multiplier is the initial state of the qubit in the second register.
[0062] In one embodiment, with quantum state |A n The corresponding modular double multiplier is also used in quantum state |A n When the result is |1>, the result |B of the previous modulo-digital double multiplier applied to the third register is used. n >Evolved into like Figure 1 In this context, each modular double multiplier is also used for... evolution, evolution, The evolution of.
[0063] The input to the first modular double multiplier also includes the initial state of the auxiliary qubit in the third register.
[0064] |B n This refers to the evolution of the previous modular double multiplier with respect to the third register.
[0065] Similarly, Figure 1 In the sequence of execution, the quantum state corresponding to the first modular double multiplier is |A m-1 Since, according to the execution timing, there is no preceding modular double multiplier, therefore, its input |B to the third register... m-1 That is, the initial state of the qubit in the third register.
[0066] Conversely, if the execution timing of each modular double multiplier is consistent with... Figure 1 Conversely, the quantum state corresponding to the first modular double multiplier is |A0>. Since there is no preceding modular double multiplier according to the execution timing, its input to the third register, |B0>, is the initial state of the qubit in the third register.
[0067] In this embodiment, each modular multiplier is used to perform evolution operations on the quantum states of the qubits in the second and third registers. That is, the input to the first modular multiplier also includes the initial state of the qubit in the third register. For example, Figure 1In this context, |dirty>|0> represents the quantum state of the qubit in the third register. |dirty> represents the quantum states of p-1 qubits with unknown states. Qubits with unknown states can also be called dirty qubits.
[0068] Understandably, based on Figure 1 During the evolution of the quantum circuit for the first, second, and third registers, the quantum state of each of the qubits in the first, second, and third registers is smaller than R.
[0069] Accordingly, see Figure 2 , Figure 2 A simplified diagram of a modular indexing arithmetic unit provided in an embodiment of this application. Figure 2 In this context, if the upper 'm' represents m qubits in a register, and the quantum states of these m qubits are used to represent the superposition state |A>, that is, each quantum state represents the bit of |A> from high to low; and the lower 'p' represents p qubits in another register, and the quantum states of these p qubits are used to represent the superposition state |B>, that is, each quantum state represents the bit of |B> from high to low; then the modular indexing arithmetic unit in this application can implement |A>|B> to |A>|B×K. A The evolution of mod R>. Figure 2 In addition, the modular indexing arithmetic unit also requires p-1 dirty qubits and one clean qubit, which is a qubit whose state is known.
[0070] In one embodiment, a modular double multiplier includes: two modular scalar multipliers, an inverse multiplier, and a modular negative operator; wherein the inverse multiplier is used to implement an evolution that is the inverse of the modular scalar multiplier.
[0071] Correspondingly, with quantum state |A n The corresponding modular double multiplier is used in quantum state |A n When the result is |1>, the result |X| of the operation performed by the previous modular double multiplier on the second and third registers is multiplied by one of the modular double multipliers. n >|B n >Evolved into |X n mod R>|(B n +X n ×Q)mod R>;
[0072] Then, through the inverse multiplier in this modular double multiplier, |X n mod R>|(B n +X n ×Q)mod R> evolves into |-B n ×Q-1 mod R>|(B n +X n ×Q)mod R>.
[0073] Then, through another modular scalar multiplier in this modular double multiplier, |-B n ×Q -1 mod R>|(B n +X n ×Q)mod R> evolves into |-B n ×Q -1 mod R>|X n ×Qmod R>.
[0074] Then, by swapping the quantum states of the second and third registers, we obtain |X n ×Qmod R>|-B n ×Q -1 mod R>.
[0075] Furthermore, by evolving the quantum state of the third register using a modulo-number negative operator, |X| is obtained. n ×Qmod R>|B n ×Q -1 mod R>.
[0076] In this embodiment, the inverse multiplier is used to achieve the inverse evolution of the modular scalar multiplier; that is, the inverse multiplier represents the dagger circuit of the modular scalar multiplier. For example, the inverse multiplier is obtained by applying a transpose-conjugate operation to the modular scalar multiplier.
[0077] As can be seen from the above description, for any modular scalar multiplier, if the input of the modular scalar multiplier is |A>|B>, then after the evolution of the modular scalar multiplier, we can obtain |Amod R>|(B+AQ)mod R>, where the Q value is different for different modular scalar multipliers.
[0078] Accordingly, see Figure 3 , Figure 3 A simplified diagram of a modular double multiplier provided in an embodiment of this application. Figure 3 In the middle, Q = K -1 The upper p represents p qubits in one register, and the quantum states of these p qubits are used to represent the superposition state |A>. The lower p represents p qubits in another register, and the quantum states of these p qubits are used to represent the superposition state |B>. That is, this modulo-digital double multiplier can realize |A>|B> to |A×K mod R>|B×K. -1 The evolution of mod R>.
[0079] Accordingly, see Figure 4 , Figure 4 This is a structural diagram of a modular double multiplier provided in an embodiment of this application.
[0080] Figure 4 In the diagram, the dashed boxes from left to right represent one modular scalar multiplier, the inverse multiplier, the other modular scalar multiplier, and the modular negativeing operator, respectively. The modular negativeing operator requires two dirty qubits. Figure 4 It can be seen that the inputs of the modular scalar multiplier and the inverse multiplier are also opposite. That is, when evolving through the modular scalar multiplier, the quantum state of the qubits in the upper register remains unchanged; while when evolving through the inverse multiplier, the quantum state of the qubits in the lower register remains unchanged.
[0081] against Figure 4 The modulo-digital double multiplier shown above represents p qubits in a register, and the quantum states of the p qubits are used to represent the superposition state |A>; the p below represents p qubits in another register, and the quantum states of the p qubits are used to represent the superposition state |B>. That is, if the input is |A>|B>, then the first modulo-digital scalar multiplier can evolve |A>|B> into |A mod R>|(B+AK)mod R>.
[0082] Furthermore, the inverse multiplier can evolve |A mod R>|(B+AK)mod R> into:
[0083] |A-(B+AK)×K -1 mod R>|(B+AK)mod R>
[0084] That is, we can obtain:
[0085] |-B×K -1 mod R>|(B+AK)mod R>
[0086] The second modular scalar multiplier can multiply |-B×K -1 mod R>|(B+AK)mod R> evolves into:
[0087] |-B×K -1 mod R>|(B+AK+(-B×K -1 )×K)mod R>
[0088] That is, we can obtain |-B×K -1 mod R>|AK mod R>
[0089] Then, the quantum states of the two registers can be swapped to obtain:
[0090] |AK mod R>|-B×K -1 mod R>
[0091] Furthermore, the quantum state of the register below can be evolved using a modulo-number negative operator to obtain:
[0092] |AKmod R>|B×K -1 mod R>
[0093] For example, assuming the initial value of the upper register |A> is |3>, the initial value of the lower register |B> is |5>, K=2, and R=7, we can obtain K- 1 With mod R = 4, after the first modulo-scalar multiplier, we get |3>|4>; after the inverse multiplier, we get |1>|4>; after the second modulo-scalar multiplier, we get |1>|6>; swapping the quantum states of the two registers gives |6>|1>; and by evolving the quantum state of the register below through the modulo-negation operator, we get |6>|6>. All the above data represent data modulo R.
[0094] And A×K=6mod 7, B×K -1 =6 mod 7, that is, |AK mod R>|B×K -1 mod R>=|6>|6>.
[0095] It can be seen that the above-mentioned modular double multiplier can realize the evolution from |A>|B> to |A mod R>|B+AK mod R>.
[0096] In one embodiment, a modulo negative operator includes: an increment operator, an axis flip operator for R-1, and a decrement operator that is the inverse of the increment operator.
[0097] Correspondingly, the modulo negative operator is used to perform operations on |-B| by subtracting 1. n ×Q -1 Subtracting 1 from mod R> yields |(-B) n ×Q -1 -1)mod R>.
[0098] Then, the axis flipping arithmetic unit is used to process |(-B) n ×Q -1 -1)mod R> performs an axis flip operation for R-1, resulting in |(R-1-1-(-B)|. n ×Q -1 -1))mod R>.
[0099] Furthermore, by using the increment operator, |(R-1-1-(-B) n ×Q -1Adding 1 to -1))mod R> yields |B n ×Q - 1 mod R>.
[0100] For any quantum state |A>, it can be evolved into |(A-1)modR> using a decrement operator; for any quantum state |A>, it can be evolved into |(A+1)modR> using an increment operator; for any quantum state |A>, it can be evolved into |(R-1-1-A)modR> using an axis-flipping operator for R-1. It can be understood that for any quantum state |A>, it can be evolved into |(R-1-A)modR> using an axis-flipping operator for R.
[0101] See Figure 5 , Figure 5 A simplified diagram of a modulo negative arithmetic unit provided in an embodiment of this application. Figure 5 In this context, p represents the p qubits in the register, and the quantum states of the p qubits are used to represent the superposition state |A>. That is, the modulus negative operator can realize the evolution from |A> to |(RA)mod R>, that is, realize the evolution from |A> to |(-A)mod R>.
[0102] Accordingly, see Figure 6 , Figure 6 This is a structural diagram of a modulo negative arithmetic unit provided in an embodiment of this application.
[0103] Figure 6 In the diagram, the dashed boxes from left to right represent the minus 1 operator, the axis flip operator for R-1, and the increment operator in the modulus negative operator, respectively. The minus 1 operator is used to implement the inverse evolution of the increment operator; that is, the minus 1 operator represents the dagger circuit of the increment operator. For example, the minus 1 operator is obtained by applying a transpose conjugate operation to the increment operator.
[0104] against Figure 6 The modulo-number negative operator shown here, if p represents p qubits in the register, and the quantum states of the p qubits are used to represent the superposition state |A>, then the decrement operator can evolve |A> into |(A-1)mod R>.
[0105] Furthermore, the axis flipping operator for R-1 can evolve |(A-1)mod R> into |(R-1-1-(A-1))mod R>, that is, |(R-1-A)mod R>.
[0106] Then, the add-1 operator can evolve |(R-1-A)mod R> into |(R-1-A+1)mod R>, that is, |(RA)mod R>.
[0107] In one embodiment, for the R-1 axis toggling arithmetic unit, for |(-B n ×Q -1 For each computational basis vector less than R-1 contained in the -1)mod R>, calculate the value obtained by taking the modulo of that computational basis vector with respect to R-1-1, invert the calculated value, and replace the computational basis vector with the inverted computational basis vector to obtain |(R-1-1-(-B)|. n ×Q -1 -1))mod R>.
[0108] In this embodiment of the application, the axis flipping operator for any value Z is equivalent to an operator that performs the following function:
[0109]
[0110] That is, when using the Z-axis flipper to evolve the quantum superposition state, for any computational basis vector |M> contained in the quantum superposition state, if the computational basis vector |M> is greater than or equal to Z, then the computational basis vector |M> remains unchanged; if the computational basis vector |M> is less than Z, then the value obtained by taking the modulus of the computational basis vector |M> modulo Z-1 is calculated, and the inverse of the calculated value is taken, i.e., |(-M)mod(Z-1)> is obtained, and the computational basis vector |M> is replaced with the inverse computational basis vector |(-M)mod(Z-1)>. It can be understood that the inverse here refers to taking the inverse of addition, that is, taking the inverse of M results in -M.
[0111] For a plurality of qubits used to represent a quantum superposition state, if the number of such qubits is L, then the maximum value that such a plurality of qubits can represent is 2. L -1, calculate the basis vectors including |0>, |1>, |2>...|2 L -1>. Any quantum superposition state represented by these multiple qubits can contain at least one of the above-mentioned computational basis vectors. Therefore, for any quantum superposition state, the computational basis vectors it contains can also be determined.
[0112] For example: (Flip<4)(|0>+|1>+|2>+|3>+|4>+|5>+|6>+|7>)=(|3>+|2>+|1>+|0>+|4>+|5>+|6>+|7>)
[0113] It can be seen that, since Z = 4, in the calculated basis vectors |0>, |1>, |2>, |3>, |4>, |5>, |6>, and |7> remain unchanged. For |0>, |(-0)mod 3> = |3>, therefore, |0> is replaced with |3>; for |1>, |(-1)mod 3> = |2>, therefore, |1> is replaced with |2>; for |2>, |(-2)mod 3> = |1>, therefore, |2> is replaced with |1>; for |3>, |(-3)mod 3> = |0>, therefore, |3> is replaced with |0>.
[0114] Therefore, using the axis flipping arithmetic unit for R-1, for |(-B n ×Q -1 For each basis vector less than R-1 contained in -1)mod R>, calculate the value obtained by taking the basis vector modulo R-1-1, invert the calculated value, and replace the calculated basis vector with the inverted calculated basis vector. This can achieve axis flipping for R-1.
[0115] For example, targeting Figure 6 If the initial value of register |A> is |5> and R=7, it can be transformed into |4mod7> after the subtraction operator; using the axis flipping operator for R-1, the value of |4mod7> modulo R-1-1 (i.e., |4mod5>) is calculated, and the inverse of the calculated value is obtained as |1mod5>; then, it can be transformed into |2mod7> after the addition operator.
[0116] In addition, due to Figure 6 It realizes the evolution from |A> to |(RA)mod R>, that is, if the initial value of register |A> is |5> and R=7, then the evolved value is |2mod7>.
[0117] Based on this, it can be seen that Figure 6 The modulo negative operator shown can realize the evolution from |A> to |(RA)mod R>.
[0118] In one implementation, the axis flipping arithmetic unit for R-1 may include: two constant comparators for R-1 and two constant subtractors for R-1.
[0119] See Figure 7 , Figure 7 This is a structural diagram of an axis flipping arithmetic unit for any value Z provided in an embodiment of this application.
[0120] Figure 7In the diagram, the dashed boxes from left to right represent the first constant comparator for Z, the first constant subtractor for Z, the second constant comparator for Z, and the second constant subtractor for Z, respectively.
[0121] in, Figure 7 The constant comparator in the diagram has two registers as inputs. The upper register contains p qubits, whose quantum states represent the quantum superposition state |A>. The lower register contains a dirty qubit. This constant comparator compares the magnitudes of Z and A and determines whether to perform an X-gate evolution (i.e., flip) on the dirty qubit based on the comparison result. For example, if A is less than Z, the dirty qubit is evolved using the X-gate; if A is not less than Z, the dirty qubit is not evolved using the X-gate, meaning the upper register remains unchanged. Figure 7 The non-modulus constant subtractor in the code can achieve the evolution from |A> to |AZ>. Figure 7 In the middle, the register below (i.e., the dirty qubit) can also be used as the control qubit for the non-modulus constant subtractor for Z.
[0122] Therefore, if the quantum state of p qubits represents the quantum superposition state |A>, then based on the constant comparator for R-1, the magnitude relationship between R-1 and A can be compared, and the comparison result can be stored in the register below.
[0123] Correspondingly, if the quantum state of input p qubits represents a quantum superposition state |A>, then through a constant subtractor for R-1, it can be evolved into |(A-(R-1))modR>.
[0124] In one embodiment, the third register contains one qubit with an initial state of |0>, and the other qubits are dirty qubits with unknown initial states.
[0125] In one embodiment, the second register contains a preset number of auxiliary qubits; the third register contains a preset number of auxiliary qubits; the preset number is half the number of modular-to-digital dual multipliers contained in the modular index arithmetic unit.
[0126] Figure 7 The axis-flipping arithmetic unit only requires one qubit with a known state to store the comparison result. See also... Figure 1 The modular indexing arithmetic unit provided in this application requires only one qubit with a known state for the third register, while the remaining p-1 qubits can be dirty qubits. This saves on the number of clean qubits (i.e., qubits with known states), thus reducing computational costs.
[0127] In addition, such as Figure 1As shown, based on the modular indexing arithmetic unit provided in this application embodiment, the second and third registers only require a total of 2p qubits, while the modular indexing arithmetic implemented based on Fourier addition in related technologies requires 2p+2 qubits. Thus, it can be seen that the modular indexing arithmetic unit provided in this application embodiment can reduce the total number of qubits required, thereby further reducing computational costs.
[0128] Based on the same inventive concept, this application also provides a quantum circuit, including: a quantum Fourier operator, a first register, a second register, a third register, and the modular index operator from the aforementioned embodiments. Figure 1 As shown, the quantum Fourier operator 102 is used to perform Fourier transforms on the quantum states of the qubits in the first register.
[0129] Based on the same inventive concept, this application also provides a decryption method, see [link to relevant documentation]. Figure 8 , Figure 8 A flowchart of a decryption method provided in this application embodiment, the method may include the following steps:
[0130] S801: Performs evolutionary operations according to a pre-constructed quantum circuit.
[0131] In this system, the initial state of the least significant qubit in the second register is |1>, and the initial states of the other qubits are |0>; the quantum superposition state |A> is an equally probable quantum superposition state. This quantum circuit can be the quantum circuit described in the preceding embodiments, that is, the quantum circuit includes a quantum Fourier operator, a first register, a second register, a third register, and a modular index operator as described in the preceding embodiments. K is less than R, and K and R are coprime.
[0132] S802: Measure the qubits in the evolved first register to obtain f(A) = K A The period of the (modR) function.
[0133] S803: Calculate the private key for the RSA algorithm based on the obtained period and the public key containing R for the RSA algorithm.
[0134] S804: Decrypt the encrypted data obtained by encrypting it according to the public key based on the calculated private key to obtain the decryption result.
[0135] The first register contains qubits used to represent equally probable quantum superposition states, for example, in Figure 1 The quantum circuit shown can also include an H gate to evolve the qubits in the first register to obtain an equally probable quantum superposition state |A>.
[0136] The RSA algorithm contains a pair of public and private keys. For example, the public key can be represented as (e, R), and the private key is represented as (d, R).
[0137] Correspondingly, the process of generating the public and private keys includes: generating two sufficiently large prime numbers p and q, obtaining the composite number N = p * q, and then calculating the least common multiple L of p - 1 and q - 1. Generate e such that e and L are relatively prime and satisfy 1 < e < L. Generate d such that d * e % L = 1 and 1 < d < L.
[0138] The RSA algorithm is an asymmetric encryption algorithm designed based on the difficulty of factoring the large number R. Therefore, as long as the factorization of R can be achieved, the encrypted data obtained based on the RSA algorithm can be decrypted. Its core is to obtain p and q through R.
[0139] The above problem can be transformed into finding the period of the function f(A) = K A (mod R). Let the periodic function f(A) = K A (mod R) have a period of r (K is less than R and K is an integer relatively prime to R).
[0140] Based on the above Figure 1 As shown in the quantum circuit, by measuring the qubits in the first register and performing a continued fraction expansion based on the measurement results, the above period r can be obtained. Furthermore, based on the period r, p and q can be calculated, and then, in combination with the public key (e, R), d in the private key can be calculated. Correspondingly, the encrypted data can be decrypted using the private key.
[0141] Based on the same inventive concept, an embodiment of the present application also provides a decryption device. Refer to Figure 9 , the device includes:
[0142] An evolution module 901, configured to perform an evolution operation according to the pre-constructed quantum circuit in the foregoing embodiment; wherein, the initial state of the lowest qubit in the second register is |1>, and the initial states of other qubits are |0>; the quantum superposition state |A> is a quantum superposition state with equal probabilities; K is less than R and K is relatively prime to R;
[0143] A period calculation module 902, configured to measure the qubits in the first register after evolution to obtain the period of the function f(A) = K A (mod R);
[0144] A private key calculation module 903, configured to calculate the private key of the RSA algorithm based on the obtained period and the public key of the RSA algorithm including R;
[0145] The decryption module 904 is used to decrypt the encrypted data obtained by encrypting it according to the public key based on the calculated private key, and obtain the decryption result.
[0146] Based on the same inventive concept, this application also provides a quantum computer device, including a decryption quantum circuit, which includes a quantum Fourier operator, a first register, a second register, a third register, and a modular index operator as described in any of the foregoing embodiments; the quantum computer device implements the decryption method in the foregoing embodiments when it is running.
[0147] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of any of the above-described decryption methods.
[0148] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the decryption methods described above.
[0149] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0150] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0151] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of quantum circuits, methods, apparatuses, devices, computer-readable storage media, and computer program products are described simply because they are substantially similar to the modular arithmetic unit embodiments; relevant parts can be referred to in the description of the method embodiments.
[0152] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.
Claims
1. A modular arithmetic unit, characterized in that, include: Multiple modular multipliers; each modular multiplier corresponds one-to-one with a qubit in the first register; the quantum state |A of each qubit in the first register. m-1 >、|A m-2 >、|A m-3 >...|A0> represent the bits of the quantum superposition state |A> from high to low; With quantum state |A n The corresponding modular double multiplier is used in quantum state |A n When the result is |1>, the result |X| of the previous modulo-digital double multiplier applied to the second register is used. n >Evolved into Where R represents the first preset value and K represents the second preset value; the input of the first modular double multiplier includes the initial state of the auxiliary qubit in the second register; n≤m-1; With quantum state |A n The corresponding modular double multiplier is also used in quantum state |A n When the result is |1>, the result |B of the previous modulo-digital double multiplier applied to the third register is used. n >Evolved into The input to the first modular-to-digital double multiplier also includes the initial state of the auxiliary qubit in the third register; a modular-to-digital double multiplier comprises: two modular-to-digital scalar multipliers, an inverse multiplier, and a modular-to-digital negative multiplier; the inverse multiplier is used to implement the evolution that is the inverse of the modular-to-digital scalar multiplier; With quantum state |A n The corresponding modular double multiplier is used in quantum state |A n When the result is |1>, the result of the operation on the second and third registers by the first modular double multiplier is sequentially passed through one modular scalar multiplier, the inverse multiplier, and the other modular scalar multiplier, |X>. n >|B n >Evolution; After another modular scalar multiplier operation, the quantum states of the second register and the third register are swapped; After the swapping process is performed, the quantum state of the third register is evolved through the modular negativeing unit.
2. The modular arithmetic unit according to claim 1, characterized in that, With quantum state |A n The corresponding modular double multiplier is used in quantum state |A n When the result is |1>, the result |X| of the operation performed by the previous modular double multiplier on the second and third registers is multiplied by one of the modular double multipliers. n >|B n >Evolved into |X n mod R>|(B n +X n ×Q)mod R>; Through the inverse multiplier in this modular double multiplier, |X n mod R>|(B n +X n ×Q)mod R> evolves into |-B n ×Q - 1 mod R>|(B n +X n ×Q)mod R>; Through another modular scalar multiplier in this modular double multiplier, |-B n ×Q -1 mod R>|(B n +X n ×Q)modR> evolves into |-B n ×Q -1 mod R>|X n ×Qmod R>; After another modular scalar multiplier operation, the quantum states of the second register and the third register are swapped to obtain |X n ×Qmod R>|-B n ×Q -1 mod R>; After performing the exchange process, the quantum state of the third register is evolved through the modulus negative operator to obtain |X n ×Qmod R>|B n ×Q -1 mod R>.
3. The modular arithmetic unit according to claim 2, characterized in that, A modulo negative operator includes: an increment operator, an axis flip operator for R-1, and a decrement operator that is the inverse of the increment operator; The modulo-negation operator is used to perform operations on |-B| by the subtraction operator. n ×Q -1 Subtracting 1 from mod R> yields |(-B) n ×Q -1 -1)mod R>; The axis flipping arithmetic unit is used to process |(-B) n ×Q -1 -1)mod R> performs an axis flip operation for R-1, resulting in |(R-1-1-(-B)|. n ×Q -1 -1))mod R>; The increment operator is used to process |(R-1-1-(-B) n ×Q -1 Adding 1 to -1))mod R> yields |B n ×Q -1 mod R>.
4. The modular indexing arithmetic unit according to claim 3, characterized in that, The axis-flipping arithmetic unit is used for |(-B n ×Q -1 For each computational basis vector less than R-1 contained in the -1)mod R>, calculate the value obtained by taking the modulo of that computational basis vector with respect to R-1-1, invert the calculated value, and replace the computational basis vector with the inverted computational basis vector to obtain |(R-1-1-(-B)|. n ×Q -1 -1))mod R>.
5. The modular arithmetic unit according to claim 1, characterized in that, The third register contains one qubit with an initial state of |0>, and the other qubits are dirty qubits with unknown initial states.
6. The modular arithmetic unit according to claim 1, characterized in that, The second register contains a preset number of auxiliary qubits; the third register contains a preset number of auxiliary qubits; the preset number is half the number of modular-digital double multipliers contained in the modular index arithmetic unit.
7. A quantum circuit, characterized in that, The quantum circuit includes a quantum Fourier operator, a first register, a second register, a third register, and a modular indexing operator as described in any one of claims 1-6; the quantum Fourier operator is used to perform a Fourier transform on the quantum states of the qubits in the first register.
8. A decryption method, characterized in that, The method includes: The evolution operation is performed according to the pre-constructed quantum circuit as described in claim 7; wherein the initial state of the least significant qubit in the second register is |1>, and the initial state of the other qubits is |0>; the quantum superposition state |A> is an equally probable quantum superposition state; K is less than R, and K and R are coprime; Measuring the qubits in the evolved first register yields f(A) = K A The period of the (mod R) function; Based on the obtained period and the public key containing R in the RSA algorithm, calculate the private key for the RSA algorithm; The encrypted data, which is encrypted using the public key, is decrypted based on the calculated private key to obtain the decryption result.
9. A decryption device, characterized in that, The device includes: An evolution module is used to perform evolution operations according to a pre-constructed quantum circuit as described in claim 7; wherein the initial state of the least significant qubit in the second register is |1>, and the initial state of the other qubits is |0>; the quantum superposition state |A> is an equally probable quantum superposition state; K is less than R, and K and R are coprime; The periodic calculation module is used to measure the qubits in the evolved first register to obtain f(A) = K. A The period of the (mod R) function; The private key calculation module is used to calculate the private key for the RSA algorithm based on the obtained period and the public key containing R for the RSA algorithm. The decryption module is used to decrypt the encrypted data obtained by encrypting it according to the public key based on the calculated private key, and obtain the decryption result.
10. A quantum computing device, characterized in that, The quantum computer device includes a decryption quantum circuit, which comprises a quantum Fourier operator, a first register, a second register, a third register, and a modular indexing operator as described in any one of claims 1-6; the quantum computer device implements the method described in claim 8 when it is in operation.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method of claim 8.
Citation Information
Patent Citations
Quantum modulus multiply-inverse operation method and device, electronic device and modulus arithmetic component
CN115879552A
Quantum analog-to-digital operation method and device, medium and analog-to-digital arithmetic component
CN115879556A