diff --git a/bin/KeyMaster_server b/bin/KeyMaster_server index 084505e..10fa24e 100755 Binary files a/bin/KeyMaster_server and b/bin/KeyMaster_server differ 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 9b6910f..1c2be51 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/server.c b/src/server.c index c46d2db..4650601 100644 --- a/src/server.c +++ b/src/server.c @@ -168,7 +168,7 @@ int main(void) printf("Writing key to file: %s\n", filepath); int key2[256]; - emcryptText(key2, req.key); + encryptText(key2, req.key); writel(filepath, key2, 256); break; }