Hamlet informs Horatio how he outwitted Claudius, Rosencrantz and Guildenstern in their plot to have him executed by the king of England as soon as their ship anchored.
He tells Horatio that he had been restless during their journey and could not sleep. He then, during the night, put on his gown and went to seek out Rosencrantz and Guildenstern. Once he got into their cabin, he rifled through their belongings and fortunately came upon Claudius' commission, which the two were very proud to have been entrusted with.
Hamlet then went back to his room and, driven by fear, ignored any qualms about breaking the seal on Claudius' letter. The contents of the commission shocked him and he decided to write a new instruction. He used flattering language and words alluding to the amity and alliance between the two countries to sound convincing. In the letter, he instructs that the two bearers of the commission (Rosencrantz and Guildenstern) be executed immediately after presenting the letter. They should not even be allowed opportunity to defend themselves or pray for penance.
Hamlet then forged Claudius' signature, folded the letter in the official style and then used his father's signet ring (that was a copy of the Danish seal and which he carried in his purse) to imprint on the wax used to seal the rewritten commission. He then placed the new commission in Rosencrantz' and Guildenstern's possessions. The switch was never discovered.
The next day their ship was accosted by pirates and Hamlet jumped ship during the altercation. He was on board the pirate ship and became their only prisoner. The pirates stopped pursuing their ship since it was too fast. Hamlet made a deal with the pirates who would then later return him to Denmark.
Hamlet tells Horatio that he felt no guilt for sending Rosencrantz and Guildenstern to their doom for:
" ... 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."
They had themselves to blame for getting involved in the dastardly plot to have him killed. Hamlet says that they had to face the consequences of their cowardly actions - for getting involved in a dispute between two such fierce and powerful rivals (he and Claudius).
Hamlet finds the letter from his uncle to the King of England and reads it. It has orders for the King of England to kill Hamlet as soon as he reaches England. Hamlet writes a new letter requesting that Rosencrantz and Guildenstern be killed as soon as they reach England. He seals it with his royal ring. He feels that Rosencrantz and Guildenstern brought their death upon themselves by doing whatever Claudius asked of them.
K so basically.. Hamlet reads the letter that was for the king of England and finds out that Claudius tried to get him killed. So he writes another letter saying kill the person delivering this note or something like that... so rosencrantz and guildenstern die...
Hamlet doesnt feel guilty about doing this cuz its like.. kill or be killed you know what i mean... so yeah.