In Act V, Scene 2, Hamlet tells Horatio how he forged a letter to replace the one that Rosencrantz and Guildenstern were carrying with them aboard the ship bound for England. He created
An earnest conjuration from the King,
As England was his faithful tributary,
As love between them like the palm might flourish,
As peace should still her wheaten garland wear
And stand a comma 'tween their amities,
And many such like as's of great charge,
That on the view and knowing of these contents,
Without debatement further, more or less,
He should the bearers put to sudden death,
Not shriving-time allow'd.
This may seem unnecessarily cruel, since the two ill-fated men had no knowledge of the contents of King Claudius's letter, but Hamlet was in a tight spot. If he hadn't requested the immediate execution of Rosencrantz and Guildenstern, they would have had a lot to say in their defense. They would have told the English authorities that Hamlet had been acting crazy and had killed the king's vizier Polonius. They would have described how Hamlet acted after killing the old man and how Claudius himself believed Hamlet was totally insane and was afraid of him. Furthermore, there were two of them. Rosencrantz would verify Guildenstern's testimony, and vice versa. Whatever Hamlet put in his forged letter, he would be stuck there in England, with no way of getting back to Denmark, while the English sent an ambassador to Claudius to find out just what he wanted done. Claudius would have asked for Hamlet's immediate execution. If, however, Rosencrantz and Guildenstern were dead, Hamlet could find some way of getting out of England quickly. At the time he forged the letter, Hamlet had no way of knowing that they were going to be attacked by pirates and that he would never get to England. He does not feel guilty for having his two erstwhile friends beheaded. He tells Horatio:
Why, man, they did make love to this employment!
They are not near my conscience; their defeat
Does by their own insinuation grow.
'tis dangerous when the baser nature comes
Between the pass and fell incensed points
Of mighty opposites.
So Hamlet was by no means being gratuitously vindictive. He showed his good sense when he broke open the king's letter, and he showed his resourcefulness when he composed his counterfeit. We can imagine how poor Rosencrantz and Guildenstern reacted when they arrived in England in their best dress, expecting to be welcomed and entertained as honored guests.