3DES Implementation


DO NOT roll your own Crypto! Use standard services and libraries.

It is NOT advisable in any circumstances to develop any sort of cryptography on your own. Instead, there are a few options for standard libraries that can be used. These libraries offer better stability as they are usually a product of several years of experience in implementing cryptography by an active development community who are dedicated towards efforts in implementation. It is therefore considered to be reliable and robust.


OpenSSL is one such library which popular and therefore is used as an example for this concept. OpenSSL is not the only available crypto library. For a list of different libraries and a comparision between them, visit here.

Find out which openssl version you are using:

Use the version option.

  • $ openssl version
    OpenSSL 1.0.1e-fips 11 Feb 2013

You can get much more information with the version -a option.

  • $ openssl version -a
    OpenSSL 1.0.1e-fips 11 Feb 2013
    built on: Thu Jul 23 19:06:35 UTC 2015
    platform: linux-x86_64
    options:  bn(64,64) md2(int) rc4(16x,int) des(idx,cisc,16,int)
              idea(int) blowfish(idx)
    -Wall -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
    -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic
    OPENSSLDIR: "/etc/pki/tls"
    engines:  rdrand dynamic

Please note that OpenSSL 1.0.2k has removed 3DES support. There are still ways you can re-enable 3DES (Re-enable 3DES), but considering the security implications, this should be done only if absolutely necessary.

Usage of Cryptography in Programming Languages


It is again advised to not roll out your own cryptography while developing software. There are popular libraries in almost all programming languages that can readily be used to perform cryptographic operations.



There are multiple options for libraries that support 3DES in C/C++.

Using OpenSSL: http://www.firmcodes.com/triple-des-cbc-mode-encryption-example-c-programming-openssl/
Using Crypto++ Library:https://www.cryptopp.com/wiki/TripleDES