Steel is an amazing substance. By mixing in different elements and heating and cooling it in different ways, you can create surprisingly different properties. Some steels are easily bent, while others are so brittle they shatter. Some rust and others don't. The huge variety of steels means that they work in many different situations -- everything from a surgical scalpel to a skyscraper's massive metal frame can be made of steel!
The idea behind case hardening is to have two different types of steel at two different points in time. During manufacturing, what you would like is a relatively soft steel that is easy to bend and machine. For a lock's shank, however, a soft steel is not good because it is easy to cut with a metal saw. So after the piece is formed, you harden it to make it very difficult to cut. Case hardened steel is usually formed by diffusing carbon and/or nitrogen into the outer layer of the steel at high temperature. The carbon combines with the steel to make it nearly glass-like in its hardness. The core of the metal stays soft. This gives you a piece of metal that you cannot cut with a saw, but also will not shatter.