New encryption method on the server side.

This commit is contained in:
Afonso Clerigo Mendes de Sousa 2025-02-28 19:11:06 +00:00
parent eae02d5bf6
commit 7007bed607
4 changed files with 8 additions and 5 deletions

Binary file not shown.

View File

@ -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
}
}

View File

@ -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

View File

@ -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;
}