From e4c5feedb4b6e55a74b2d936bd7a748cb45ecd80 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Sun, 16 Oct 2022 19:46:56 +0200 Subject: [PATCH] implemented encryptedTextKeyChain function in encrypter & decrypter you can now change the encryption operation in one function --- src/lib/decrypter.c | 2 +- src/lib/encrypter.c | 2 +- src/lib/flags.c | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/decrypter.c b/src/lib/decrypter.c index 96fc09a..3b5990f 100644 --- a/src/lib/decrypter.c +++ b/src/lib/decrypter.c @@ -109,7 +109,7 @@ outputFlags decryptText(char *text, char *keyNew) //DECRYPT TEXT for (int i = 0; i < textKeyChainLength; i++) { - textKeyChain[i] -= encryptedTextKeyChain[i]; + textKeyChain[i] = encryptionOperation(textKeyChain[i], encryptedTextKeyChain[i]); } //FIX (CLEAN) returningText diff --git a/src/lib/encrypter.c b/src/lib/encrypter.c index f1289c9..f28a00f 100644 --- a/src/lib/encrypter.c +++ b/src/lib/encrypter.c @@ -90,7 +90,7 @@ outputFlags encryptText(char *text, char *keyNew) //ACTUALLY ENCRYPT TEXT 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 diff --git a/src/lib/flags.c b/src/lib/flags.c index beeb2cf..7dd6ba1 100644 --- a/src/lib/flags.c +++ b/src/lib/flags.c @@ -71,4 +71,6 @@ int encryptionOperation(int text, int encryptedText) { //CHANGE THE '-' (MINUS) OPERATOR TO SOMETHING YOU WANT TO USE I GUESS return text - encryptedText; + + //I DO NOT RECOMMEND CHANGING THIS, BUT IF YOU WANT TO, XOR IS A GOOD OPERATOR (IDK IF OTHERS WORK lmao) } \ No newline at end of file