Search code examples
c++cryptographydescrypto++

Crypto++ DES implementation and the key length


I've been looking for a crypto library for C++ for a while, and finally came across Crypto++. The library seemed OK until I tried to use 3DES. The problem is that the key length for DES algorithm implemented in this library is 64 bits (instead of usual 56 bits). I spent some time searching for explanation and all I finally got was a couple of words from the Crypto++ documentation:

The DES implementation in Crypto++ ignores the parity bits (the least significant bits of each byte) in the key.

Does this mean that if I have a usual 56-bit key and want to decrypt some data with this library I have to "expand" my key by inserting a meaningless extra bit after every 7 bits of my key data? Or is there another way to use 56-bit keys with this wonderful library?


Solution

  • A usual DES key is 8-bytes, it is just that the lsb (least significant bit), the parity bit, is ignored in almost all current implementations DES.

    But that begs the question wether DES and/or 3DES (with 112-bit and/or 168-bit keys) should be used. The answer for DES: no, for 3DES: only for legacy compatibility. Both of these have been superseded by AES.