Cryptography serves dual purposes: it protects your cities from enemy Spies and enables your Spies to carry out offensive missions more successfully. It's a good go-to policy in the late game, especially if you have a substantial scientific, cultural, or economic advantage over your opponents and they're trying to use their Spies to close the gap.
Cryptography prior to the modern age was primarily a matter of encryption, often simple transposition or substitution cyphers, making a message nonsense without a key. Like a game for bright children. By World War II, however, cryptography was mostly a matter of mathematical theory and computer science … hardly child’s play. Cryptographic algorithms were designed around computational assumptions and integer factorization. At England’s Bletchley Park facility during World War II, research culminated in Colossus – civilization’s first electronic, digital, programmable computer – built to decrypt the Lorenz cipher. Now nations, corporations, and hackers devote immense blocks of computing time and analysis to cryptosystems … creating them and breaking them.