Module finger arithmetic unit, quantum circuit, decryption method, device, equipment and medium

By designing a modular index operator in a quantum circuit and using a modular dual multiplier to realize the operation of KAmod R, the problem of difficulty in realizing the mode index operation of quantum circuit in the prior art is solved, and the decryption application of Shor algorithm is supported.

CN119494412AActive Publication Date: 2025-02-21ORIGIN QUANTUM COMPUTING TECH (HEFEI) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202311039403.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-17
Publication Date
2025-02-21
Estimated Expiration
2043-08-17

AI Technical Summary

Technical Problem

The prior art is difficult to implement modular indexing operations for a given K and R through quantum circuits, which limits the application of Shor algorithm in quantum computing.

Method used

A modular finger operator is designed, which includes multiple modular double multipliers. These modular double multipliers correspond to quantum registers one by one, and the operation of KAmod R is realized through the evolution of modular double multipliers.

Benefits of technology

The modulo index operation for a given two numbers is implemented, and the periodic calculation of the f(A) = KA(modR) function is supported in the Shor algorithm, so that the encrypted data in the RSA algorithm can be decrypted.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119494412A_ABST
    Figure CN119494412A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a mode finger arithmetic unit, a quantum circuit, a decryption method and device, equipment and a medium, and relates to the technical field of quantum. The modulus arithmetic unit comprises a plurality of modulus double multipliers; the analog-to-digital double multipliers are in one-to-one correspondence with the quantum bits in the first register; the quantum states of the quantum bits in the first register are Am-1gt; , Am-2gt; , Am-3gt; ... A0gt; respectively representing a quantum superposition state Agt; a bit from high to low; and a quantum state Angt; the corresponding modulus double multiplier is used in a quantum state Angt; the weight is 1gt; if yes, the operation result Xngt of the previous analog-to-digital double multiplier for the second register; the evolution is # imgabs0 # # imgabs1 #, R represents a first preset numerical value, and K represents a second preset numerical value; the input of the first analog-to-digital double multiplier comprises the initial state of the auxiliary quantum bit in the second register; n < = m-1. And the function of mode finger operation can be realized through a quantum circuit.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of quantum technology, and in particular to a modular finger operator, quantum circuit, decryption method, device, equipment and medium. Background Art

[0002] RSA (Ron Rivest-Adi Shamir-Leonard Adleman) algorithm is an asymmetric encryption algorithm. This technology is proposed to address the defects of symmetric encryption algorithms. Asymmetric encryption generates two keys, a public key and a private key. In the case of an unknown private key of the RSA algorithm, the Shor algorithm can be used to decrypt the encrypted data. The problem that the Shor algorithm needs to solve is to calculate the two prime factors of a large odd number R. Its core is: construct f(A)=K A (modR) function and find the period of the function. Where K is an integer less than R and relatively prime to R.

[0003] For example, the H gate can be used to construct a quantum superposition state of equal probability |A> and store it in register reg1, and the superposition state of |f(A)> can also be constructed and stored in register reg2, and the two registers are in an entangled state. Furthermore, by performing quantum measurement on the result of Fourier transform of register reg1, and based on the measurement result, according to the continued fraction algorithm, the period of f(A) can be obtained.

[0004] Based on the above method, to construct the superposition state of |f(A)>, it is necessary to realize |X0> to |X0×K A The evolution of mod R>, |X0> represents the quantum state of register reg2. That is, the modular operation for given K and R is realized, and how to realize this part of the evolution through quantum circuits has also become an urgent problem to be solved. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a modular finger operator, quantum circuit, decryption method, device, equipment and medium to implement modular finger operations for two given numbers. The specific technical solution is as follows:

[0006] In a first aspect of an embodiment of the present application, a modulus operator is first provided, comprising: a plurality of modulus double multipliers; each modulus double multiplier corresponds to a quantum bit in a first register; each quantum state of the quantum bit in the first register |A m -1>、|A m -2>、|A m -3>...|A0> represent the bits of the quantum superposition state |A> from high to low respectively;

[0007] and quantum state |A n>The corresponding modulus double multiplier is used to generate the quantum state |A n > is |1>, the result of the previous modulus double multiplier on the second register |X n >Evolved into Among them, R represents a first preset value, K represents a second preset value; the input of the first modulus double multiplier includes the initial state of the auxiliary quantum bit in the second register; n≤m-1.

[0008] Optional, with quantum state |A n >The corresponding modulus double multiplier is also used in the quantum state |A n > is |1>, the result of the previous modulus double multiplier on the third register |B n >Evolved into

[0009] The input of the first modulus double multiplier also includes the initial state of the auxiliary quantum bit in the third register.

[0010] Optionally, a modulus dual multiplier comprises: two modulus scalar multipliers, an inverse multiplier and a modulus negative operator; wherein the inverse multiplier is used to implement an evolution inverse to that of the modulus scalar multiplier;

[0011] and quantum state |A n >The corresponding modulus double multiplier is used to generate the quantum state |A n > is |1>, a modulus scalar multiplier in the modulus double multiplier is used to multiply the operation result of the previous modulus double multiplier on the second register and the third register |X n >|B n >Evolves into |X n mod R>|(B n +X n ×Q)mod R>;

[0012] Through the inverse multiplier in the modulus 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 modulus scalar multiplier in the modulus 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 modulus scalar multiplier operation, the quantum states of the second register and the third register are exchanged to obtain |X n ×Qmod R>|-B n ×Q -1 mod R>

[0015] After the exchange process is performed, the quantum state of the third register is evolved by the modulus negation operator to obtain |X n ×Qmod R>|B n ×Q -1 mod R>.

[0016] Optionally, a modulus negative operator includes: an add-1 operator, an axis flip operator for R-1, and a subtract-1 operator which is the inverse of the add-1 operator;

[0017] The modulus negative operator is used to minus 1 operator to calculate |-B n ×Q -1 mod R> is processed by subtracting 1, and we get |(-B n ×Q -1 -1) mod R>;

[0018] By flipping the axis operator |(-B n ×Q -1 -1)mod R>Perform axis flip processing on R-1 and obtain |(R-1-1-(-B n ×Q -1 -1))mod R>;

[0019] By adding 1 to |(R-1-1-(-B n ×Q -1 -1))mod R> and add 1 to get |B n ×Q - 1 mod R>.

[0020] Optionally, the axis flip operator is used for |(-B n ×Q -1 -1)mod R> for each computational basis vector less than R-1, calculate the value obtained by taking the computational basis vector modulo R-1-1, invert the calculated value, and replace the computational basis vector with the computational basis vector obtained by taking the inverse, and obtain |(R-1-1-(-B n×Q -1 -1))mod R>.

[0021] Optionally, the third register contains one quantum bit whose initial state is |0>, and the other quantum bits are dirty quantum bits whose initial states are unknown.

[0022] Optionally, the second register contains a preset number of auxiliary quantum bits; the third register contains a preset number of auxiliary quantum bits; the preset number is half the number of modulus double multipliers included in the modulus-digital operator.

[0023] According to a second aspect of an embodiment of the present application, a quantum circuit is provided, comprising a quantum Fourier operator, a first register, a second register, a third register, and the modular finger 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 the embodiments of the present application provides a decryption method, the method comprising:

[0025] The evolution operation is performed according to the pre-constructed quantum circuit as described in the second aspect above; wherein the initial state of the lowest quantum bit in the second register is |1>, and the initial state of the other quantum bits is |0>; the quantum superposition state |A> is a quantum superposition state with equal probability; K is less than R, and K is coprime with R;

[0026] The quantum bits in the first register after evolution are measured, and f(A)=K is obtained. A The period of the (modR) function;

[0027] Based on the obtained period and the public key of the RSA algorithm including R, the private key of the RSA algorithm is calculated;

[0028] The encrypted data encrypted according to the public key is decrypted based on the calculated private key to obtain a decryption result.

[0029] A fourth aspect of the embodiments of the present application provides a decryption device, the device comprising:

[0030] An evolution module, used to perform an evolution operation according to a pre-constructed quantum circuit as described in the second aspect above; wherein the initial state of the lowest quantum bit in the second register is |1>, and the initial state of other quantum bits is |0>; the quantum superposition state |A> is a quantum superposition state with equal probability; K is less than R, and K and R are mutually prime;

[0031] The cycle calculation module is used to measure the quantum bits in the first register after evolution to obtain f(A)=K A The period of the (modR) function;

[0032] A private key calculation module, used for calculating a private key of an RSA algorithm based on the obtained period and a public key including R of the RSA algorithm;

[0033] The decryption module is used to decrypt the encrypted data encrypted according to the public key based on the calculated private key to obtain a decryption result.

[0034] In a fifth aspect of an embodiment of the present application, a quantum computer device is provided, comprising a decryption quantum circuit, wherein the decryption quantum circuit comprises a quantum Fourier operator, a first register, a second register, a third register, and a modular finger operator as described in any one of the first aspects; the quantum computer device implements the above-mentioned decryption method during operation.

[0035] In a sixth aspect of an embodiment of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the third aspect is implemented.

[0036] An embodiment of the present application also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute any of the above-mentioned decryption methods.

[0037] The embodiment of the present application provides a modulus operator, comprising: a plurality of modulus double multipliers; each modulus double multiplier corresponds to a quantum bit in a first register; the quantum state of each quantum bit in the first register |A 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 modulus double multiplier is used to generate the quantum state |A n > is |1>, the result of the previous modulus double multiplier on the second register |X n >Evolved into Wherein, R represents the first preset value, K represents the second preset value; the input of the first modulus double multiplier includes the initial state of the auxiliary quantum bit in the second register; n≤m-1. That is, when |A n When > is |0>, the modulus double multiplier does not evolve the operation result of the previous modulus double multiplier on the second register, that is, the state of the quantum bit in the second register remains unchanged.

[0038] Because |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 expressed as A m-1 ×2m-1 +A m-2 ×2 m-2 +A m-3 ×2 m-3 +…A0×2 0 Therefore, K A It can also be expressed as That can be expressed as Due to the quantum state |A n >The corresponding modulus double multiplier, in the quantum state |A n > is |1>, the input quantum state of the modulus double multiplier |X n >Evolved into Therefore, for the quantum state of the second register, after the quantum state |A n >The corresponding evolution of the modulus double multiplier can be realized The evolution of , and then, through the evolution of all the modulus double multipliers, the quantum state of the quantum bit in the second register can be realized. That is, after the evolution processing of each modulus double multiplier, the quantum state of the quantum bit in the second register can be realized ×K A Evolution of mod R. It can be seen that the modular finger operator provided in the embodiment of the present application can implement modular finger operations for two given numbers (ie, K and R).

[0039] Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.

[0041] Figure 1 A structural diagram of a quantum circuit provided in an embodiment of the present application;

[0042] Figure 2 A schematic diagram of a modular finger operator provided in an embodiment of the present application;

[0043] Figure 3 A schematic diagram of a modulus-to-digital dual multiplier provided in an embodiment of the present application;

[0044] Figure 4 A structural diagram of a modulus-to-digital dual multiplier provided in an embodiment of the present application;

[0045] Figure 5 A schematic diagram of a modulus negation operator provided in an embodiment of the present application;

[0046] Figure 6 A structural diagram of a modulus negation operator provided in an embodiment of the present application;

[0047] Figure 7 A structural diagram of an axis flip operator provided in an embodiment of the present application;

[0048] Figure 8 A flowchart of a decryption method provided in an embodiment of the present application;

[0049] Fig. 9 A structural diagram of a decryption device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0050] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.

[0051] In the quantum circuit-based implementation of Shor’s algorithm, in order to calculate the constructed f(A)=K A The period of the (modR) function can be obtained by using the H gate to construct an equally probable quantum superposition state |A> and store it in register reg1 (which can be called the first register). It can also construct a superposition state of |f(A)> and store it in register reg2 (which can be called the second register), and make these two registers entangled. Furthermore, by performing quantum measurement on the result of Fourier transform of the first register, and based on the measurement result, according to the continued fraction algorithm, the period of f(A) can be obtained. To construct the superposition state of |f(A)>, it is necessary to realize |X0> to |X0×K A mod R> evolution, |X0> represents the initial state of register reg2.

[0052] The embodiment of the present application provides a modulus operator, comprising: a plurality of modulus double multipliers; each modulus double multiplier corresponds to a quantum bit in a first register; the quantum state of each quantum bit in the first register |A m-1 >、|A m-2 >、|A m-3 >...|A0> represent the bits of the quantum superposition state |A> from high to low respectively;

[0053] and quantum state |A n >The corresponding modulus double multiplier is used to generate the quantum state |A n> is |1>, the result of the previous modulus double multiplier on the second register |X n >Evolved into Among them, R represents a first preset value, K represents a second preset value; the input of the first modulus double multiplier includes the initial state of the auxiliary quantum bit in the second register; n≤m-1.

[0054] Because |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 expressed 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 It can also be expressed as That can be expressed as Due to the quantum state |A n >The corresponding modulus double multiplier, in the quantum state |A n > is |1>, the input quantum state of the modulus double multiplier |X n >Evolved into Therefore, for the quantum state of the second register, after the quantum state |A n >The corresponding evolution of the modulus double multiplier can be The evolution of , and then, through the evolution of all the modulus double multipliers, the quantum state of the quantum bit in the second register can be realized. That is, after the evolution processing of each modulus double multiplier, the quantum state of the quantum bit in the second register can be realized ×K A Evolution of mod R. It can be seen that the modular finger operator provided in the embodiment of the present application can implement modular finger operations for two given numbers (ie, K and R).

[0055] See also Figure 1 , Figure 1 A structural diagram of a quantum circuit provided in an embodiment of the present application.

[0056] Figure 1 In, |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 contained can be referred to as the second preset number. The number of qubits in the first register can be referred to as the first preset number, wherein 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 calculation result can be rounded up to obtain p. Figure 1 The m-3 in the formula indicates that in addition to |A m-1 >、|A m-2 In addition to the quantum bits corresponding to > and |A0>, there are m-3 quantum bits. Figure 1 Not shown in |A m-3 >.

[0057] In the modulus operator 101, each dotted box represents a p modulus double multiplier. Figure 1 It can also be seen that each modulus double multiplier corresponds one-to-one to the quantum bit in the first register, which also corresponds one-to-one to the quantum state of each quantum bit.

[0058] It can be seen that Figure 1 The parameters of each modulus double multiplier included in the modulus finger operator 101 are different. Therefore, before performing evolution based on the above modulus finger operator 101, m can be calculated based on the preset R, and combined with the preset K, the parameters in each modulus double multiplier can be obtained. In the modulus finger operator 101, each modulus double multiplier performs the evolution operation in sequence according to the execution sequence. The execution sequence is the order in which each operator evolves the quantum bit in the quantum circuit. Figure 1 The order of the operators from left to right in the quantum circuit reflects the execution sequence of the operators.

[0059] Figure 1 In the execution sequence, the quantum state corresponding to the first modulus double multiplier is |A m-1 >, since according to the execution sequence, there is no previous modulus double multiplier, therefore, the input |X of the second register m-1 >That is, the initial state of the quantum bit in the second register.

[0060] On the contrary, if the execution timing of each modulus double multiplier is Figure 1 On the contrary, the quantum state corresponding to the first modulus double multiplier is |A0>. Since there is no previous modulus double multiplier according to the execution sequence, its input |X0> to the second register is the initial state of the quantum bit in the second register.

[0061] Figure 1 It can be seen that for the quantum state |A n>, n≤m-1, which corresponds to a modulus double multiplier. This qubit is used as a control qubit, that is, when the quantum state of the qubit |A n > is |1>, the corresponding modulus double multiplier performs an evolution operation to convert the evolution result of the previous modulus double multiplier for the second register |X n >Evolved into It can be understood that the input of the first modulus double multiplier is the initial state of the quantum bits in the second register.

[0062] In one embodiment, with the quantum state |A n >The corresponding modulus double multiplier is also used in the quantum state |A n > is |1>, the result of the previous modulus double multiplier on the third register |B n >Evolved into like Figure 1 In the example, each modulus double multiplier is also used for The evolution of The evolution of evolution.

[0063] The input of the first modulus double multiplier also includes the initial state of the auxiliary quantum bit in the third register.

[0064] |B n >That is, the evolution result of the previous modulus double multiplier for the third register.

[0065] Similarly, Figure 1 In the execution sequence, the quantum state corresponding to the first modulus double multiplier is |A m-1 >, since according to the execution sequence, there is no previous modulus double multiplier, therefore, its input to the third register |B m-1 >That is, the initial state of the quantum bit in the third register.

[0066] On the contrary, if the execution timing of each modulus double multiplier is Figure 1 On the contrary, the quantum state corresponding to the first modulus double multiplier is |A0>. Since there is no previous modulus double multiplier according to the execution sequence, its input |B0> to the third register is the initial state of the quantum bit in the third register.

[0067] In the embodiment of the present application, each modulus double multiplier is used to perform an evolution operation on the quantum state of the qubits in the second register and the third register. That is, the input of the first modulus double multiplier also includes: the initial state of the qubit in the third register. For example, Figure 1In , |dirty>|0> represents the quantum state of the qubit in the third register. |dirty(dirty)> represents the quantum state of p-1 qubits with unknown states. Qubits with unknown states can also be called dirty qubits.

[0068] It is understandable that based on Figure 1 In the process of the quantum circuit evolving the first register, the second register and the third register, the quantum states of the quantum bits of the first register, the second register and the third register are all less than R.

[0069] Accordingly, see Figure 2 , Figure 2 A simplified diagram of a modulus operator provided in an embodiment of the present application. Figure 2 In the above, if the m above represents m qubits in a register, and the quantum state of the m qubits is used to represent the superposition state |A>, that is, each quantum state represents the bits of |A> from high to low; the p below represents p qubits in another register, and the quantum state of the p qubits is used to represent the superposition state |B>, that is, each quantum state represents the bits of |B> from high to low; then the modular finger operator in this application can realize |A>|B> to |A>|B×K A mod R>'s evolution. Figure 2 In the example, the modular operator also requires p-1 dirty qubits and one clean qubit, that is, a qubit whose state is known.

[0070] In one embodiment, a modulus dual multiplier includes: two modulus scalar multipliers, an inverse multiplier, and a modulus negation operator; wherein the inverse multiplier is used to implement an evolution inverse to that of the modulus scalar multiplier.

[0071] Correspondingly, with the quantum state |A n >The corresponding modulus double multiplier is used to generate the quantum state |A n > is |1>, a modulus scalar multiplier in the modulus double multiplier is used to multiply the operation result of the previous modulus double multiplier on the second register and the third register |X n >|B n >Evolves into |X n mod R>|(B n +X n ×Q)mod R>;

[0072] Then, |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, |-B is multiplied by another modulus scalar multiplier in the modulus double multiplier. 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, the quantum states of the second and third registers are exchanged to obtain |X n ×Qmod R>|-B n ×Q -1 mod R>.

[0075] Then, the quantum state of the third register is evolved through the modulus negation operator to obtain |X n ×Qmod R>|B n ×Q -1 mod R>.

[0076] In the embodiment of the present application, the inverse multiplier is used to implement the inverse evolution of the modulus scalar multiplier, that is, the inverse multiplier represents the dagger circuit of the modulus scalar multiplier. For example, the inverse multiplier is obtained by applying a transpose conjugate operation to the modulus scalar multiplier.

[0077] Based on the above description, it can be seen that for any modulus scalar multiplier, if the input of the modulus scalar multiplier is |A>|B>, then after the evolution of the modulus scalar multiplier, |Amod R>|(B+AQ)mod R> can be obtained, where different modulus scalar multipliers have different Q values.

[0078] Accordingly, see Figure 3 , Figure 3 A simplified diagram of a modulus-to-digital dual multiplier provided in an embodiment of the present application. Figure 3 In the above equation, Q = K -1 , the p above represents p qubits in one register, and the quantum state of the p qubits is used to represent the superposition state |A>, the p below represents p qubits in another register, and the quantum state of the p qubits is used to represent the superposition state |B>, that is, the modulus double multiplier can realize |A>|B> to |A×Kmod R>|B×K -1 mod R>'s evolution.

[0079] Accordingly, see Figure 4 , Figure 4 A structural diagram of a modulus-to-digital dual multiplier provided in an embodiment of the present application.

[0080] Figure 4 In the figure, the dashed boxes from left to right represent a modulus scalar multiplier, an inverse multiplier, another modulus scalar multiplier, and a modulus negative operator in the modulus double multiplier. The modulus negative operator requires 2 dirty qubits. Figure 4 It can be seen that the input of the modulus scalar multiplier is also opposite to the input of the inverse multiplier. That is, when evolving through the modulus scalar multiplier, the quantum state of the qubit of the upper register remains unchanged; while when evolving through the inverse multiplier, the quantum state of the qubit of the lower register remains unchanged.

[0081] against Figure 4 For the modular double multiplier shown, if the upper p represents p quantum bits in a register, and the quantum state of the p quantum bits is used to represent the superposition state |A>; the lower p represents p quantum bits in another register, and the quantum state of the p quantum bits is used to represent the superposition state |B>, that is, if the input is |A>|B>, the first modular scalar multiplier can evolve |A>|B> into |A mod R>|(B+AK)mod R>.

[0082] Furthermore, the inverse multiplier can transform |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 get:

[0085] |-B×K -1 mod R>|(B+AK)mod R>

[0086] The second modulus scalar multiplier can convert |-B×K -1 mod R>|(B+AK)mod R> evolves to:

[0087] |-B×K -1 mod R>|(B+AK+(-B×K -1 )×K)mod R>

[0088] That is, we can get |-B×K -1 mod R>|AK mod R>

[0089] Then, we can exchange the quantum states of the two registers to obtain:

[0090] |AK mod R>|-B×K -1 mod R>

[0091] Furthermore, the quantum state of the register below can be evolved through the modulus negation operator to obtain:

[0092] |AKmod R>|B×K -1 mod R>

[0093] For example, assuming that the initial value of the upper register |A> is |3>, the initial value of the lower register |B> is |5>, K=2, R=7, we can get K- 1 modR=4, after the first modulus scalar multiplier, we can get |3>|4>; after the inverse multiplier, we can get |1>|4>; after the second modulus scalar multiplier, we can get |1>|6>; swapping the quantum states of the two registers can get |6>|1>; evolving the quantum state of the lower register through the modulus negative operator can get |6>|6>. The above data are all data under mod R.

[0094] And A×K=6mod 7, B×K -1 =6mod7, that is, |AK mod R>|B×K -1 mod R>=|6>|6>.

[0095] It can be seen that the above-mentioned modulus dual multiplier can realize the evolution from |A>|B> to |A mod R>|B+AK mod R>.

[0096] In one embodiment, a modulus negation operator includes: an add-1 operator, an axis flip operator for R-1, and a subtract-1 operator which is the inverse of the add-1 operator.

[0097] Correspondingly, the modulus negation operator is used to minus 1 operator |-B n ×Q -1 mod R> is processed by subtracting 1, and we get |(-B n ×Q -1 -1)mod R>.

[0098] Then, the axis flip operator |(-B n ×Q -1 -1)mod R>Perform axis flip processing on R-1 and obtain |(R-1-1-(-B n ×Q -1 -1))mod R>.

[0099] Furthermore, by adding 1 to the operator |(R-1-1-(-B n ×Q -1-1))mod R> and add 1 to get |B n ×Q - 1 mod R>.

[0100] For any quantum state |A>, it can be evolved into |(A-1)modR> through a minus 1 operator; for any quantum state |A>, it can be evolved into |(A+1)modR> through a plus 1 operator; for any quantum state |A>, it can be evolved into |(R-1-1-A)modR> through an axis flip operator for R-1. It can be understood that for any quantum state |A>, it can be evolved into |(R-1-A)modR> through an axis flip operator for R.

[0101] See also Figure 5 , Figure 5 A schematic diagram of a modulus negation operator provided in an embodiment of the present application. Figure 5 In the figure, p represents the p quantum bits in the register, and the quantum state of the p quantum bits is used to represent the superposition state |A>, that is, the modulus negation operator can realize the evolution of |A> to |(RA)mod R>, that is, realize the evolution of |A> to |(-A)mod R>.

[0102] Accordingly, see Figure 6 , Figure 6 A structural diagram of a modulus negation operator provided in an embodiment of the present application.

[0103] Figure 6 In FIG. 1 , the dashed boxes from left to right represent the minus-1 operator, the axis flip operator for R-1, and the plus-1 operator in the modulus negation operator. The minus-1 operator is used to implement the inverse evolution of the plus-1 operator, that is, the minus-1 operator represents the dagger circuit of the plus-1 operator. For example, the minus-1 operator is obtained by applying a transpose conjugate operation to the plus-1 operator.

[0104] against Figure 6 For the modulus negation operator shown in FIG. 1 , if p represents the p qubits in the register, and the quantum state of the p qubits is used to represent the superposition state |A>, then the minus 1 operator can evolve |A> into |(A-1)mod R>.

[0105] Furthermore, the axis flip 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 addition 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 flip operator, for |(-B n ×Q -1 -1)mod R> for each computational basis vector less than R-1, calculate the value obtained by taking the computational basis vector modulo R-1-1, invert the calculated value, and replace the computational basis vector with the computational basis vector obtained by taking the inverse, and obtain |(R-1-1-(-B n ×Q -1 -1))mod R>.

[0108] In the embodiment of the present application, the axis flip operator for any value Z is equivalent to an operator that realizes the following functions:

[0109]

[0110] That is, when the quantum superposition state is evolved using the axis flip operator for Z, for any calculation basis vector |M> contained in the quantum superposition state, if the calculation basis vector |M> is greater than or equal to Z, the calculation basis vector |M> remains unchanged; if the calculation basis vector |M> is less than Z, the value obtained by taking the calculation basis vector |M> modulo Z-1 is calculated, and the calculated value is inverted, that is, |(-M)mod(Z-1)> is obtained, and the calculation basis vector |M> is replaced with the calculation basis vector |(-M)mod(Z-1)> obtained by taking the inversion. It can be understood that the inversion here refers to taking the inverse of addition, that is, the inversion of M is -M.

[0111] For multiple quantum bits used to represent each bit of the quantum superposition state, if the number of the multiple quantum bits is L, the maximum value that can be represented by the multiple quantum bits is 2 L -1, the calculation basis vectors include |0>, |1>, |2>...|2 L -1>. Any quantum superposition state represented by the multiple quantum bits may contain at least one of the above-mentioned computational basis vectors. Therefore, for any quantum superposition state, the computational basis vector contained therein may 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, among the calculation basis vectors of |0>, |1>, |2>, |3>, |4>, |5>, |6>, |7>, |4>, |5>, |6>, |7> remain unchanged. For |0>, |(-0)mod 3>=|3>, therefore, |0> is replaced by |3>; for |1>, |(-1)mod3>=|2>, therefore, |1> is replaced by |2>; for |2>, |(-2)mod3>=|1>, therefore, |2> is replaced by |1>; for |3>, |(-3)mod3>=|0>, therefore, |3> is replaced by |0>.

[0114] Therefore, using the axis flip operator for R-1, for |(-B n ×Q -1 -1)mod R>For each basis vector less than R-1, calculate the value obtained by taking the calculated basis vector modulo R-1-1, invert the calculated value, and replace the calculated basis vector with the inverted calculated basis vector, so as to implement the axis flipping processing for R-1.

[0115] For example, for Figure 6 If the initial value of register |A> is |5>, R=7, it can be evolved into |4mod7> through the minus 1 operator; use the axis flip operator for R-1 to calculate the value of |4mod7> modulo R-1-1 (that is, |4mod5>), invert the calculated value to get |1mod5>; then, it can be evolved into |2mod7> through the plus 1 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>, R=7, then the value after evolution is |2mod7>.

[0117] Based on this, it can be seen that Figure 6 The modulus negation operator shown enables the evolution of |A> to |(RA) mod R>.

[0118] In one implementation, the axis flip operator for R-1 may include: two constant comparators for R-1 and two constant subtractors for R-1.

[0119] See also Figure 7 , Figure 7 A structural diagram of an axis flip operator for any value Z provided in an embodiment of the present application.

[0120] Figure 7In the figure, the dotted 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 , whose input includes two registers, the upper register contains p qubits, the quantum state of the p qubits is used to represent the quantum superposition state |A>, and the lower register contains a dirty qubit. The constant comparator can compare the size relationship between Z and A, and determine whether to perform the X-gate evolution (i.e., flip) on the dirty qubit of the path according to the comparison result. For example, if A is less than Z, the X-gate evolution is performed on the dirty qubit of the path; if A is not less than Z, the X-gate evolution is not performed on the dirty qubit of the path, that is, the upper register remains unchanged. Figure 7 The non-modulus constant subtractor in can realize the evolution of |A> to |AZ>. Figure 7 In the example, the lower register (i.e., dirty qubit) can also serve as the control qubit of the non-modular constant subtractor for Z.

[0122] Therefore, if the quantum state of the input p quantum bits represents the quantum superposition state |A>, based on the constant comparator for R-1, the size 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 the input p quantum bits represents the quantum superposition state |A>, then through the constant subtractor for R-1, it can be evolved into |(A-(R-1))modR>.

[0124] In one embodiment, the third register contains one quantum bit whose initial state is |0>, and the other quantum bits are dirty quantum bits whose initial states are unknown.

[0125] In one embodiment, the second register includes a preset number of auxiliary quantum bits; the third register includes a preset number of auxiliary quantum bits; the preset number is half the number of modular double multipliers included in the modular finger operator.

[0126] Figure 7 The axis-flipping operator only needs one qubit with a known state to store the comparison result. Figure 1 The modular finger operator provided in the embodiment of the present application only needs one qubit with a known state for the third register, and the remaining p-1 qubits can be dirty qubits. Thus, the number of clean qubits (i.e., qubits with known states) required can be saved, which can reduce the computing cost.

[0127] In addition, if Figure 1As shown, based on the modular finger operator provided in the embodiment of the present application, the second register and the third register only need 2p qubits in total, while the modular finger operation based on Fourier addition in the related art requires 2p+2 qubits. In this way, it can also be seen that the modular finger operator provided in the embodiment of the present application can reduce the total number of qubits required, which can further reduce the computing cost.

[0128] Based on the same inventive concept, the embodiment of the present application further provides a quantum circuit, including: a quantum Fourier operator, a first register, a second register, a third register, and the analog finger operator in the above embodiment. Figure 1 As shown, the quantum Fourier operator 102 is used to perform Fourier transform on the quantum state of the quantum bit in the first register.

[0129] Based on the same inventive concept, the present application embodiment also provides a decryption method, see Figure 8 , Figure 8 A flowchart of a decryption method provided in an embodiment of the present application, the method may include the following steps:

[0130] S801: Execute evolution operations according to the pre-built quantum circuit.

[0131] The initial state of the lowest-order quantum bit in the second register is |1>, and the initial state of the other quantum bits is |0>; the quantum superposition state |A> is a quantum superposition state of equal probability. The quantum circuit can be the quantum circuit introduced in the above embodiment, that is, the quantum circuit includes a quantum Fourier operator, a first register, a second register, a third register, and a modulus operator as in the above embodiment. K is less than R, and K and R are mutually prime.

[0132] S802: Measure the quantum bits in the first register after evolution, and obtain f(A)=K A The period of the (modR) function.

[0133] S803: Calculate the private key of the RSA algorithm based on the obtained period and the public key including R of the RSA algorithm.

[0134] S804: Decrypt the encrypted data encrypted according to the public key based on the calculated private key to obtain a decryption result.

[0135] The first register contains qubits that represent equally probable quantum superposition states, e.g. Figure 1 In the quantum circuit shown, an H gate may also be provided to evolve the quantum bits in the first register to obtain a quantum superposition state |A> with equal probability.

[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 is relatively prime to L and satisfies 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 large numbers 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 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, combined 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 Fig. 9 , the device includes:

[0142] An evolution module 901, configured to perform an evolution operation according to a pre-constructed quantum circuit as 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 an equally probable quantum superposition state; 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 evolved first register 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 encrypted according to the public key based on the calculated private key to obtain a decryption result.

[0146] Based on the same inventive concept, an embodiment of the present application also provides a quantum computer device, including a decryption quantum circuit, wherein the decryption quantum circuit includes a quantum Fourier operator, a first register, a second register, a third register, and a modular finger operator as described in any of the aforementioned embodiments; the quantum computer device implements the decryption method in the aforementioned embodiments when running.

[0147] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned decryption methods are implemented.

[0148] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any decryption method in the above embodiments.

[0149] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part 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, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.

[0150] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements not only includes those elements, but also includes other elements that are not clearly listed, or also includes elements inherent to such process, method, article or equipment. In the absence of more restrictions, the elements limited by the statement "comprise one..." do not exclude the existence of other identical elements in the process, method, article or equipment including the elements.

[0151] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the quantum circuit, method, device, equipment, computer-readable storage medium, and computer program product embodiments, since they are basically similar to the analog finger operator embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0152] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims

1. A modular finger operator, characterized in that: include: A plurality of modulus double multipliers; each modulus double multiplier corresponds to a quantum bit in the first register one by one; the quantum state of each quantum bit in the first register |A m-1 >、|A m-2 >、|A m-3 >...|A0> represent the bits of the quantum superposition state |A> from high to low respectively; and quantum state |A n >The corresponding modulus double multiplier is used to generate the quantum state |A n > is |1>, the result of the previous modulus double multiplier on the second register |X n >Evolved into Among them, R represents a first preset value, K represents a second preset value; the input of the first modulus double multiplier includes the initial state of the auxiliary quantum bit in the second register; n≤m-1.

2. The modular finger operator according to claim 1, characterized in that: and quantum state |A n >The corresponding modulus double multiplier is also used in the quantum state |A n > is |1>, the result of the previous modulus double multiplier on the third register |B n >Evolved into The input of the first modulus double multiplier also includes the initial state of the auxiliary quantum bit in the third register.

3. The modular finger operator according to claim 2, characterized in that: A modulus dual multiplier comprises: two modulus scalar multipliers, an inverse multiplier and a modulus negative operator; wherein the inverse multiplier is used to realize the inverse evolution of the modulus scalar multiplier; and quantum state |A n >The corresponding modulus double multiplier is used to generate the quantum state |A n > is |1>, a modulus scalar multiplier in the modulus double multiplier is used to multiply the operation result of the previous modulus double multiplier on the second register and the third register |X n >|B n >Evolves into |X n mod R>|(B n +X n ×Q)mod R>; Through the inverse multiplier in the modulus 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 modulus scalar multiplier in the modulus 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 modulus scalar multiplier operation, the quantum states of the second register and the third register are exchanged to obtain |X n ×Qmod R>|-B n ×Q -1 mod R> After the exchange process is performed, the quantum state of the third register is evolved by the modulus negation operator to obtain |X n ×Qmod R>|B n ×Q -1 mod R>.

4. The modular finger operator according to claim 3, characterized in that: A modulus negative operator comprises: an add-1 operator, an axis flip operator for R-1, and a subtract-1 operator which is the inverse of the add-1 operator; The modulus negative operator is used to minus 1 operator to calculate |-B n ×Q -1 mod R> is processed by subtracting 1, and we get |(-B n ×Q -1 -1) mod R>; By flipping the axis operator |(-B n ×Q -1 -1>mod R> performs axis flipping on R-1, and obtains |(R-1-1-(-B n ×Q -1 -1))mod R>; By adding 1 to |(R-1-1-(-B n ×Q -1 -1))mod R> and add 1 to get |B n ×Q -1 mod R>.

5. The modular finger operator according to claim 4, characterized in that: The axis flip operator is used for |(-B n ×Q -1 -1)mod R> for each computational basis vector less than R-1, calculate the value obtained by taking the computational basis vector modulo R-1-1, invert the calculated value, and replace the computational basis vector with the computational basis vector obtained by taking the inverse, and obtain |(R-1-1-(-B n ×Q -1 -1))mod R>.

6. The modular finger operator according to claim 2, characterized in that: The third register contains one quantum bit whose initial state is |0>, and the other quantum bits are dirty quantum bits whose initial states are unknown.

7. The modular finger operator according to claim 2, characterized in that: The second register includes a preset number of auxiliary quantum bits; the third register includes a preset number of auxiliary quantum bits; the preset number is half of the number of modulus double multipliers included in the modulus operator.

8. 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 finger operator as described in any one of claims 1 to 7; the quantum Fourier operator is used to perform Fourier transform on the quantum state of the quantum bit in the first register.

9. A decryption method, characterized in that: The method comprises: The evolution operation is performed according to the pre-constructed quantum circuit as claimed in claim 8; wherein the initial state of the lowest quantum bit in the second register is |1>, and the initial state of the other quantum bits is |0>; the quantum superposition state |A> is a quantum superposition state with equal probability; K is less than R, and K is coprime with R; The quantum bits in the first register after evolution are measured, and f(A)=K is obtained. A The period of the (modR) function; Based on the obtained period and the public key of the RSA algorithm including R, the private key of the RSA algorithm is calculated; The encrypted data encrypted according to the public key is decrypted based on the calculated private key to obtain a decryption result.

10. A decryption device, characterized in that: The device comprises: An evolution module, configured to perform an evolution operation according to a pre-constructed quantum circuit as claimed in claim 8; wherein the initial state of the lowest quantum bit in the second register is |1>, and the initial state of the other quantum bits is |0>; the quantum superposition state |A> is a quantum superposition state with equal probability; K is less than R, and K is coprime with R; The cycle calculation module is used to measure the quantum bits in the first register after evolution to obtain f(A)=K A The period of the (modR) function; A private key calculation module, used for calculating a private key of an RSA algorithm based on the obtained period and a public key including R of the RSA algorithm; The decryption module is used to decrypt the encrypted data encrypted according to the public key based on the calculated private key to obtain a decryption result.

11. A quantum computer device, characterized in that: The method comprises a decryption quantum circuit, wherein the decryption quantum circuit comprises a quantum Fourier operator, a first register, a second register, a third register, and a modular finger operator as claimed in any one of claims 1 to 7; and the quantum computer device implements the method as claimed in claim 9 when running.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to claim 9 is implemented.

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

  • Efficient quantum modular multiplier and method of quantum modular multiplication

    KR102204081B1