Difference between symmetric crypto algorithms

Tony picture Tony · Mar 16, 2009 · Viewed 10k times · Source

C# looks to have 4 different symmetric crypto algorithms: RijndaelManaged, DESCryptoServiceProvider, RC2CryptoServiceProvider, and TripleDESCryptoServiceProvider.

I am looking for more information between them. Mainly what is the differences between each of them. MSDN isn't being much help, or I am just tired. ;) I am sure there is pro and cons between each of them, just like anything where there are multiple ways of doing something.

Thank you for any enlightenment.
Tony

Answer

Hamish Smith picture Hamish Smith · Mar 16, 2009

This the Ranking (for year 2015) the strongest algorithm appears on top:

Use AES.

In more details:

  • DES is the old "data encryption standard" from the seventies. Its key size is too short for proper security (56 effective bits; this can be brute-forced, as has been demonstrated more than ten years ago). Also, DES uses 64-bit blocks, which raises some potential issues when encrypting several gigabytes of data with the same key (a gigabyte is not that big nowadays).
  • 3DES is a trick to reuse DES implementations, by cascading three instances of DES (with distinct keys). 3DES is believed to be secure up to at least "2112" security (which is quite a lot, and quite far in the realm of "not breakable with today's technology"). But it is slow, especially in software (DES was designed for efficient hardware implementation, but it sucks in software; and 3DES sucks three times as much).

  • AES is the successor of DES as standard symmetric encryption algorithm for US federal organizations (and as standard for pretty much everybody else, too). AES accepts keys of 128, 192 or 256 bits (128 bits is already very unbreakable), uses 128-bit blocks (so no issue there), and is efficient in both software and hardware. It was selected through an open competition involving hundreds of cryptographers during several years. Basically, you cannot have better than that.

So, when in doubt, use AES.

Note that a block cipher is a box which encrypts "blocks" (128-bit chunks of data with AES). When encrypting a "message" which may be longer than 128 bits, the message must be split into blocks, and the actual way you do the split is called the mode of operation or "chaining". The naive mode (simple split) is called ECB and has issues. Using a block cipher properly is not easy, and it is more important than selecting between, e.g., AES or 3DES.

http://en.wikipedia.org/wiki/EFF_DES_cracker

http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation