Data Encryption Standard

Data Encryption Standard (DES) 

A symmetric key block cipher that was widely used for securing electronic data. DES operates by encrypting 64-bit blocks of data using a 56-bit key, producing a corresponding 64-bit ciphertext block.DES follows the Feistel structure, which means it divides the data block into two halves and applies multiple rounds of substitution and permutation to increase security. Each round uses the key in a complex transformation process to scramble the data, making it difficult for unauthorized parties to recover the original plaintext without the correct key.

echo “test” > input.txt # Create a file named input.txt containing the text “test”

echo "test" > input.txt

openssl # an open-source cryptography toolkit
-e #encrypt
-des-ecb # use DES algorithm in ECB mode
-in input.txt #input plaintext file
-out encrypted.txt # output encrypted file
-K 0001020304050607 # explicit 64-bit DES key in hex
-provider legacy # required because DES is deprecated in OpenSSL 3+

openssl enc -e -des-ecb -in input.txt -out encrypted.txt -K 0001020304050607 -provider legacy

openssl # an open-source cryptography toolkit
-d # decrypt
-des-ecb # same algorithm and mode used for encryption
-in encrypted.txt # input ciphertext file
-out decrypted.txt # output decrypted file
-K 0001020304050607 # same key used for encryption
-nosalt # disables salt (needed because encryption used raw key)
-provider legacy # enables deprecated DES support

openssl enc -d -des-ecb -in encrypted.txt -out decrypted.txt -K '0001020304050607' -nosalt -provider legacy

cat decrypted.txt # Display the decrypted file contents

cat decrypted.txt