The U.S. Constitution and the Code of Hammurabi are written codifications of laws for different civilizations. The U.S. Constitution is for the United States of America and was established in 1789. The Code of Hammurabi is Babylonian and was written in the 18th century B.C.
The U.S. Constitution is the main source of law in the United States. It lists out the powers of the different levels of government, government limitations and the basic rights of all citizens. It is the basis upon which the bulk of the U.S. government is built and regulated. It also includes the Bill of Rights, which are the first 10 amendments and grant important rights, such as the right to bear arms, separation of church and state, and right to a speedy trial.
The Code of Hammurabi is a strict, violent code of laws that is the basis for the common saying "an eye for an eye." Crimes could be punished by getting the same treatment as the crime committed, such as a broken bone, or be disproportional if the social class, status or gender of the one who committed the crime and the victim were different. This code also enforced a minimum wage and assumed suspects were innocent until proven otherwise.