Interesting summary, by Benedetta Berti and Zack Gold, of the quandary Hamas finds itself in with regards to the Islamic State's supporters in Gaza and Sinai:
In sum, the Hamas government in the Gaza Strip is actively involved in keeping the broader Salafi-jihadi camp from stirring up internal trouble or goading Israeli action against the strip, which includes preventing strong ties between Gaza- and Sinai-based jihadis. Likewise, to end its isolation, Hamas’s political leaders also hope to reverse a deterioration of relations with Egypt, even though the group’s military leaders are deepening their relations with some figures within the very same Salafi-jihadi camp that is fighting Egypt—and which Hamas is fighting in Gaza. This is because the ongoing economic restrictions and aggressive campaign against the tunnel economy have given Hamas’s military wing a powerful incentive to deal with any group—jihadi, criminal, or both—that could provide the weapons and financial resources it needs. In this sense, the Hamas–IS relationship is primarily driven by economic transactions. Such ties, however, also result in ad hoc cooperation, and according to Egyptian and Israeli intelligence sources, the Qassam Brigades are selling or providing weapons and offering training to IS-linked fighters with the goal of clearing its “lifeline” passage.
So much of the mess in Sinai (and of course Gaza) is due to this disastrous blockade.