assign5_design - Sindoori Murugavel sm24334 Assignment 5:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Sindoori Murugavel sm24334 Assignment 5: Cryptoanalysis (Design) Pseudo-code: #include <stdio.h> #include <time.h> #include <stdlib.h> #define KEY "key.txt" int main() { /* define variables*/ int choice; { clock_t start, end; double runtime; start = clock(); /*rest of the main program*/ FILE *fp; if ((fp=fopen(KEY, "r")) != NULL) printf("File exists\n\n"); else printf("File not found.\n\n"); printf("Please hit enter."); while (choice != 0) { printf(“Enter 1 to Decrypt an encrypted file.”); printf(“Enter 2 to Encrypt a file.”); printf(“Enter 0 to exit.”); print(“Enter your choice: ”); scanf(“%d”, &choice); switch(choice) { case 1: decrypt(); break; case 2: encrypt(); break; case 0: break; } } /*end of the clocking */ end = clock(); runTime = ((end – start) / (double) CLOCKS_PER_SEC ); printf (“the run time of my program is %g seconds”, runTime); getchar(); return 0; } void decrypt() { int *p, *c; int i, j; String cipher, puzzle, solution; printf(“Enter name of file which contains substitution cipher: ”); scanf(“%s”, cipher); /*open file defined by cipher*/...
View Full Document

This homework help was uploaded on 04/09/2008 for the course EE 312 taught by Professor Shafer during the Spring '08 term at University of Texas.

Page1 / 3

assign5_design - Sindoori Murugavel sm24334 Assignment 5:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online