moved the historic tkch functions into enum versions
This commit is contained in:
parent
6e51e51a38
commit
54da223e23
@ -27,6 +27,15 @@ extern "C" {
|
|||||||
|
|
||||||
#include <why2/flags.h>
|
#include <why2/flags.h>
|
||||||
|
|
||||||
|
//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
|
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
|
char *why2_generate_key(int key_length); //GENERATE ENCRYPTION KEY
|
||||||
void why2_deallocate_output(why2_output_flags flags); //DEALLOCATES flags
|
void why2_deallocate_output(why2_output_flags flags); //DEALLOCATES flags
|
||||||
|
@ -54,134 +54,6 @@ int removeDirectory(char *path)
|
|||||||
return nftw(path, unlink_cb, 64, FTW_DEPTH | FTW_PHYS);
|
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
|
enum WHY2_EXIT_CODES why2_check_version(void) //! CRASHES WHEN CALLED FROM CHAT STUFF
|
||||||
{
|
{
|
||||||
if (why2_get_flags().no_check) return WHY2_SUCCESS;
|
if (why2_get_flags().no_check) return WHY2_SUCCESS;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user