How does a secret code keep messages safe?

Imagine you want to send a message to your friend across the room, but you don't want anyone else to read it. You could whisper, but whispers don't travel through phones or computers. You need something better: a secret code that scrambles your message so thoroughly that only your friend can unscramble it.
The simplest secret codes just swap letters. You and your friend agree: every A becomes a Z, every B becomes a Y, and so on backward through the alphabet. "HELLO" turns into "SVOOL." Anyone who intercepts your note sees gibberish. But here's the problem: if someone figures out even one word, they can crack the whole pattern in minutes.
