Implementation of C* boundary conditions in the hybrid Monte Carlo algorithm