In this paper, a general algorithm for the computation of the Fourier coefficients of 2π-periodic (continuous) functions is developed based on Dirichlet characters, Gauss sums and the generalized MSbius transform. It permits the direct extraction of the Fourier cosine and sine coefficients. Three special cases of our algorithm are presented. A VLSI architecture is presented and the error estimates are given.