DES encryption + Triple DES + Multithread version
C++ implementation of DES - Data Encryption Standart algorithm.Supports Triple DES, also can use some of your cores.
Tested and optimized for msvc 2017 and gcc.
- Download repository
- Run DES.sln
- Press Ctrl+F5
- Enjoy
Usage: DES mode [settings] keys_file input_file output_file
Key file generation for DES: DES -g 1 keyfile_name
Key file generation for Triple-DES: DES -g 3 keyfile_name
| -g | key file generation |
| -e | encryptiont mode |
| -d | decryption mode |
| -3 eee3 | Triple DES (DES-EEE3) |
| -3 ede3 | Triple DES (DES-EDE3) |
| -mt | Multithread mode |
Generating key file
DES -g 1 keys.key
Encrypting file
DES -e keys.key input.bin input.enc
Decrypting file
DES -d keys.key input.enc input_decrypted.bin
Encrypting Triple DES EEE3
DES -e -3 eee3 keys.key input.bin input.enc
Using multithreading
DES -e -3 eee3 -mt keys.key input.bin input.enc
Here we are just using DESEncrypter class from DES.h
#include "DES.h"
uint64_t data = //...your data;
uint64_t key = //...your key;
DESEncrypter encr{ data, key, DESEncrypter::Mode::ENCRYPT };
uint64_t output = encr.run(); //your encrypted data
#include "DES.h"
uint64_t data = //...your data;
uint64_t key = //...your key;
DESEncrypter encr{ data, key, DESEncrypter::Mode::DECRYPT };
uint64_t output = encr.run(); //your encrypted data
Here you should initialize instance of File_Crypter from DESFileCrypt.h
#include "DESFileCrypt.h"
fc = File_Crypter{};
fc.ifname = "/foo/bar" // file you want to encrypt
fc.kname = "/foo/keys" // file
fc.ofname = "/foo/output" // output file
fc.read_keys(); // reads keys from keyfile and populates fc object with it
fc.mode = fc.Encrypt; // fc.Encrypt or fc.Decrypt
fc.triple_des = true; // if you want Triple_DES
fc.set_triple_des_mode(fc.EEE3); // if you want Triple_DES
fc.multithread = true; // if you want multithread
fc.run();