added elapsedTime to why2-test success message
but in miliseconds (instead of microseconds)
This commit is contained in:
parent
9823b5044a
commit
213c9ea37f
@ -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
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user