|
| 1 | +# Copyright 2024 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | +# |
| 15 | +# isort:skip_file |
| 16 | + |
| 17 | +r"""Bloqs for breaking RSA cryptography systems via integer factorization. |
| 18 | +
|
| 19 | +RSA cryptography is a form of public key cryptography based on the difficulty of |
| 20 | +factoring the product of two large prime numbers. |
| 21 | +
|
| 22 | +Using RSA, the cryptographic scheme chooses two large prime numbers p, q, their product n, |
| 23 | +λ(n) = lcm(p - 1, q - 1) where λ is Carmichael's totient function, an integer e such that |
| 24 | +1 < e < λ(n), and finally d as d ≡ e^-1 (mod λ(n)). The public key consists of the modulus n and |
| 25 | +the public (or encryption) exponent e. The private key consists of the private (or decryption) |
| 26 | +exponent d, which must be kept secret. p, q, and λ(n) must also be kept secret because they can be |
| 27 | +used to calculate d. |
| 28 | +
|
| 29 | +Using Shor's algorithm for factoring, we can find p and q (the factors of n) in polynomial time |
| 30 | +with a quantum algorithm. |
| 31 | +
|
| 32 | +References: |
| 33 | + [RSA (cryptosystem)](https://en.wikipedia.org/wiki/RSA_(cryptosystem)). |
| 34 | +""" |
| 35 | + |
| 36 | +from .rsa_phase_estimate import RSAPhaseEstimate |
| 37 | +from .rsa_mod_exp import ModExp |
0 commit comments