So does Likud's charter - that's not to equate the two, but to point out that a party's formal position on a topic as fundamental as that one doesn't necessarily tell the whole story. The direction in which it's moving is rather more significant.
Of course Hamas is now doing this to a large extent because of the difficult position they're in. But that's usually how it goes in ending this kind of conflicts, it's still an important step.
That's one interpretation. Another one is that they realized they had to show their goodwill to avoid becoming even more marginalized than they already are, and to some extent accept reality so as to improve their chances of remaining relevant moving forward.
Formally renouncing violence is their last and best card to play - they'd be fools to give it up for anything less than a fully viable Palestinian state with East Jerusalem as its capital and at least some concessions on the right of return.
And they are not wrong in pointing out that international law has such a thing as a right of armed resistance against foreign oppression - though they don't admit, of course, that armed resistance becomes indistinguishable from terrorism when it's aimed at non-combatants, as theirs often is. Still, looking at their adversaries, they can easily see that history doesn't always judge one so harshly for the terrorist acts committed to get to victory.