# 整数分解

**整数分解**（Integer factorization）是将一个合数分解为若干较小整数之积的计算问题，其极限情形是分解为素因子。将两个大素数相乘很容易；但从它们的乘积中还原出这两个素数却并非易事，正是这种不对称性构成了RSA密码系统以及建立在其上的美国国家标准与技术研究院密钥建立标准的基础。<sup>[1](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-56Br2.pdf)</sup><sup> • </sup><sup>[2](https://cs-people.bu.edu/tromer/papers/tromer-phd.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| 问题陈述 | 给定合数n，找出整数p、q ≠ ±1使得n = pq；根据算术基本定理，素因子分解本身是唯一的<sup>[2](https://cs-people.bu.edu/tromer/papers/tromer-phd.pdf)</sup> |
| 最佳经典算法 | 通用数域筛法，启发式运行时间为\( \exp(O((\log N)^{1/3}(\log \log N)^{2/3})) \)，相对于比特长度是亚指数的<sup>[3](https://doi.org/10.1038/npjqi.2015.23)</sup> |
| 量子算法 | Shor算法可在多项式时间\( O((\log N)^3) \)内完成分解，将分解问题归约为模N的阶查找问题<sup>[3](https://doi.org/10.1038/npjqi.2015.23)</sup><sup> • </sup><sup>[4](https://arxiv.org/abs/quant-ph/9508027)</sup> |
| 复杂度状态 | 判定版本属于NP ∩ co-NP，且被认为不是NP难的；目前未知任何多项式时间的经典算法<sup>[2](https://cs-people.bu.edu/tromer/papers/tromer-phd.pdf)</sup> |
| 通用算法纪录 | RSA-250（250个十进制位，829比特），于2020年2月28日用数域筛法分解<sup>[5](https://members.loria.fr/PZimmermann/records/factor.html)</sup> |
| 纪录的计算代价 | 在Intel Xeon Gold 6130处理器（2.1 GHz）上约2700核心-年，其中筛法阶段2450核心-年，矩阵步骤250核心-年<sup>[6](https://www.schneier.com/blog/archives/2020/04/rsa-250_factore.html/)</sup> |
| 密码学后果 | 据估计，面对分解攻击，2048比特的RSA模数提供112比特的安全性，3072比特模数提供128比特<sup>[1](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-56Br2.pdf)</sup> |

## 问题及其在密码学中的作用

问题的表述是初等的：给定整数n，找出除±1以外的整数p、q使得n = pq，并通过反复分裂得到其素因子分解。正如高斯（Gauss）所观察到的，它的魅力在于定义的简洁；它的困难则使其成为计算数论的经典问题之一。<sup>[2](https://cs-people.bu.edu/tromer/papers/tromer-phd.pdf)</sup>

1977年，随着RSA密码系统的引入，这个问题获得了实际的重要性。RSA是第一个具有超多项式安全性猜想的公钥加密与签名方案。在RSA中，私钥是一对大素数p和q，公钥是它们的乘积n = pq；加密只需要n，而解密则需要知道两个因子。<sup>[2](https://cs-people.bu.edu/tromer/papers/tromer-phd.pdf)</sup><sup> • </sup><sup>[7](https://dlmf.nist.gov/27.16)</sup> 密码学应用利用的是寻找大素数（代价低廉）与分解其乘积（代价高昂）之间的计算机时间差：编码者选择两个各约400个十进制位的素数，公布它们800位的乘积，并将因子保密。<sup>[7](https://dlmf.nist.gov/27.16)</sup> 除RSA之外，其他公钥方案如Rabin方案和Paillier方案、Blum-Blum-Shub伪随机生成器以及VSH哈希函数也都依赖于分解的困难性。<sup>[2](https://cs-people.bu.edu/tromer/papers/tromer-phd.pdf)</sup>

美国国家标准与技术研究院的特别出版物800-56B第2版（2019年）标准化了使用整数分解密码学的成对密钥建立，规定了密钥协商和密钥传输两种方案、密钥确认以及每种方案的安全属性。其密钥生成方法确保素因子p和q具有相同的比特长度，因此RSA模数n恰好是其因子长度的两倍，任何提供至少112比特安全强度的偶数比特长度模数均可使用。<sup>[1](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-56Br2.pdf)</sup>

## 经典算法

非平凡的分解算法可追溯到皮埃尔·德·费马（Pierre de Fermat）1643年的观察，而现代格局则分为两大家族。<sup>[2](https://cs-people.bu.edu/tromer/papers/tromer-phd.pdf)</sup>

**按因子大小调优的算法。** 试除法是最简单的方法，逐一检验候选除数。约翰·M·波拉德于1975年提出的Pollard ρ算法是一种蒙特卡洛方法，它在模N下迭代一个多项式，如\( f(x) = x^2 + \alpha \)，并通过最大公约数计算来检测模某个未知除数d的碰撞；对于寻找大整数的小非平凡因子，它比试除法快得多。<sup>[8](https://www.cs.columbia.edu/~rjaiswal/factoring-survey.pdf)</sup> Pollard p − 1方法在p − 1是小素数的乘积时（即p − 1是光滑的）找到素因子p。<sup>[9](https://www.math.ens.psl.eu/~obenoist/refs/Silverman.pdf)</sup>

**椭圆曲线方法。** 1987年，小亨德里克·W·伦斯特拉（Hendrik W. Lenstra, Jr.）在《数学年刊》上发表了椭圆曲线方法（ECM），该方法通过将乘法群替换为随机椭圆曲线上的点群，从Pollard p − 1方法发展而来。据猜想，它能在期望时间至多\( K(p)(\log n)^2 \)内找到n的非平凡因子，其中p是整除n的最小素数，且\( \log K(x) = \sqrt{(2+o(1))\log x \log \log x} \)。与筛法（其运行时间本质上与素因子的大小无关）不同，ECM在p较小时显著更快，并且在发现小素因子方面特别高效。<sup>[10](https://annals.math.princeton.edu/1987/126-3/p09)</sup><sup> • </sup><sup>[11](https://pages.cs.wisc.edu/~cs812-1/Lenstra1987.pdf)</sup> 对于RSA模数，其因子p和q大小相近，筛法算法仍然更为高效。<sup>[9](https://www.math.ens.psl.eu/~obenoist/refs/Silverman.pdf)</sup>

**筛法算法。** 第二家族寻求复杂度取决于合数n本身大小的算法；它经历了Dixon算法、连分数方法、Morrison-Brillhart方法和二次筛法，最终发展为数域筛法。<sup>[2](https://cs-people.bu.edu/tromer/papers/tromer-phd.pdf)</sup> 这些方法收集大量同余式，在因子基上分解其两边，并利用线性代数将关系组合为平方同余式\( x^2 \equiv y^2 \pmod n \)，从而可能揭示一个因子。<sup>[12](https://www.cs.purdue.edu/homes/ssw/chapter3.pdf)</sup> 波拉德通过提高二次筛法中所用多项式的次数发明了数域筛法，最初用于特殊形式的数；在伦斯特拉兄弟和马纳斯于1990年分解了费马数F9之后，该方法被推广到一般数。<sup>[12](https://www.cs.purdue.edu/homes/ssw/chapter3.pdf)</sup> 通用数域筛法是已知对一般形式整数进行分解的最有效的经典算法，其运算量随输入比特长度呈亚指数增长。<sup>[2](https://cs-people.bu.edu/tromer/papers/tromer-phd.pdf)</sup><sup> • </sup><sup>[13](https://link.springer.com/article/10.1007/s11128-020-02673-x)</sup>

## 纪录与实际困难

用通用算法分解的最大整数是RSA-250，这是一个250个十进制位（829比特）的挑战数，于2020年2月28日由法布里斯·布多、皮埃里克·戈德里、奥罗尔·吉勒维克、纳迪娅·赫宁格、埃马纽埃尔·托梅和保罗·齐默尔曼分解。同一谱系中的先前纪录是RSA-240（240位，2019年12月2日，由同一团队完成）、RSA-768（232位，2009年12月12日，由克莱因容及其同事完成）和RSA-200（200位，2005年5月9日）。<sup>[5](https://members.loria.fr/PZimmermann/records/factor.html)</sup> RSA-240是一次795比特的分解，使用了与795比特离散对数计算相同的硬件和软件，表明计算离散对数并不比分解同等大小的数困难多少。<sup>[14](https://arxiv.org/abs/2006.06197)</sup>

RSA-250的计算使用了开源软件CADO-NFS，以Intel Xeon Gold 6130处理器（2.1 GHz）为参考，耗时约2700核心-年，分为2450核心-年的筛法工作和250核心-年的矩阵工作；它涉及全球数万台机器，在几个月内完成。<sup>[6](https://www.schneier.com/blog/archives/2020/04/rsa-250_factore.html/)</sup> 对于特殊形式的数，特殊数域筛法走得更远：纪录是320位，即\( 2^{1061} - 1 \)，由NFS@home于2012年8月4日分解。截至2013年9月8日，通过椭圆曲线方法发现的最大因子是一个83位数，归功于瑞安·普罗珀。<sup>[5](https://members.loria.fr/PZimmermann/records/factor.html)</sup> 一个早期的规模基准：克莱因容及其同事对一个768比特整数的分解使用了数百台计算机，历时两年，总运算量约为\( 10^{20} \)次操作。<sup>[3](https://doi.org/10.1038/npjqi.2015.23)</sup>

## 量子算法

1994年，彼得·W·肖尔（Peter W. Shor）在假想的量子计算机上给出了分解和离散对数的高效随机算法，其步数是输入规模（如待分解整数的位数）的多项式。<sup>[4](https://arxiv.org/abs/quant-ph/9508027)</sup> 肖尔的方法将分解归约为隐藏子群问题的一个特例，并在量子计算机上高效求解该问题；具体而言，它将分解N转化为阶查找，即对与N互素的随机a找到满足\( a^r \equiv 1 \pmod N \)的r，再通过一步欧几里得算法得出因子。<sup>[3](https://doi.org/10.1038/npjqi.2015.23)</sup><sup> • </sup><sup>[13](https://link.springer.com/article/10.1007/s11128-020-02673-x)</sup> 该算法运行时间为\( O((\log N)^3) \)，远快于数域筛法，其存在意味着RSA在大型量子计算机的攻击下是不安全的。<sup>[3](https://doi.org/10.1038/npjqi.2015.23)</sup>

资源估计表明了这种攻击需要什么条件。一项容错架构分析表明，分解一个2000比特整数大约需要\( 3 \times 10^{11} \)个量子门和约十亿个量子比特，在10 MHz时钟频率下运行略超过一天。<sup>[3](https://doi.org/10.1038/npjqi.2015.23)</sup> 迄今为止，在大规模量子实现该算法及验证其可扩展性方面进展甚微。<sup>[2](https://cs-people.bu.edu/tromer/papers/tromer-phd.pdf)</sup> 存在折中方案：一种伯恩斯坦、比亚斯和莫斯卡风格的低资源分解算法使用Grover搜索来寻找光滑数，运行时间为超多项式时间，比Shor算法慢，但所需逻辑量子比特数渐近更少。<sup>[15](https://pmc.ncbi.nlm.nih.gov/articles/PMC7490379/)</sup>

## 复杂度状态

从所关注的分布中抽取的整数分解的真实计算复杂度尚不清楚。相关的判定问题——n是否有一个小于x的因子——具有可高效验证的见证，即分解本身，因此它属于NP ∩ co-NP；因而，分解被认为不是NP难的，因为那将意味着多项式层级的坍塌。由于Shor算法，该问题已知属于BQP，而对其经典困难性的广泛信念建立在尽管经过数百年研究仍缺乏高效算法这一事实之上。<sup>[2](https://cs-people.bu.edu/tromer/papers/tromer-phd.pdf)</sup><sup> • </sup><sup>[8](https://www.cs.columbia.edu/~rjaiswal/factoring-survey.pdf)</sup> 相比之下，验证一个提议的分解是容易的，因为将声称的因子相乘并检验素性是快速的。<sup>[16](https://pmc.ncbi.nlm.nih.gov/articles/PMC10214188/)</sup>

## References

1. [Barker, E., Chen, L., Roginsky, A., Davis, R., Simon, S. (2019). Recommendation for Pair-Wise Key Establishment Using Integer Factorization Cryptography, NIST SP 800-56B Rev. 2.](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-56Br2.pdf)
2. [Tromer, E. Integer Factorization (dissertation chapter), Boston University.](https://cs-people.bu.edu/tromer/papers/tromer-phd.pdf)
3. [Montanaro, A. (2016). Quantum algorithms: an overview. npj Quantum Information.](https://doi.org/10.1038/npjqi.2015.23)
4. [Shor, P. W. (1995). Polynomial-Time Algorithms for Prime Factorization and Discrete Logarithms on a Quantum Computer. arXiv:quant-ph/9508027.](https://arxiv.org/abs/quant-ph/9508027)
5. [Zimmermann, P. Integer Factoring Records.](https://members.loria.fr/PZimmermann/records/factor.html)
6. [Schneier, B. (2020). RSA-250 Factored. Schneier on Security.](https://www.schneier.com/blog/archives/2020/04/rsa-250_factore.html/)
7. [DLMF §27.16 Cryptography, NIST Digital Library of Mathematical Functions.](https://dlmf.nist.gov/27.16)
8. [Rjaiswal, R. Modern Factoring Algorithms, Columbia University survey.](https://www.cs.columbia.edu/~rjaiswal/factoring-survey.pdf)
9. [Silverman, J. H. Lenstra's Elliptic Curve Factorization Algorithm.](https://www.math.ens.psl.eu/~obenoist/refs/Silverman.pdf)
10. [Lenstra, H. W., Jr. (1987). Factoring integers with elliptic curves. Annals of Mathematics 126, 649–673.](https://annals.math.princeton.edu/1987/126-3/p09)
11. [Lenstra, H. W., Jr. (1987). Factoring Integers with Elliptic Curves (paper PDF).](https://pages.cs.wisc.edu/~cs812-1/Lenstra1987.pdf)
12. [Wagstaff, S. S., Jr. History of Integer Factorization, chapter 1 (Purdue University).](https://www.cs.purdue.edu/homes/ssw/chapter3.pdf)
13. [Meng, L. et al. (2020). Quantum algorithms for typical hard problems: a perspective of cryptanalysis. Quantum Information Processing.](https://link.springer.com/article/10.1007/s11128-020-02673-x)
14. [Boudot, F., Gaudry, P., Guillevic, A., Heninger, N., Thomé, E., Zimmermann, P. (2020). Comparing the difficulty of factorization and discrete logarithm: a 240-digit experiment. arXiv:2006.06197.](https://arxiv.org/abs/2006.06197)
15. [Bernstein, D. J., Biasse, J.-F., Mosca, M. et al. (2020). On speeding up factoring with quantum SAT solvers.](https://pmc.ncbi.nlm.nih.gov/articles/PMC7490379/)
16. [A formally certified end-to-end implementation of Shor's factorization algorithm (2023).](https://pmc.ncbi.nlm.nih.gov/articles/PMC10214188/)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 数与代数 › Number theory › Computational and probabilistic number theory › Integer factorization algorithms

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/integer-factorization

English original: https://www.edgepedia.org/integer-factorization
