Hamlet does not trust Rosencrantz and Guildenstern. That is why he breaks open the letter they are carrying to England. When he sees that Claudius is asking the English to execute him, he realizes he is in a tight spot. He does not blame Rosencrantz and Guildenstern for this....
Hamlet does not trust Rosencrantz and Guildenstern. That is why he breaks open the letter they are carrying to England. When he sees that Claudius is asking the English to execute him, he realizes he is in a tight spot. He does not blame Rosencrantz and Guildenstern for this. They do not know the contents of the letter. At this point he thinks he is on his way to England. He has no idea that a pirate ship will attack the ship he is on and that he will be returned to Denmark for ransom. He has to write a substitute letter, which he seals with his ring. He decides to order the immediate executions of both Rosencrantz and Guildenstern--but this is out of necessity. He wants to shut them up as soon as they arrive in England. Otherwise they would have a lot to tell the English about Hamlet. For one thing, they would say that Hamlet was insane. They would tell the English authorities that Hamlet murdered Polonius and that King Claudius was sending him away because he feared for his own life. They could describe some of Hamlet's mad antics, such as his thinking that Polonius was only hiding and that they were all playing a game like hide-and-seek. And they could bring up other incidents in which Hamlet appeared to be mad. They could say, quite truthfully, that both King Claudius and Queen Gertrude both believed that Hamlet was insane. What would be the result? The English would decide to delay the executions and keep Hamlet in custody until they could send an envoy to Denmark to find out what was expected of them. Hamlet would be treated with courtesy and given comfortable quarters, but he would be a prisoner. Hamlet did not especially want to be "harsh" with his former friends, but he wanted to save his own life. If the English sent an envoy to Claudius, that man would soon come back with word that Claudius wanted Hamlet executed and had actually written them a letter expressing that request. Hamlet doesn't hate his former friends. He doesn't trust them, and he doesn't care much about them. He probably wouldn't have ordered them executed in his forged letter if he hadn't considered it necessary to save his own life. Here is what Hamlet tells Horatio about them in Act 5, Scene 2:
So Guildenstern and Rosencrantz go to't.
Why, man, they did make love to their 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.
Rosencrantz and Guildenstern are what we moderns would call collateral damage. When Hamlet says, "...their defeat Does by their own insinuation grow," he means that they brought their deaths on themselves by their interference. Hamlet is only angry at Claudius. Once he discovers that Claudius had ordered the English to kill him, he becomes more determined and more cruel. He is a changed man. There will be no more vacillating and procrastinating. He intends to kill Claudius immediately. Shakespeare invented the business with the pirate ship to bring Hamlet back to Denmark quickly. The playwright didn't want to go through a lot of pointless explanation of how Hamlet went to England, how Rosencrantz and Guildenstern were "put to sudden death, Not shriving-time allowed," how Hamlet got out of England as quickly as possible, either going across to France and returning to Denmark overland, or hiring a ship to take him directly to Denmark, and so forth. Hamlet's character change has nothing to do with Rosencrantz and Guildenstern, but is entirely due to his discovery that King Claudius intends to kill him. He knows he had better kill Claudius before Claudius hears what happened to Rosencrantz and Guildenstern.
It must be shortly known to him from England
What is the issue of the business there.
It shall be short. The interim is mine,
And a man's life's no more than to say "one."