In Richard Brookhiser's James Madison, he states that Thomas Jefferson and James Madison used a cipher while corresponding. He doesn't go into details about how the cipher worked. Rather, he shows snippets of correspondence with certain words italicized to indicate that they were encrypted somehow.
What details of the encryption technique are available? Was it actually a cipher? Or, seeing how individual words were the encrypted, was it some sort of book code?