The instructive thing about this pair is that they share a method and diverge completely. Both ask what rational people would agree to if they had no government, and both treat that agreement as the source of legitimate authority. Everything that follows depends on a prior judgement about what we are like — which suggests that social contract arguments are less self-contained than they appear.
Hobbes wrote during the English Civil War, and Leviathan reads as a response to watching a state dissolve. In the absence of a common power, he argued, rough equality of ability plus scarcity plus mutual fear produces continual conflict — not necessarily constant fighting, but a permanent disposition toward it, under which nothing that requires security can develop. His summary of that condition is one of the most quoted phrases in political thought, ending in the words "nasty, brutish, and short."
Given that, the rational move is to transfer your rights to a sovereign capable of enforcing peace. And the sovereign's power must be near-absolute, because divided or conditional authority reintroduces the disputes it was created to settle. Hobbes accepts the harsh consequence: subjects have almost no right of rebellion, since the alternative to even a bad sovereign is the war he has just described. The one right retained is self-defence when the sovereign threatens your life, which is the only thing the contract was for.
Locke's state of nature is a different place. People are bound by a natural law discoverable by reason, possess rights to life, liberty and property before any government exists, and mostly observe them. The problem is not war but the absence of an impartial judge: disputes arise, and everyone judging their own case leads to escalation. Government is therefore established as a trust with a limited purpose — securing rights people already held.
That framing produces the conclusion Hobbes denied. If authority is held in trust for a purpose, a government that violates the purpose — ruling arbitrarily, taking property without consent — forfeits its authority, and resistance is not rebellion against legitimate power but a response to power that has already dissolved itself. This is the argument that runs into the American Declaration of Independence.
Both face the standing objection to contract theory: no one signed anything, and being born somewhere is not consent. Locke's answer — tacit consent through continued residence and use of the roads — was demolished by Hume, who compared it to a man carried aboard a ship in his sleep being said to consent by not leaping overboard. The modern repair, in Rawls, drops actual consent for hypothetical rational agreement. What survives from Hobbes and Locke is not the historical story but the question they made central: what would justify this to the people subject to it?