-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdh_crypt.h
31 lines (26 loc) · 1.17 KB
/
dh_crypt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef DH_CRYPT_H
#define DH_CRYPT_H
#define BLOCK_SIZE 16 // Block size for Cbc algorithm
typedef unsigned char byte; // Byte
typedef byte block_t[BLOCK_SIZE]; // Cbc block
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdbool.h>
// Xor program
void xor(char plaintext_filename[], char cipher_filename[], char key[]);
// Functions used for cipher and decipher Cbc algorithm
int blocks_nb(FILE *filemsg);
void block_add(block_t block, FILE *filemsg);
// Cipher Cbc program
void plaintext_recover(FILE *plaintext_filename, block_t plaintext);
void encryption_block(block_t plaintext, block_t init_vec, char key[], int key_size);
void cbc_crypt(char plaintext_filename[], char cipher_filename[], char key[], char init_vec[]);
// Decipher Cbc program
void ciphertext_recover(FILE *cipher_filemsg, block_t ciphertext);
void decryption_block(block_t ciphertext, block_t init_vec, char key[], int key_size);
int last_byte_ind(block_t ciphertext);
void last_block_add(block_t ciphertext, FILE *decipher_filemsg);
void cbc_uncrypt(char cipher_filename[], char decipher_filename[], char key[], char init_vec[]);
#endif