从RSA快速还原为SAT


28

斯科特·亚伦森(Scott Aaronson)今天的博客文章列出了有趣的,复杂的未解决问题/任务。特别引起我注意的是:

建立一个包含3SAT实例的公共库,其中包含尽可能少的变量和子句,如果解决,将产生值得注意的后果。(例如,对RSA分解挑战进行编码的实例。)研究此库上当前最佳的SAT解算器的性能。

这引发了我的问题:将RSA /分解问题减少到SAT的标准技术是什么?速度有多快?是否有这样的标准削减?

只是为了清楚起见,“快速”并不是指多项式时间。我想知道我们是否对缩减的复杂性有更严格的上限。例如,是否存在已知的立方还原?

Answers:


26

One approach to encode Factoring (RSA) to SAT is to use multiplicator circuits (Every circuit can be encoded as CNF).

C2nC=(c1,c2,,c2n)2nA=(a1,,an)A=(b1,,bn)C=AB.

The most naive encoding can be something like this: We know that

c2n=anbn
c2n1=(anbn1)xor(an1bn)
Carry:d2n1=(anbn1)(an1bn)
c2n2=(anbn2)xor(an1bn1)xor(an2bn)xord2n1
...

Then using Tseitin transformation, the above encoding can be translated into CNF.

This approach produces a relatively small CNF. But this encoding does not support "Unit Propagation" and so, the performance of SAT Solvers are really bad.

There are other circuit for multiplication which can be used for this purpose, but they produce a larger CNF.


10
In section 6.1 of "Finding Hard Instances of the Satisfiability problem: A survey", by Cook and Mitchell, they use this problem as a challenge.
Amir

How do you know that A and B must be n bits length, couldn't it be n - 1 and and n bits. For sure it can be 2n bits and 1 bit.
Ilya Gazman

1
@Babibu: If we are talking about general factorization, you are right. But for case of RSA, we know that each of the two primes has n bits.
Amir

I understand you answer but I don't know how to continue it. Can you please show c2n2.
Ilya Gazman

What about RSA-129
Ilya Gazman

18

Extending what @Amir wrote, I came across the following nice web page which hosts a CNF generator for factoring circuits that one could e.g. run on some of the (now inactive) RSA Factoring Challenge numbers. The generated instances are in DIMACS format that can directly be fed to any one of the current competitors in the annual SAT solver competition. Regarding hard SAT instances in general, the benchmark problems given at the SAT competition site appear to be quite useful, also the classification into random/crafted/industrial is nice.


1
That link is very cool!
Huck Bennett

If you actually try inputting one of those numbers you'll find their source code uses the int datatype and therefore can only hold 32-bit numbers, while the unfactored RSA numbers start at hundreds of bits.
Elliot Gorokhovsky

11

Here's a paper on generating SAT instances from factoring:

Horie, S. & Watanabe, O. [1997] "Hard instance generation for SAT" Algorithms and Computation 1350:22-31 (pdf)

It's worse than linear, but better than n2. A 512-bit RSA challenge type number generates an instance with 63,652 variables and 406,860 clauses.



0

See satfactor:


Convert Integer Factorization into a boolean SATISFIABILITY problem

Shane Neph

Overview

Determining factors of a large integer number has been of interest to Man since at least Euclid's time. There is no known general algorithm for this problem that scales in less than exponential time with respect to the number of bits needed to represent the integer.

What this code does

Converts an integer factorization problem into a boolean SATISFIABILITY problem. If the problem is solved by a SAT solver, it then extracts the integer factors.

Boolen satisfiability solvers improve every year. Every 2 years, an international competition between solvers takes place (see http://www.satcompetition.org/ and http://www.satlive.org/). How well can these state-of-the-art solvers do against one of the oldest open math problems in existence?

This project has 2 main purposes:
1) Convert the problem and factor an integer of interest!
2) Quickly create either a solvable or an unsolvable SATISFIABILITY problem, whose difficulty is easily controlled by the creater.
- To create an unsolvable SATISFIABILITY problem, simply encode a prime number.
- To create more difficult but solvable problems, choose larger composite numbers with fewer factors.

The number of interest may be any size!

There are some open-source SATISFIABILITY solvers. See http://www.satlive.org/ for some of these.

Build

make -C src/

How-To

Input a number of interest in its binary form:

bin/iencode 10101 > composite.21
// solve with your favorite solver and put results in solution.txt
bin/extract-sat composite.21 solution.txt

The output would be:
00011
00111

which are binary representations for decimal integers 3 and 7, the factors of 21.

If an input integer has more than 2 factors, and the SAT problem is solved, the output will be two of the factors only. These may not be prime numbers (you could test for that easily in Maxima, Maple, or Mathematica).

Not all SAT solvers output results in the same format. You may need to doctor those results slightly. extract-sat requires a solution file containing a list of integers (on any number of lines). For example,

1 -2 3 4 -5 ...


1
Can you summarize the techniques used by this software? On this site we are more interested in algorithms and techniques, rather than an advertisement of a software tool. For example, the questions for the complexity of the reduction. I don't see how you've addressed the question; on Stack Exchange sites, you should only answer if you can answer the specific question that was asked. Also, do you have any relationship with the tool or its authors?
D.W.
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.