The Sallen-Key filter is frequently used to realize radiation detector pulse shaping. To improve the performance of the digital pulse-shaping algorithm, we establish the full parameter Kirchhoff’s Current Law equations of the analog Sallen-Key circuit. Synthesizing these equations, a second-order nonhomogeneous difference equation is obtained. By analyzing the symmetry degree of the response function of the difference equation, an optimal pulse-shaping algorithm is derived. Given any shaping time, the parameters needed by this algorithm can be calculated easily. As well, this algorithm has no limitation on gain parameter and no undershoot. Simulation and field-programmable gate array test results validate the feasibility of the new algorithm.