An open API service indexing awesome lists of open source software.

https://github.com/onyazuka/desu

DES encryption + Triple DES + Multithread version
https://github.com/onyazuka/desu

cpp cryptography des fast

Last synced: 5 months ago
JSON representation

DES encryption + Triple DES + Multithread version

Awesome Lists containing this project

README

          

# DESu DES
DES encryption + Triple DES + Multithread version

Overview


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.

MSVC compilation



  1. Download repository

  2. Run DES.sln

  3. Press Ctrl+F5

  4. Enjoy

Usage

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

Modes


-g
key file generation


-e
encryptiont mode


-d
decryption mode

Settings


-3 eee3
Triple DES (DES-EEE3)


-3 ede3
Triple DES (DES-EDE3)


-mt
Multithread mode

Examples

Example: using command-line utility for encrypting

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

Example: encrypt raw block of data

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

Example: decrypt raw block of 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

Example: encrypring file


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();