I recently came across a discussion discussing conversion of SHA256 into a SAT instance by modifying the lisp implementation of SHA256 from Ironclad - sha-256 as a boolean function
There is some discussion on this and the modified version was shared, but the link died a long time ago.
The commenter states
It was actually pretty easy -- I took Ironclad SHA-256 implementation and tweaked it a bit to produce formulas instead of numbers
I am a novice at lisp, but found this fascinating. I am unable to figure out how this might have been done.
I can see how to do it by building large string which collects the operations and then later parsing the string into a boolean expression and simplifying, but that doesn't sound easy.
Can someone advise how the SHA256 code could have been modified to collect the formula instead of the result? An implementation with comments on the modifications for this would be amazing.
I really would like to learn to do this myself for other problems as I get better at lisp.