diff --git a/Makefile b/Makefile index a86531ac..a9e819a4 100644 --- a/Makefile +++ b/Makefile @@ -126,6 +126,7 @@ DES_SRC = ft_des_initial_permutation.c \ ft_des_process_block.c \ ft_des_generate_encryption_round_keys.c \ ft_des_generate_decryption_round_keys.c \ + ft_des_ecb.c SRC = main.c \ ft_ssl_usage.c diff --git a/inc/ft_des.h b/inc/ft_des.h index 778fb00e..c233a812 100644 --- a/inc/ft_des.h +++ b/inc/ft_des.h @@ -26,6 +26,17 @@ typedef unsigned char t_byte1; +typedef struct s_des_ctx +{ + int input_fd; + int output_fd; + int decode; + int output_in_base64; + char *key; + char *init_vector; + char *pass; +} t_des_ctx; + void ft_des_initial_permutation ( t_byte1 message[FT_DES_BIT_BLOCK_SIZE], @@ -176,4 +187,10 @@ void ft_des_process_block t_byte1 ciphertext[FT_DES_BIT_BLOCK_SIZE] ); +void ft_des_ecb +( + int argc, + char **argv +); + #endif diff --git a/inc/ft_ssl.h b/inc/ft_ssl.h index 6cead32d..e337e72b 100644 --- a/inc/ft_ssl.h +++ b/inc/ft_ssl.h @@ -13,71 +13,15 @@ #ifndef FT_SSL_H # define FT_SSL_H -# include - -# define FT_SSL_ALGS_COUNT 3 -# define FT_SSL_BUFFER_SIZE 1024 - -typedef struct s_ft_ssl t_ft_ssl; - -typedef void (*t_process_stdin)(t_ft_ssl *ft_ssl); -typedef void (*t_process_string)(const char *string, - t_ft_ssl *ft_ssl); -typedef void (*t_process_file)(const char *filename, - t_ft_ssl *ft_ssl); - typedef void (*t_alg_function)(int argc, char **argv); -typedef struct s_flags -{ - int quiet; - int reverse; - int print_stdin; - int something_printed; -} t_flags; - typedef struct s_alorithm { const char *name; t_alg_function function; } t_algorithm; -struct s_ft_ssl -{ - t_flags flags; - t_process_stdin process_stdin; - t_process_file process_file; - t_process_string process_string; -}; - void ft_ssl_usage(void); void ft_ssl_init(int argc, char **argv); -void ft_ssl_md5_stdin(t_ft_ssl *ft_ssl); -void ft_ssl_md5_string(const char *strng, - t_ft_ssl *ft_ssl); -void ft_ssl_md5_file(const char *filename, - t_ft_ssl *ft_ssl); -void ft_ssl_md5_print(const char *target, - unsigned char *digest, - t_ft_ssl *ft_ssl); - -void ft_ssl_sha256_stdin(t_ft_ssl *ft_ssl); -void ft_ssl_sha256_string(const char *strng, - t_ft_ssl *ft_ssl); -void ft_ssl_sha256_file(const char *filename, - t_ft_ssl *ft_ssl); -void ft_ssl_sha224_print(const char *target, - unsigned char *digest, - t_ft_ssl *ft_ssl); - -void ft_ssl_sha224_stdin(t_ft_ssl *ft_ssl); -void ft_ssl_sha224_string(const char *strng, - t_ft_ssl *ft_ssl); -void ft_ssl_sha224_file(const char *filename, - t_ft_ssl *ft_ssl); -void ft_ssl_sha256_print(const char *target, - unsigned char *digest, - t_ft_ssl *ft_ssl); - #endif diff --git a/src/des/ft_des_ecb.c b/src/des/ft_des_ecb.c new file mode 100644 index 00000000..6f9618b4 --- /dev/null +++ b/src/des/ft_des_ecb.c @@ -0,0 +1,13 @@ +#include +#include "ft_des.h" + +void ft_des_ecb +( + int argc, + char **argv +) +{ + (void)argc; + (void)argv; + exit(0); +} \ No newline at end of file diff --git a/src/main.c b/src/main.c index 7a7ebf17..2616318e 100644 --- a/src/main.c +++ b/src/main.c @@ -14,6 +14,7 @@ #include "ft_md5.h" #include "ft_sha.h" #include "ft_base64.h" +#include "ft_des.h" #include "libft.h" t_algorithm g_algorithms[] = { @@ -33,6 +34,10 @@ t_algorithm g_algorithms[] = { "base64", ft_base64, }, + { + "des-ecb", + ft_des_ecb, + }, {NULL, NULL} };