Phase-shifting (PS) is an important technique for phase retrieval in interferometry (and three-dimensional profiling by fringe projection) that requires a series of intensity measurements with known phase-steps. Usual PS algorithms are based on the assumption that the phase-steps are evenly spaced. In practice, however, this assumption is often not satisfied exactly, which leads to errors in the recovered phase. In this work we present a systematic algebraic approach for generating general PS algorithms with N arbitrarily spaced phase-steps, which present advantages (e.g., the PS error can be avoided) over known algorithms that assume equally spaced phase-steps. Simulations are presented.