In many respects, Locke and Hobbes used similar methodologies to defend opposing viewpoints, with Hobbes using social contract theory as a defense of absolute monarchy and Locke using the same approach to defend resistance theory. In both cases, their political theories rely on the use of a thought experiment, by which they imagine what life would look like without the presence of civilization (this is referred to as the "state of nature"). Based on these conditions, they could then reconstruct the original social contract, establishing the original purpose that governments are created to achieve.
The earlier of these two thinkers, Hobbes, imagined that (without the influence of civilization to constrain them) human beings would be inclined to be brutal towards one another and that human existence in such a state would be defined by widespread misery. Thus, the original social contract would have been, at its core, a suppressive one by which people seek to escape the state of nature at virtually any cost and must submit to the authority of any ruling power.
Locke, by contrast, tends to view the state of nature as primarily defined by freedom, with human beings fundamentally driven by rational self-interest. However, at the same time, what is interesting about Locke is the degree to which he and Hobbes actually agree. For Locke, the state of nature is ultimately undermined by its own fragility and can easily descend into what he refers to as a "state of war." After all, in the pre-civilized, pre-societal state, there are no laws or authority one can turn to when expressing grievances, and this leads to cycles of violence and vendettas, reflecting a brutality not all that dissimilar from Hobbes's. The difference, however, is that this brutality is not the original starting point, but rather a departure from it.
Thus, Locke's social contract involves a compromise, by which people surrender some of the freedom represented by the state of nature in order to achieve security and thus protect those freedoms that are most essential to the human condition: life, liberty, and property. Thus, we arrive at his defense of resistance theory: if a ruling authority grows tyrannical and breaks that fundamental social contract on which it is ultimately grounded, than rebellion becomes a legitimate action.