Better encryption method.
This commit is contained in:
parent
0c235ca1d1
commit
0262a9fdd7
BIN
bin/KeyMaster
BIN
bin/KeyMaster
Binary file not shown.
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
10
src/main.c
10
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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user