This is a brilliant question, as both Hooper and Dimmesdale have many similarities in terms of their character. Both are shown to suffer the anguish of having committed some kind of secret sin, though in Hooper's case we never find out what that sin is, as it is only symbolised through the black veil that he insists on wearing.
One of the ironies in both of these characters is that these two figures actually find that their work as ministers becomes more effective as a result of their secret sin, as Hooper finds himself becoming a revered and effective minister with those who feel that they can identify with the minister's own secret sin. This is true as well for Dimmesdale. Consider the following quote:
But this very burden it was that gave him sympathies so intimate with the sinful brotherhood of mankind; so that his heart vibrated in unison with theirs, and received their pain into itself, and sent its own throb of pian through a thousand other hearts, in gushes of sad, persuasive eloquence.
For both Dimmesdale and Hooper, their own knowledge of sin enables them to empathise with the parishioners and therefore make them more effective as ministers trying to meet the needs of their parishioners. In addition, you might like to think of the way in which both of these characters to a certain extent reject any chance of happiness for themselves as a result of their sin. Hooper continues to wear his veil even when it causes Elizabeth to break of their engagement, and although Dimmesdale does plan to run away with Hester, it is his devotion to his job that makes him wait until after he has delivered his final sermon, when he says that he doubts there can be a happy ending for them because of the sin that they had committed together.
Whereas the Reverend Mr. Dimmesdale is the inadvertent messenger of secret sin with his congregation, the Reverend Mr. Hooper is an intended one. In Chapter XI of The Scarlet Lettter, Hawthorne writes of Dimmesdale,
While thus suffering under bodily disease, and gnawed and tortured by some black trouble of the soul, and given over to the machinations of his deadliest enemy, the Reverend Mr. Dimmesdale had achieved a brilliant popularity in his sacred office. He won it, indeed, in great part, by his sorrows.
Thus, without his intentions and against his humble protestations--
"I your pastor, whom you so reverence and trust, am utterly a pollution and a lie"--
Dimmesdale is perceived an inspiring minister and even a saint.
On the other hand, the Reverend Mr. Hooper intentionally sets out to awaken his congregation to the secrets of their hearts that they veil in sanctimony. For, he dons the black veil in order to model to them their own hidden weaknesses that they should reveal to themselves as part of the human condition. This he verbalizes on his deathbed:
When the friend shows his inmost heart to his friend; the lover to his best-beloved; when a man does not vainly shrink from the eye of his Creator, loathsomely treasuring up the secret of his sin; then deem me a monster, for the symbol beneath which I have lived, and die! I look around me, and, lo! on every visage a Black Veil!'’’
Interestingly, as the unintentional messenger, Dimmesdale is much more popular than Mr. Hooper, from whom many flee lest they perceive too much of themselves. For, it is only after Dimmesdale's confession on the scaffold that the Puritans realize his human weaknesses and are, thereby, awakened to the realization that in Dimmesdale's sufferingthey have earlier recognized their own sins, while Mr. Hooper awakens his congregation as soon as he dons his veil.