From 0262a9fdd7b2b661f33381a11e367f8c0e327c04 Mon Sep 17 00:00:00 2001 From: AfonsoCMSousa Date: Fri, 28 Feb 2025 19:08:55 +0000 Subject: [PATCH] Better encryption method. --- KeyMaster | Bin 34552 -> 34552 bytes bin/KeyMaster | Bin 34552 -> 34552 bytes include/dynmem.c | 9 ++++++--- include/dynmem.h | 2 +- src/main.c | 10 +++++++--- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/KeyMaster b/KeyMaster index a710a6b86a7b22f088520a7b1a02e12f496b0429..047f1bc463d6432d9ab2bdff28f53b4273732de5 100755 GIT binary patch delta 509 zcmey-%k-m{X~G4;2|5f6j0_A6_xOMW5KP$ka6Xej>YntijZ5sAR+PRwNL)@w<-cn@aSeeECiw~Ji0@F zc=VdC1ghA;@Inqqy>tdD=&pU@(OvohDEs0?J5bQ0)Afc&bL|bFei?}VW)%I65dHUf z!CGIO0@5DMM+{;QhkA5Ao%}^t!YT-?&GmyvvhN%IeIgtl-L5}C>`svm7_(cXqw&*! zpgL5s$ufEpLJR-@{~voeEiFxtU%myXgn?o52VEH#OCSTN9c*ehOUF(oAb;lfpPjBR zx?NwGg3RhT1T(%vgrnQ_P4fZ9PS-atcY)30mv>=c*gQdRFB7BvWIx06jQx}4jKrC) z|C(%Ww25)?U=1q2NQsK?6NV1eycg!w-zf4U;!E*~6o?1S%@9 QnX&l*6Jy@yL#<|v0Lu=vZvX%Q delta 450 zcmey-%k-m{X~G4;3pxx8j0_A6^Z0-S5M0>!a6Xg3O4X*T#apcT8g{WqXYUh9Ts(nU zbFu@A!{iA%vW)vDuhUUyTs--jjuNBA$Y(fM@p7F`Jw4X`%X4<5F9QS(|mxj)Ah~E)Bpefk3F2mFYm&@FnNQnjJO_>#%`95olHRf%p9 diff --git a/bin/KeyMaster b/bin/KeyMaster index a710a6b86a7b22f088520a7b1a02e12f496b0429..047f1bc463d6432d9ab2bdff28f53b4273732de5 100755 GIT binary patch delta 509 zcmey-%k-m{X~G4;2|5f6j0_A6_xOMW5KP$ka6Xej>YntijZ5sAR+PRwNL)@w<-cn@aSeeECiw~Ji0@F zc=VdC1ghA;@Inqqy>tdD=&pU@(OvohDEs0?J5bQ0)Afc&bL|bFei?}VW)%I65dHUf z!CGIO0@5DMM+{;QhkA5Ao%}^t!YT-?&GmyvvhN%IeIgtl-L5}C>`svm7_(cXqw&*! zpgL5s$ufEpLJR-@{~voeEiFxtU%myXgn?o52VEH#OCSTN9c*ehOUF(oAb;lfpPjBR zx?NwGg3RhT1T(%vgrnQ_P4fZ9PS-atcY)30mv>=c*gQdRFB7BvWIx06jQx}4jKrC) z|C(%Ww25)?U=1q2NQsK?6NV1eycg!w-zf4U;!E*~6o?1S%@9 QnX&l*6Jy@yL#<|v0Lu=vZvX%Q delta 450 zcmey-%k-m{X~G4;3pxx8j0_A6^Z0-S5M0>!a6Xg3O4X*T#apcT8g{WqXYUh9Ts(nU zbFu@A!{iA%vW)vDuhUUyTs--jjuNBA$Y(fM@p7F`Jw4X`%X4<5F9QS(|mxj)Ah~E)Bpefk3F2mFYm&@FnNQnjJO_>#%`95olHRf%p9 diff --git a/include/dynmem.c b/include/dynmem.c index da693d1..43255df 100644 --- a/include/dynmem.c +++ b/include/dynmem.c @@ -66,11 +66,13 @@ void writel(const char *filepath, void *buffer, size_t size) #endif } -void emcryptText(int *output, char *password) +void encryptText(int *output, char *password) { for (int i = 0; i < 256; i++) { - output[i] = (int)password[i] * 2; + output[i] = (int)password[i]; + output[i] ^= 0xFF; // Invert bitwise all characters in the password + output[i] = output[i] * 2; } } @@ -78,6 +80,7 @@ void decryptText(char *output, int *password) { for (int i = 0; i < 256; i++) { - output[i] = (char)(password[i] / 2); + int temp = password[i] / 2; + output[i] = (char)(temp ^ 0xFF); // Reverse the XOR and division operations } } diff --git a/include/dynmem.h b/include/dynmem.h index 755e3fb..c1770c1 100644 --- a/include/dynmem.h +++ b/include/dynmem.h @@ -55,7 +55,7 @@ int readl(const char *filepath, void *buffer, size_t size); //@param filepath Path to the file @param buffer Buffer to store the file @param size Size parameter specifies the number of bytes to read void writel(const char *filepath, void *buffer, size_t size); //@param filepath Path to the file @param buffer Buffer to write to the file @param size Size parameter specifies the number of bytes to write -void emcryptText(int *output, char *password); //@param output Output buffer to store the encrypted text @param password Password to encrypt the text +void encryptText(int *output, char *password); //@param output Output buffer to store the encrypted text @param password Password to encrypt the text void decryptText(char *output, int *password); //@param output Output buffer to store the decrypted text @param password Password to decrypt the text diff --git a/src/main.c b/src/main.c index 7ed8545..c185b96 100644 --- a/src/main.c +++ b/src/main.c @@ -32,6 +32,7 @@ void clear_input_buffer(void) int main(void) { + char *password = create(char); password = size(password, 256); @@ -59,7 +60,7 @@ int main(void) int *buffer = create(int); buffer = size(buffer, 256); - emcryptText(buffer, password); + encryptText(buffer, password); writel(PASS_FILE, buffer, 256); free(buffer); @@ -169,8 +170,11 @@ int main(void) printf("\nList of existing passwords:\n<------->\n"); Request req; - // send request with type 4 to get IDs for all passwords - req.type = 4; + // send request with type 3 to get IDs for all passwords + // level == how many keys are being sent + // key == the list of levels that have keys + + req.type = 3; memset(&req.key, 0, sizeof(req.key)); req.ID = 1; req.level = 0;