implemented encryptedTextKeyChain function in encrypter & decrypter

you can now change the encryption operation in one function
This commit is contained in:
Václav Šmejkal 2022-10-16 19:46:56 +02:00
parent 178df23585
commit e4c5feedb4
No known key found for this signature in database
GPG Key ID: FD749A97DF2D5E19
3 changed files with 4 additions and 2 deletions

View File

@ -109,7 +109,7 @@ outputFlags decryptText(char *text, char *keyNew)
//DECRYPT TEXT //DECRYPT TEXT
for (int i = 0; i < textKeyChainLength; i++) for (int i = 0; i < textKeyChainLength; i++)
{ {
textKeyChain[i] -= encryptedTextKeyChain[i]; textKeyChain[i] = encryptionOperation(textKeyChain[i], encryptedTextKeyChain[i]);
} }
//FIX (CLEAN) returningText //FIX (CLEAN) returningText

View File

@ -90,7 +90,7 @@ outputFlags encryptText(char *text, char *keyNew)
//ACTUALLY ENCRYPT TEXT //ACTUALLY ENCRYPT TEXT
for (int i = 0; i < (int) strlen(text); i++) for (int i = 0; i < (int) strlen(text); i++)
{ {
textKeyChain[i] -= (int) text[i]; textKeyChain[i] = encryptionOperation(textKeyChain[i], (int) text[i]);
} }
//COUNT REQUIRED SIZE FOR returningText //COUNT REQUIRED SIZE FOR returningText

View File

@ -71,4 +71,6 @@ int encryptionOperation(int text, int encryptedText)
{ {
//CHANGE THE '-' (MINUS) OPERATOR TO SOMETHING YOU WANT TO USE I GUESS //CHANGE THE '-' (MINUS) OPERATOR TO SOMETHING YOU WANT TO USE I GUESS
return text - encryptedText; return text - encryptedText;
//I DO NOT RECOMMEND CHANGING THIS, BUT IF YOU WANT TO, XOR IS A GOOD OPERATOR (IDK IF OTHERS WORK lmao)
} }