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

This commit is contained in:
Václav Šmejkal 2025-01-09 18:45:44 +01:00
parent 806cdc62c6
commit 7fc146f745
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

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_2 = 0;
int number_buffer_3 = 0;
const unsigned long key_length = why2_get_key_length();
int (*cb)(int, int);
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:
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;
case WHY2_v3:
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;
case WHY2_v4:
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;
}