Topological pairing of composite fermions has led to remarkable ideas, such as excitations obeying non-Abelian braid statistics and topological quantum computation. We construct a p-wave paired Bardeen-Cooper-Schrieffer (BCS) wave function for composite fermions in the torus geometry, which is a convenient geometry for formulating momentum space pairing as well as for revealing the underlying composite-fermion Fermi sea. Following the standard BCS approach, we minimize the Coulomb interaction energy at half filling in the lowest and the second Landau levels, which correspond to filling factors ν = 1/2 and ν = 5/2 in GaAs quantum wells, by optimizing two variational parameters that are analogous to the gap and the Debye cut-off energy of the BCS theory. Our results show no evidence for pairing at ν = 1/2 but a clear evidence for pairing at ν = 5/2. To a good approximation, the highest overlap between the exact Coulomb ground state at ν = 5/2 and the BCS state is obtained for parameters that minimize the energy of the latter, thereby providing support for the physics of composite-fermion pairing as the mechanism for the 5/2 fractional quantum Hall effect. We discuss the issue of modular covariance of the composite-fermion BCS wave function, and calculate its Hall viscosity and pair correlation function. By similar methods, we look for but do not find an instability to s-wave pairing for a spin-singlet composite-fermion Fermi sea at half-filled lowest Landau level in a system where the Zeeman splitting has been set to zero. t(Lτ )e z 2 −|z| 2 4 2 = e z 2 −|z| 2 4 2