In recent years, great success has been achieved on the classification of symmetry-protected topological (SPT) phases for interacting fermion systems by using generalized cohomology theory. However, the explicit calculation of generalized cohomology theory is extremely hard due to the difficulty of computing obstruction functions. Based on the physical picture of topological invariants and mathematical techniques in homotopy algebra, we develop an algorithm to resolve this hard problem. It is well known that cochains in the cohomology of the symmetry group, which are used to enumerate the SPT phases, can be expressed equivalently in different linear bases, known as the resolutions. By expressing the cochains in a reduced resolution containing much fewer basis than the choice commonly used in previous studies, the computational cost is drastically reduced. In particular, it reduces the computational cost for infinite discrete symmetry groups, like the wallpaper groups and space groups, from infinity to finity. As examples, we compute the classification of two-dimensional interacting fermionic SPT phases, for all 17 wallpaper symmetry groups.