Tags: verilog rev 

Rating:

[Link to original writeup](https://github.com/babaiserror/ctf/blob/main/%5B210723-27%5D%20ImaginaryCTF%202021/README.md#normal-reversing-150-pts)

Looking into the given verilog file, the main function has a flag variable that's 256 bits long, and a wrong variable that is also 256 bits long. normal flagchecker(wrong, flag) is called, and if wrong is 0, it will be display "Correct!". So we need to make wrong 0.

Looking at the module normal, wrong is out and the flag is in; the module is only done with nor operations. Drawing a diagram then a truth table, we see that the output is basically `~(in ^ c1 ^ c2)`, which we want to be 0. So `flag = (~0) ^ c1 ^ c2`. We get the flag from this.