added elapsedTime to why2-test success message

but in miliseconds (instead of microseconds)
This commit is contained in:
Václav Šmejkal 2022-05-30 19:13:43 +02:00
parent 9823b5044a
commit 213c9ea37f
No known key found for this signature in database
GPG Key ID: FD749A97DF2D5E19

View File

@ -10,6 +10,7 @@ int main(void)
char *textBuffer = malloc(128);
char *keyBuffer;
int exitCode = 0;
unsigned long timeBuffer;
//FLAGS
inputFlags flags =
@ -22,21 +23,25 @@ int main(void)
setKeyLength(100);
keyBuffer = malloc(getKeyLength());
//ENCRYPT & DECRYPT
//ENCRYPT
outputFlags encrypted = encryptText(TEST_TEXT, NULL, flags);
strcpy(textBuffer, encrypted.outputText); //GET ENCRYPTED TEXT
strcpy(keyBuffer, encrypted.usedKey); //GET KEY
timeBuffer = encrypted.elapsedTime; //GET TIME 1
//DEALLOCATE BUFFER
deallocateOutput(encrypted);
//DECRYPT
encrypted = decryptText(textBuffer, keyBuffer, flags);
timeBuffer += encrypted.elapsedTime; //GET TIME 1
//COMPARE DIFFERENCE
if (strcmp(encrypted.outputText, TEST_TEXT) == 0)
{
printf("Test successful!\n\nTEXT: %s\nOUTPUT: %s\nKEY: %s\nUNUSED KEY-CHARS: %lu\n", TEST_TEXT, textBuffer, encrypted.usedKey, encrypted.unusedKeySize);
printf("Test successful!\n\nTEXT: %s\nOUTPUT: %s\nKEY: %s\nTIME: %lums\nUNUSED KEY-CHARS: %lu\n", TEST_TEXT, textBuffer, encrypted.usedKey, timeBuffer / 1000, encrypted.unusedKeySize);
}
else
{