Triple DES Algorithm in C
In the field of cryptography, Triple DES (3-DES) is a symmetric-key block cypher that encrypts each data block three times using the Data Encryption Standard (DES) encryption algorithm.
After 1990, users of DES started to feel uneasy about the speed of exhaustive key searches against DES. Users did not wish to replace DES, however, because it is very expensive and time-consuming to update widely used encryption algorithms that are built into complex security structures. Instead of fully giving up on the DES, the realistic approach called for changing how it is used. As a result, Triple DES' modified schemes were created (sometimes known as 3DES).
The 3-key Triple DES (3TDES) and the 2-key Triple DES are two different versions of Triple DES (2TDES). Although triple DES systems are visibly slower than single DES, they are noticeably more secure than single DES.
The following is the encryption-decryption process:
Given that Triple DES is designed to be an encrypt-decrypt-encrypt operation, single DES may be implemented using a 3TDES (hardware) implementation by setting K1, K2, and K3 to the same value. This allows for DES backwards compatibility.
The only difference between the 2TDES and the 3TDES is that K1 is used in place of K3, not K3. In other words, the user encrypts plaintext blocks using key K1, decrypts them using key K2, and then re-encrypts them using key K1. Consequently, the key size for 2TDES is 112 bits.
The file generated contain below cipher: 1101111001100110111011110011011111111100011101111001100110111011110011011111111100010001001100110100010101 .................................................. Process executed in 2.22 seconds Press any key to continue.
Explanation of Algorithm
Three DES keys, K1, K2, and K3, each measuring 56 bits, make up the "key bundle" used by triple DES (excluding parity bits). The algorithm for encryption is: