From 5a88fbf045e2634bef71fa5f4d5c4413924d45f0 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Wed, 24 Jan 2024 14:27:58 +0100 Subject: [PATCH] created third old_gen_tkch function --- src/core/lib/utils/misc.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/core/lib/utils/misc.c b/src/core/lib/utils/misc.c index b71f1c2..3d66eba 100644 --- a/src/core/lib/utils/misc.c +++ b/src/core/lib/utils/misc.c @@ -55,7 +55,7 @@ int removeDirectory(char *path) } //THESE old_gen_tkch_number FUNCTIONS ARE 'HISTORIC' FUNCTIONS, SO YOU CAN DECRYPT OLD TEXT -void old_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. GOOD OLD TIMES. OR NOT. IT REMINDS ME OF HER. this shit hurts, man +void old_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); @@ -86,7 +86,7 @@ void old_generate_text_key_chain_first(char *key, int *text_key_chain, int text_ } } -void old_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. +void old_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); @@ -117,6 +117,37 @@ void old_generate_text_key_chain_second(char *key, int *text_key_chain, int text } } +void old_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[getKeyLength() - (number_buffer + (i < text_key_chain_size))]); + } +} + enum WHY2_EXIT_CODES why2_check_version(void) //! CRASHES WHEN CALLED FROM CHAT STUFF { if (why2_get_flags().no_check) return WHY2_SUCCESS;