Using a generalization due to Lerch [M. Lerch, Sur un théorème de Zolotarev. Bull. Intern. de l'Acad. François Joseph 3 (1896), 34-37] of a classical lemma of Zolotarev, employed in Zolotarev's proof of the law of quadratic reciprocity, we determine necessary and sufficient conditions for the difference of two Dedekind sums to be in 8Z. These yield new necessary conditions for equality of two Dedekind sums. In addition, we resolve a conjecture of Girstmair [Girstmair, Congruences mod 4 for the alternating sum of the partial quotients, arXiv: 1501.00655].