O'Reilly logo

C# 5.0 Programmer's Reference by Rod Stephens

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 27 Cryptography

What’s in This Chapter

  • Symmetric key encryption and decryption
  • Asymmetric key encryption and decryption
  • Creating, saving, and retrieving public and private keys
  • Cryptographic random numbers
  • Generating keys, initialization vectors, and salts

Wrox.com Downloads for This Chapter

Please note that all the code examples for this chapter are available as a part of this chapter’s code download on the book’s website at www.wrox.com/go/csharp5programmersref on the Download Code tab.

Cryptography is the study of methods for protecting communications between two people in the presence of an adversary who wants to intercept the communications. Early forms of cryptography, which were used thousands of years ago, use techniques such as rearranging letters or replacing letters with other letters. For example, in a Caesar substitution cipher (named after Julius Caesar who used it more than 2,000 years ago), you shift letters by some fixed amount. For a shift of 3, A becomes D, B becomes E, C becomes F, and so forth.

These encryption schemes are interesting and fun to experiment with, but they’re relatively easy to break with modern techniques. My book Essential Algorithms: A Practical Approach to Computer Algorithms (John Wiley and Sons, 2013) includes a chapter that describes some of these historical methods and how to break them (mostly for entertainment value).

Other books such as Applied Cryptography: Protocols, Algorithms, and Source Code in C (by Bruce Schneier, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required