While secrecy in communication systems has historically been obtained through cryptographic means in the upper layers, recent research efforts have focused on the physical layer and have unveiled ample opportunities for security design. In particular, the combination of signal processing techniques with channel coding for secrecy has been central to the development of physical-layer security efforts. Although implicit coding techniques for secrecy have been known since the 1970s, explicit code constructions have only been discovered within the last decade. The purpose of this article is to provide a synopsis of the state of the art in coding for secrecy. We discuss the general principles of coding, and we illustrate them with several examples. In particular, we discuss the importance of a nested code structure and stochastic encoding, which allow for both data reliability and security.