The security of the internet is based on crusty old libraries with poor test coverage and code which cannot be reasoned about. Types bring more safety to our code and functional programming allows us to translate equations directly, so why are domains which are critical to the safety of the internet not using either? The idea that old code is secure because it's been around for awhile is not true and everyday new vulnerabilities are found. Cryptography, for example, is just math, which is easily translated using functional programming techniques. Using these techniques we can make the code easier to read, to test and prove, safer to use, and easier to debug. In this talk we'll dive into some best practices for providing maximal safety and show some of the common cryptographic primitives written this way. We'll discuss why it makes so much sense to rewrite critical pieces of Internet infrastructure using these techniques. Finally we'll talk about tradeoffs in speed, security and readability.