validate hash before saving