From 54da223e235e1f261edf23afa4080ec10c76c734 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Wed, 24 Jan 2024 14:47:48 +0100 Subject: [PATCH] moved the historic tkch functions into enum versions --- include/misc.h | 9 +++ src/core/lib/utils/misc.c | 128 -------------------------------------- 2 files changed, 9 insertions(+), 128 deletions(-) diff --git a/include/misc.h b/include/misc.h index bbbd669..9aa311e 100644 --- a/include/misc.h +++ b/include/misc.h @@ -27,6 +27,15 @@ extern "C" { #include +//THESE ARE 'HISTORIC' VERSION FOR GENERATING tkch, SO YOU CAN DECRYPT OLD TEXT +enum WHY2_TEXT_KEY_CHAIN_VERSIONS +{ + WHY2_v1, //FIRST VERSION EVER. Replaced on May 25th 15:51:57 2022 UTC in commit 35959a43938edc835c59741aac8127bc132591d0. GOOD OLD TIMES. OR NOT. IT REMINDS ME OF HER. this shit hurts, man + WHY2_v2, //SECOND VERSION. Replaced on May 28th 17:45:26 2022 UTC in commit 0d64f4fa7c37f0b57914db902258e279a71c7f9a. + WHY2_v3, //THIRD VERSION. Replaced on July 11th 17:12:41 2022 UTC in commit 0f01cde0f1e1a9210f4eef7b949e6d247072d3a6. + WHY2_v4 //FOURTH VERSION. THE LATEST ONE +}; + void why2_generate_text_key_chain(char *key, int *textKeyChain, int textKeyChainSize); //GENERATES ARRAY FOR ENCRYPTION/DECRYPTION char *why2_generate_key(int key_length); //GENERATE ENCRYPTION KEY void why2_deallocate_output(why2_output_flags flags); //DEALLOCATES flags diff --git a/src/core/lib/utils/misc.c b/src/core/lib/utils/misc.c index a13d527..75a500d 100644 --- a/src/core/lib/utils/misc.c +++ b/src/core/lib/utils/misc.c @@ -54,134 +54,6 @@ int removeDirectory(char *path) return nftw(path, unlink_cb, 64, FTW_DEPTH | FTW_PHYS); } -//THESE old_gen_tkch_number FUNCTIONS ARE 'HISTORIC' FUNCTIONS, SO YOU CAN DECRYPT OLD TEXT -void generate_text_key_chain_first(char *key, int *text_key_chain, int text_key_chain_size) //FIRST VERSION EVER. Replaced on May 25th 15:51:57 2022 UTC in commit 35959a43938edc835c59741aac8127bc132591d0. GOOD OLD TIMES. OR NOT. IT REMINDS ME OF HER. this shit hurts, man -{ - int number_buffer; - int (*cb)(int, int); - - for (int i = 0; i < text_key_chain_size; i++) - { - number_buffer = i; - - //CHECK, IF number_buffer ISN'T GREATER THAN KEY_LENGTH AND CUT UNUSED LENGTH - while (number_buffer >= (int) why2_get_key_length()) - { - number_buffer -= why2_get_key_length(); - } - - //FILL text_key_chain - if ((number_buffer + 1) % 3 == 0) - { - cb = multiply_cb; - } else if ((number_buffer + 1) % 2 == 0) - { - cb = subtract_cb; - } else - { - cb = sum_cb; - } - - text_key_chain[i] = cb(key[number_buffer], key[number_buffer + 1]); - } -} - -void generate_text_key_chain_second(char *key, int *text_key_chain, int text_key_chain_size) //SECOND VERSION. Replaced on May 28th 17:45:26 2022 UTC in commit 0d64f4fa7c37f0b57914db902258e279a71c7f9a. -{ - int number_buffer; - int (*cb)(int, int); - - for (int i = 0; i < text_key_chain_size; i++) - { - number_buffer = i; - - //CHECK, IF number_buffer ISN'T GREATER THAN keyLength AND CUT UNUSED LENGTH - while (number_buffer >= (int) why2_get_key_length()) - { - number_buffer -= why2_get_key_length(); - } - - //FILL text_key_chain - if ((number_buffer + 1) % 3 == 0) - { - cb = multiply_cb; - } else if ((number_buffer + 1) % 2 == 0) - { - cb = subtract_cb; - } else - { - cb = sum_cb; - } - - text_key_chain[i] = cb(key[number_buffer], key[number_buffer + (i < text_key_chain_size)]); - } -} - -void generate_text_key_chain_third(char *key, int *text_key_chain, int text_key_chain_size) //THIRD VERSION. Replaced on July 11th 17:12:41 2022 UTC in commit 0f01cde0f1e1a9210f4eef7b949e6d247072d3a6. -{ - int number_buffer; - int (*cb)(int, int); - - for (int i = 0; i < text_key_chain_size; i++) - { - number_buffer = i; - - //CHECK, IF numberBuffer ISN'T GREATER THAN keyLength AND CUT UNUSED LENGTH - while (number_buffer >= (int) why2_get_key_length()) - { - number_buffer -= why2_get_key_length(); - } - - //FILL text_key_chain - if ((number_buffer + 1) % 3 == 0) - { - cb = multiply_cb; - } else if ((number_buffer + 1) % 2 == 0) - { - cb = subtract_cb; - } else - { - cb = sum_cb; - } - - text_key_chain[i] = cb(key[number_buffer], key[why2_get_key_length() - (number_buffer + (i < text_key_chain_size))]); - } -} - -void generate_text_key_chain_fourth(char *key, int *text_key_chain, int text_key_chain_size) //FOURTH VERSION. THE LATEST ONE -{ - int number_buffer; - int number_buffer_2; - int (*cb)(int, int); - - for (int i = 0; i < text_key_chain_size; i++) - { - number_buffer = i; - - //CHECK, IF numberBuffer ISN'T GREATER THAN keyLength AND CUT UNUSED LENGTH - while (number_buffer >= (int) why2_get_key_length()) - { - number_buffer -= why2_get_key_length(); - } - - number_buffer_2 = why2_get_key_length() - (number_buffer + (i < text_key_chain_size)); - - //FILL text_key_chain - if ((number_buffer + 1) % 3 == 0) - { - cb = multiply_cb; - } else if ((number_buffer + 1) % 2 == 0) - { - cb = subtract_cb; - } else - { - cb = sum_cb; - } - - text_key_chain[text_key_chain_size - (i + 1)] = cb(key[number_buffer], key[number_buffer_2]); - } -} - enum WHY2_EXIT_CODES why2_check_version(void) //! CRASHES WHEN CALLED FROM CHAT STUFF { if (why2_get_flags().no_check) return WHY2_SUCCESS;