Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The final commands you will implement in this recipe are two object-first commands, encrypt and decrypt. These operations are appropriate for an object-first approach because they apply to a single diary entry and they reverse its state with relatively little overhead.
I embarrass myself here by using the ROT13 algorithm, a simple Caesar or substitution cipher that offers no meaningful security. Since the ROT13 algorithm is reversible, you actually only need a single command, encrypt, because applying it a second time decrypts the text. I implement both methods because you would need both if you used a nonreversible algorithm—for example, a Caesar cipher that shifts the alphabet by some number other than 13.