Skip to content

Commit

Permalink
Formatted code
Browse files Browse the repository at this point in the history
  • Loading branch information
zugarzeeker committed Feb 28, 2017
1 parent 839c775 commit c51afbb
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions run_des.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ int main(int argc, char* argv[]) {
clock_t start, finish;
double time_taken;

start = clock();
if (argc < 2) {
printf("You must provide at least 1 parameter, where you specify the action.");
return 1;
Expand Down Expand Up @@ -139,7 +138,7 @@ int main(int argc, char* argv[]) {
unsigned char* data_block = (unsigned char*) malloc(8*sizeof(char));
unsigned char* processed_block = (unsigned char*) malloc(8*sizeof(char));

// start = clock();
start = clock();
generate_sub_keys(des_key, key_sets);
finish = clock();
time_taken = (double)(finish - start)/(double)CLOCKS_PER_SEC;
Expand Down Expand Up @@ -209,21 +208,18 @@ int main(int argc, char* argv[]) {
output[i].clear();
}

// time_taken = (double)(finish - start)/(double)CLOCKS_PER_SEC;
// printf("Finished processing %s. Time taken: %lf seconds.\n", argv[3], time_taken);
finish = clock();
time_taken = (double)(finish - start)/(double)CLOCKS_PER_SEC/nThread;
printf("Finished processing %s. Time taken: %lf seconds.\n", argv[3], time_taken);

// Free up memory
free(des_key);
free(data_block);
free(processed_block);
fclose(input_file);
fclose(output_file);

// Provide feedback
finish = clock();
time_taken = (double)(finish - start)/(double)CLOCKS_PER_SEC/nThread;
printf("Finished processing %s. Time taken: %lf seconds.\n", argv[3], time_taken);
pthread_exit(NULL);
// Provide feedback
return 0;
} else {
printf("Invalid action: %s. First parameter must be [ -g | -e | -d ].", argv[1]);
Expand Down

0 comments on commit c51afbb

Please sign in to comment.