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 *textBuffer = malloc(128);
|
||||||
char *keyBuffer;
|
char *keyBuffer;
|
||||||
int exitCode = 0;
|
int exitCode = 0;
|
||||||
|
unsigned long timeBuffer;
|
||||||
|
|
||||||
//FLAGS
|
//FLAGS
|
||||||
inputFlags flags =
|
inputFlags flags =
|
||||||
@ -22,21 +23,25 @@ int main(void)
|
|||||||
setKeyLength(100);
|
setKeyLength(100);
|
||||||
keyBuffer = malloc(getKeyLength());
|
keyBuffer = malloc(getKeyLength());
|
||||||
|
|
||||||
//ENCRYPT & DECRYPT
|
//ENCRYPT
|
||||||
outputFlags encrypted = encryptText(TEST_TEXT, NULL, flags);
|
outputFlags encrypted = encryptText(TEST_TEXT, NULL, flags);
|
||||||
|
|
||||||
strcpy(textBuffer, encrypted.outputText); //GET ENCRYPTED TEXT
|
strcpy(textBuffer, encrypted.outputText); //GET ENCRYPTED TEXT
|
||||||
strcpy(keyBuffer, encrypted.usedKey); //GET KEY
|
strcpy(keyBuffer, encrypted.usedKey); //GET KEY
|
||||||
|
timeBuffer = encrypted.elapsedTime; //GET TIME 1
|
||||||
|
|
||||||
//DEALLOCATE BUFFER
|
//DEALLOCATE BUFFER
|
||||||
deallocateOutput(encrypted);
|
deallocateOutput(encrypted);
|
||||||
|
|
||||||
|
//DECRYPT
|
||||||
encrypted = decryptText(textBuffer, keyBuffer, flags);
|
encrypted = decryptText(textBuffer, keyBuffer, flags);
|
||||||
|
|
||||||
|
timeBuffer += encrypted.elapsedTime; //GET TIME 1
|
||||||
|
|
||||||
//COMPARE DIFFERENCE
|
//COMPARE DIFFERENCE
|
||||||
if (strcmp(encrypted.outputText, TEST_TEXT) == 0)
|
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
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user