According to Yale's Avalon Project, using L.W. White's translation of the Code of Hammurabi, its purpose as stated in its preamble was to "bring about the rule of righteousness in the land, to destroy the wicked and the evil-doers; so that the strong should not harm the weak; so that I should rule over the black-headed people like Shamash, and enlighten the land, to further the well-being of mankind."
More objectively, the Code of Hammurabi was an attempt to codify Hammurabi's legal rulings and make them accessible to the public. While the Code does provide protections and considerations for all classes of society, as well as for both accusers and accused, many rulings are written in a manner suggesting less an attempt to standardize the law than to establish Hammurabi's rulings as a precedent for what people might expect from authority -- and to perhaps glorify his abilities as judge and sovereign.
However, other aspects of the Code, including standards of value for trade and services and rules and expectations for handling family affairs such as inheritance, marriage and divorce, suggest some attempt at social standardization. This interpretation is supported by the continued use of the Code after Hammurabi's death. In either case, part of the Code's purpose was, without undermining the authority of the sovereign, to define equity as a judicial philosophy.