Most general-purpose factoring algorithms are based on the congruence of squares method.
The key takeaway here is to plan for every condition and factoring the logistics of favorable outcomes.