Compare commits

..

3 Commits

Author SHA1 Message Date
7fc146f745
improved performance of tkch-gen a bit
Some checks failed
Codacy Scan / Codacy Security Scan (push) Failing after 2m57s
Test Project / test-project (./configure.sh, gdb -ex "run" -ex "quit" --batch, ubuntu-latest, ./test) (push) Successful in 2m55s
Build WHY2-chat / test-why2 (./out/why2-chat-client, ./configure.sh, ubuntu-latest, ./out/why2-chat-server) (push) Failing after 3m2s
Test WHY2-core / test-why2 (why2, ./configure.sh, gdb -ex "run" -ex "quit" --batch, ubuntu-latest, ./out/why2-core-test, valgrind --leak-check=full --show-leak-kinds=reachable --track-origins=yes -s) (push) Successful in 3m26s
Test WHY2-logger / test-why2 (why2-logger, ./configure.sh, gdb -ex "run" -ex "quit" --batch, ubuntu-latest, ./out/why2-logger-test, valgrind --leak-check=full --show-leak-kinds=reachable --track-origins=yes -s) (push) Has been cancelled
2025-01-09 18:45:44 +01:00
806cdc62c6
using padding in logger app 2025-01-09 18:42:31 +01:00
d6658a8e4f
removed padding error todo 2025-01-09 18:39:57 +01:00
3 changed files with 6 additions and 5 deletions

View File

@ -81,7 +81,7 @@ why2_output_flags why2_encrypt_text(char *text, char *key)
} }
//PADDING //PADDING
if (why2_get_flags().padding > 0) //TODO! this breaks when used with long strings or byte input if (why2_get_flags().padding > 0)
{ {
why2_list_t split_text = WHY2_LIST_EMPTY; //LIST OF text SPLIT INTO CHARS why2_list_t split_text = WHY2_LIST_EMPTY; //LIST OF text SPLIT INTO CHARS

View File

@ -289,6 +289,7 @@ void why2_generate_text_key_chain(char *key, int *text_key_chain, int text_key_c
int number_buffer; int number_buffer;
int number_buffer_2 = 0; int number_buffer_2 = 0;
int number_buffer_3 = 0; int number_buffer_3 = 0;
const unsigned long key_length = why2_get_key_length();
int (*cb)(int, int); int (*cb)(int, int);
for (int i = 0; i < text_key_chain_size; i++) for (int i = 0; i < text_key_chain_size; i++)
@ -306,17 +307,17 @@ void why2_generate_text_key_chain(char *key, int *text_key_chain, int text_key_c
case WHY2_v2: case WHY2_v2:
number_buffer_2 = i; number_buffer_2 = i;
number_buffer_3 = why2_get_key_length() - (number_buffer + (i < text_key_chain_size)); number_buffer_3 = key_length - (number_buffer + (i < text_key_chain_size));
break; break;
case WHY2_v3: case WHY2_v3:
number_buffer_2 = text_key_chain_size - (i + 1); number_buffer_2 = text_key_chain_size - (i + 1);
number_buffer_3 = why2_get_key_length() - (number_buffer + (i < text_key_chain_size)); number_buffer_3 = key_length - (number_buffer + (i < text_key_chain_size));
break; break;
case WHY2_v4: case WHY2_v4:
number_buffer_2 = text_key_chain_size - (i + 1); number_buffer_2 = text_key_chain_size - (i + 1);
number_buffer_3 = ((((((i ^ number_buffer_2) + ((number_buffer << 3) ^ (number_buffer_2 & 0xF))) * (text_key_chain_size ^ (why2_get_key_length() >> 2))) ^ ((~(number_buffer + text_key_chain_size)) & 0xA7)) + (i % 7)) * (((number_buffer_2 | (i & 0xF)) + (why2_get_key_length() >> 3)) ^ (text_key_chain_size * (number_buffer & 0x3F))) + (((i << 4) ^ (text_key_chain_size >> 1)) & 0x1234) - ((i * number_buffer_2) % (why2_get_key_length() | text_key_chain_size))) % why2_get_key_length(); //gl fucker number_buffer_3 = ((((((i ^ number_buffer_2) + ((number_buffer << 3) ^ (number_buffer_2 & 0xF))) * (text_key_chain_size ^ (key_length >> 2))) ^ ((~(number_buffer + text_key_chain_size)) & 0xA7)) + (i % 7)) * (((number_buffer_2 | (i & 0xF)) + (key_length >> 3)) ^ (text_key_chain_size * (number_buffer & 0x3F))) + (((i << 4) ^ (text_key_chain_size >> 1)) & 0x1234) - ((i * number_buffer_2) % (key_length | text_key_chain_size))) % key_length; //gl fucker
break; break;
} }

View File

@ -18,7 +18,7 @@ int main(void)
0, 0,
WHY2_v4, WHY2_v4,
WHY2_OUTPUT_TEXT, WHY2_OUTPUT_TEXT,
0 WHY2_RECOMMENDED_PADDING_RATE(strlen(WHY2_LOGGER_TEST_TEXT))
} }
); );