2022-03-20 18:12:25 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2022-04-27 19:18:30 +02:00
|
|
|
#include <string.h>
|
2022-03-20 18:12:25 +01:00
|
|
|
|
2022-05-12 17:12:33 +02:00
|
|
|
#include <why2.h>
|
2022-03-20 18:12:25 +01:00
|
|
|
|
2022-05-12 18:50:58 +02:00
|
|
|
int main(void)
|
2022-03-20 18:12:25 +01:00
|
|
|
{
|
2022-05-08 20:02:47 +02:00
|
|
|
char *buffer;
|
|
|
|
|
2022-05-06 17:43:00 +02:00
|
|
|
inputFlags flags =
|
2022-04-29 18:00:38 +02:00
|
|
|
{
|
2022-05-12 18:50:58 +02:00
|
|
|
1, //SKIP CHECK
|
2022-05-06 17:43:00 +02:00
|
|
|
0, //NO OUTPUT
|
|
|
|
};
|
2022-04-29 18:00:38 +02:00
|
|
|
|
2022-05-08 20:02:47 +02:00
|
|
|
outputFlags encrypted = encryptText(TEST_TEXT, NULL, flags);
|
|
|
|
|
|
|
|
buffer = encrypted.outputText; //GET ENCRYPTED TEXT
|
|
|
|
|
|
|
|
encrypted = decryptText(encrypted.outputText, encrypted.usedKey, flags);
|
2022-03-20 18:12:25 +01:00
|
|
|
|
2022-05-06 17:43:00 +02:00
|
|
|
if (strcmp(encrypted.outputText, TEST_TEXT) == 0)
|
2022-04-27 19:18:30 +02:00
|
|
|
{
|
2022-05-08 20:02:47 +02:00
|
|
|
printf("Test successful!\n\nTEXT: %s\nOUTPUT: %s\nKEY: %s\n", TEST_TEXT, buffer, encrypted.usedKey);
|
2022-04-27 19:18:30 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fprintf(stderr, "Test failed!\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
2022-03-20 18:12:25 +01:00
|
|
|
|
2022-05-08 19:56:16 +02:00
|
|
|
//DEALLOCATION
|
2022-05-12 18:50:58 +02:00
|
|
|
free(buffer);
|
|
|
|
deallocateOutput(encrypted);
|
2022-05-08 19:56:16 +02:00
|
|
|
|
2022-03-20 18:12:25 +01:00
|
|
|
return 0;
|
2022-04-26 19:05:57 +02:00
|
|
|
}
|