Why was Hammurabi's code of laws so harsh?

Hammurabi was a just ruler who thought that cruel kings had short reigns. The Law of Moses is a biblical term first found in the Book of Joshua 8:31-32 where Joshua writes the words of "the Law of Moses" on the altar at Mount Ebal. It is mostly know by the Mosaic Law. They are written in the Book of Deuteronomy. The book of exodus has the laws from god written by his finger in stone. Both Leviticus law and Hammurabi's Code impose the death penalty in cases of adultery and kidnapping and also, there are similarities in the law of retaliation, such as "an eye for an eye". There are other examples, but in all truth, such resemblances do not demonstrate that Moses plagiarized Hammurabi's Code. About 300 years after Hammurabi, in 1440 B.C., Moses recorded the Law for the Israelites. similarities do show is that murder, theft, adultery, and kidnapping are problems in every society and must be addressed.