DES (Data Encryption Standard)

The DES is a symmetric-key algorithm for the encryption of digital data.

- https://en.wikipedia.org/wiki/Data_Encryption_Standard
- https://en.wikipedia.org/wiki/Triple_DES

Basic Encryption/Decription with OpenSSL

1. Prepare Plain Text File

At first, we create a text file which contains a simple word "hello".

echo hello > hello.txt

2. Encrypt the Plain Text File

Using openssl, we can encrypt the file using DES algorithm. We're asked the password so enter the new one.

openssl des -e -in hello.txt -out encrypted.enc

After encryption, we can send the encrypted file to someone else. And someone can decrypt it with the DES algorithm.

3. Decrypt the Encrypted File

In the decryption process, we can also use the almost same command but specify -d (decrypt) option instead of -e (encrypt). We'll be asked the password which is set when encryption so enter the same password.

openssl des -d -in encrypted.enc -out decrypted.txt

After decryption, confirm that the content of the decrypted.txt is the same as that of the original plain hello.txt.

cat decrypted.txt
# hello


Triple DES

Triple DES (3DES) applies the DES cipher algorithm three times to each data block.
This encryption/description process with openssl is almost the same as that of DES so I'll write it briefly here

# Encryption
openssl des -e -in hello.txt -out encrypted.enc

# Decryption
openssl des -d -in encrypted.enc -out decrypted.txt