31 #include "DES_config.h"
36 #define tdea_enc tdes_enc
37 #define tdea_dec tdes_dec
54 void encrypt(
void* out,
const void* in,
const void*
key);
68 void decrypt(
void* out,
const void* in,
const uint8_t* key);
113 void init(
const void* m_key,
unsigned long long int IVCl);
122 void init(
const void* m_key);
140 void set_IV(
unsigned long long int IVCl);
255 void printArray(byte output[],
bool p_pad =
true);
275 void do_3des_encrypt(byte *plain,
int size_p,byte *cipher,
const void *key,
bool inc =
false);
286 void do_3des_decrypt(byte *cipher,
int size_c,byte *plain,
const void *key,
unsigned long long int ivl);
287 #if defined(DES_LINUX)
303 void permute(
const uint8_t *ptable,
const uint8_t *in, uint8_t *out);
338 inline uint8_t
substitute(uint8_t a, uint8_t * sbp);
348 uint32_t
des_f(uint32_t r, uint8_t* kr);
350 unsigned long long int IVC;
354 #if defined(DES_LINUX)
byte iv[8]
Definition: DES.h:351
void changeendian32(uint32_t *a)
Definition: DES.cpp:252
int get_size()
getter method for size
Definition: DES.cpp:425
void calc_size_n_pad(int p_size)
calculates the size of the plaintext and the padding
Definition: DES.cpp:438
unsigned long long int IVC
Definition: DES.h:350
void shiftkey(uint8_t *key)
Definition: DES.cpp:261
unsigned long long int get_IV_int()
Definition: DES.cpp:226
void tripleEncrypt(void *out, void *in, const void *key)
encrypt a block with Tripple-DES
Definition: DES.cpp:397
DES()
DES constructor.
Definition: DES.cpp:176
uint32_t des_f(uint32_t r, uint8_t *kr)
Definition: DES.cpp:298
void get_IV(byte *out)
Definition: DES.cpp:220
void set_size(int sizel)
Definition: DES.cpp:431
void shiftkey_inv(uint8_t *key)
Definition: DES.cpp:269
void do_3des_encrypt(byte *plain, int size_p, byte *cipher, const void *key, bool inc=false)
Definition: DES.cpp:568
void encrypt(void *out, const void *in, const void *key)
decrypt a block with DES
Definition: DES.cpp:326
int size
Definition: DES.h:353
void tdesCbcEncipher(byte *in, byte *out)
the main encrypt 3DES with IV function
Definition: DES.cpp:475
int pad
Definition: DES.h:352
byte arr_pad[7]
Definition: DES.h:358
uint64_t splitin6bitwords(uint64_t a)
Definition: DES.cpp:278
void printArray(byte output[], bool p_pad=true)
Definition: DES.cpp:540
void set_IV(unsigned long long int IVCl)
Definition: DES.cpp:213
bool CheckPad(byte *in, int size)
check the if the padding is correct
Definition: DES.cpp:460
void tripleDecrypt(void *out, void *in, const uint8_t *key)
decrypt a block with Tripple-DES
Definition: DES.cpp:405
void init(const void *m_key, unsigned long long int IVCl)
initiallize the key and IVC and IV array
Definition: DES.cpp:192
byte key[24]
Definition: DES.h:349
void permute(const uint8_t *ptable, const uint8_t *in, uint8_t *out)
Definition: DES.cpp:232
void padPlaintext(void *in, byte *out)
pads the plaintext
Definition: DES.cpp:450
void do_3des_decrypt(byte *cipher, int size_c, byte *plain, const void *key, unsigned long long int ivl)
Definition: DES.cpp:581
void iv_inc()
Definition: DES.cpp:413
uint8_t substitute(uint8_t a, uint8_t *sbp)
Definition: DES.cpp:288
double millis()
Definition: DES.cpp:591
void change_key(const void *m_key)
change the key for DEs and 3DES
Definition: DES.cpp:206
byte * get_key()
getter method for key
Definition: DES.cpp:419
timeval tv
Definition: DES.h:355
void decrypt(void *out, const void *in, const uint8_t *key)
encrypt a block with DES
Definition: DES.cpp:362
void tdesCbcDecipher(byte *in, byte *out)
the main decrypt 3DES with IV function
Definition: DES.cpp:508