Lesson 15. Capstone: Secret messages!
This capstone covers
- Learning about the basics of cryptography
- Using basic types to model your data
- Making practical use of Enum and Bounded
- Writing and making instances of your own Cipher class
Everybody loves the idea of being able to communicate with a friend in secret. In this capstone, you’re going to take your knowledge of types and type classes to build out a few example ciphers. A cipher in cryptography is a means of encoding a message so that others can’t read it. Ciphers are the foundation of cryptography, but they’re also just plain fun to play around with. You’ll first look at an easy-to-implement and easy-to-break cipher, then you’ll learn more about the basics of encrypting characters, and finally, you’ll build an unbreakable cipher!
Most people discover cryptography in elementary school, as they try to send secret messages to their friends. The typical way to encrypt text that most kids stumble upon is the ROT13 method. ROT is short for rotation, and the 13 refers to the number of letters you rotate a given letter by. The ROT13 approach works by translating each letter in a sentence up 13 letters. For example, a is the first letter in the alphabet, and 13 letters away is n. So a would be changed to n during the encoding.