![]() I should emphasize that if you're trying to "reverse-engineer" a one-way function (i.e., if your circuit is computing some sort of an encryption algorithm like AES/DES, or doing SHA-like hashing) all this will be futile. You can also program to enumerate all possible solutions, though of course that could lead to a very long running loop if there are many of them.įor details on how to code up your circuit so it's amenable to this sort of analysis, you should look up Tseytin Encoding: The second line is the assignment you should use to get this desired output. The first line says sat, which means the problem is indeed solvable. # You could also set it to False, if that's what you're looking for. ![]() Here's a very simple example: from z3 import * It can be scripted from python, and you can ask it to find values of the inputs that give you the desired output. This is best done with a SAT/SMT solver, like z3 from Microsoft: But if my code is needed, just tell me in comment and if i see enough demand then i will post it here. So i don't find the need to post the code here. ![]() But it is a wall of code (more than one hundred line) and probably not the best implementation of logic circuit in the world. I wrote some script implementation of logic circuit in python. So i wonder if i can do this without brute force method ? But brute force method might be infeasible for large amount of input. I know i can do this by brute forcing, trying every combination of input. How do i get all combination of input in the logic circuit which causes the logic circuit to produce a certain output ? For example, i want to get all combination of input which causes the logic circuit to produce an output of 1. The logic circuit only consist of three basic logic gate (NOT, OR ,AND). The logic circuit produces only one output (either 0 or 1). All logic gate in the logic circuit takes two input and produce one output (for example, 1 AND 0 = 0). Suppose i have a logic circuit, the logic circuit consist of input, static bit value (either 0 or 1), and logic gate.
0 Comments
Leave a Reply. |