created more secure tkch WHY_v4
good luck with brute forcing now haha
This commit is contained in:
parent
7790d194cb
commit
f917140ae5
@ -39,7 +39,8 @@ enum WHY2_TEXT_KEY_CHAIN_VERSIONS
|
||||
{
|
||||
WHY2_v1, //FIRST VERSION. Replaced on May 28th 17:45:26 2022 UTC in commit 0d64f4fa7c37f0b57914db902258e279a71c7f9a.
|
||||
WHY2_v2, //SECOND VERSION. Replaced on July 11th 17:12:41 2022 UTC in commit 0f01cde0f1e1a9210f4eef7b949e6d247072d3a6.
|
||||
WHY2_v3 //THIRD VERSION. THE LATEST ONE
|
||||
WHY2_v3, //THIRD VERSION. <i forgor to add the time>
|
||||
WHY2_v4
|
||||
};
|
||||
|
||||
enum WHY2_OUTPUT_FORMAT
|
||||
|
@ -23,7 +23,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
int main(void)
|
||||
{
|
||||
//SET FLAGS
|
||||
why2_set_flags((why2_input_flags) { 1, 1, 0, WHY2_v3, WHY2_OUTPUT_TEXT });
|
||||
why2_set_flags((why2_input_flags) { 1, 1, 0, WHY2_v4, WHY2_OUTPUT_TEXT });
|
||||
|
||||
//RUN ENCRYPTION WITH WHY2_TEXT_TO_ENCRYPT, GENERATE NEW KEY AND DO NOT CHECK FOR ACTIVE WHY2_VERSION & PREVENT ANY OUTPUT
|
||||
why2_output_flags encryptedText = why2_encrypt_text(WHY2_TEXT_TO_ENCRYPT, NULL);
|
||||
|
@ -25,7 +25,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#include <why2/memory.h>
|
||||
|
||||
//CONSTS (this is just local)
|
||||
#define DEFAULT_FLAGS (why2_input_flags) { 0, 0, 0, WHY2_v3, WHY2_OUTPUT_TEXT }
|
||||
#define DEFAULT_FLAGS (why2_input_flags) { 0, 0, 0, WHY2_v4, WHY2_OUTPUT_TEXT }
|
||||
#define DEFAULT_MEMORY_IDENTIFIER ""
|
||||
|
||||
int encryptionOperation(int text, int encryptedText);
|
||||
|
@ -44,7 +44,7 @@ int main(void)
|
||||
0, //SKIP CHECK
|
||||
0, //NO OUTPUT
|
||||
0, //UPDATE
|
||||
WHY2_v3, //LATEST VERSION
|
||||
WHY2_v4, //LATEST VERSION
|
||||
WHY2_OUTPUT_TEXT //READABLE TEXT OUTPUT
|
||||
};
|
||||
|
||||
|
@ -34,6 +34,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#include <why2/flags.h>
|
||||
#include <why2/memory.h>
|
||||
|
||||
int mod_cb(int a, int b) { return a % b; }
|
||||
int multiply_cb(int a, int b) { return a * b; }
|
||||
int subtract_cb(int a, int b) { return a - b; }
|
||||
int sum_cb(int a, int b) { return a + b; }
|
||||
@ -302,18 +303,24 @@ void why2_generate_text_key_chain(char *key, int *text_key_chain, int text_key_c
|
||||
number_buffer_2 = text_key_chain_size - (i + 1);
|
||||
number_buffer_3 = why2_get_key_length() - (number_buffer + (i < text_key_chain_size));
|
||||
break;
|
||||
|
||||
case WHY2_v4:
|
||||
number_buffer_2 = text_key_chain_size - (i + 1);
|
||||
number_buffer_3 = (why2_get_key_length() ^ text_key_chain_size) >> (number_buffer & (i < text_key_chain_size)); //gl fucker
|
||||
break;
|
||||
}
|
||||
|
||||
//FILL textKeyChain
|
||||
if ((number_buffer + 1) % 3 == 0)
|
||||
if (why2_get_flags().version == WHY2_v4 && (number_buffer + 1) % 4 == 0)
|
||||
{
|
||||
cb = mod_cb;
|
||||
} else if ((number_buffer + 1) % 3 == 0)
|
||||
{
|
||||
cb = multiply_cb;
|
||||
}
|
||||
else if ((number_buffer + 1) % 2 == 0)
|
||||
} else if ((number_buffer + 1) % 2 == 0)
|
||||
{
|
||||
cb = subtract_cb;
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
cb = sum_cb;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ int main(void)
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
WHY2_v3,
|
||||
WHY2_v4,
|
||||
WHY2_OUTPUT_TEXT
|
||||
}
|
||||
);
|
||||
|
@ -132,7 +132,7 @@ void why2_write_log(int loggerFile, char *logMessage)
|
||||
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_v3, WHY2_OUTPUT_TEXT });
|
||||
if (!why2_get_flags_changed()) why2_set_flags((why2_input_flags) { 0, 1, 0, WHY2_v4, WHY2_OUTPUT_TEXT });
|
||||
|
||||
if (flags.key != NULL) //ENCRYPT TEXT IF KEY WAS CHANGED
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user