diff --git a/src/logger/lib/logger.c b/src/logger/lib/logger.c index ce19e35..5b6659c 100644 --- a/src/logger/lib/logger.c +++ b/src/logger/lib/logger.c @@ -29,7 +29,9 @@ along with this program. If not, see . #include #include +#include #include +#include #include #include @@ -94,6 +96,9 @@ why2_log_file why2_init_logger(char *directoryPath) } } + //SET ENCRYPTER FLAGS + if (!why2_get_flags_changed()) __why2_set_flags_anon((why2_input_flags) { 0, 1, 0, WHY2_v4, WHY2_OUTPUT_TEXT, 64 }); + //DEALLOCATION why2_deallocate(dateBuffer); why2_deallocate(latestBuffer); @@ -131,8 +136,7 @@ void why2_write_log(int loggerFile, char *logMessage) struct tm tm = *localtime(&timeL); why2_log_flags flags = why2_get_log_flags(); - //SET ENCRYPTER FLAGS - if (!why2_get_flags_changed()) why2_set_flags((why2_input_flags) { 0, 1, 0, WHY2_v4, WHY2_OUTPUT_TEXT, 63 }); + if (!why2_get_padding_changed()) __why2_set_padding_anon(WHY2_RECOMMENDED_PADDING_RATE(strlen(logMessageUsed))); if (flags.key != NULL) //ENCRYPT TEXT IF KEY WAS CHANGED { diff --git a/src/logger/lib/utils.c b/src/logger/lib/utils.c index a7bbb18..3ecf5a1 100644 --- a/src/logger/lib/utils.c +++ b/src/logger/lib/utils.c @@ -107,6 +107,17 @@ why2_decrypted_output why2_decrypt_logger(why2_log_file logger) for (int i = 0; i < lines; i++) //DECRYPT content { + if (!why2_get_padding_changed()) + { + printf("A\n"); + unsigned long length_buffer = 1; + for (unsigned long j = 0; j < strlen(content[i]); j++) + { + if (content[i][j] == why2_get_encryption_separator()) length_buffer++; + } + __why2_set_padding_anon(length_buffer / 4); + } + outputBuffer = why2_decrypt_text(content[i], why2_get_log_flags().key); //DECRYPT contentDecrypted[i] = why2_strdup(outputBuffer.output_text); //COPY