Excitation and dissociation of molecular hydrogen in shock waves at interstellar densities