Project One and Usual Utilities
++ PA01 ++ Usual Utilities
This commit is contained in:
parent
e132cac711
commit
d739c7372e
18 changed files with 5883 additions and 0 deletions
66
PA01-0906/PA01_Main.c
Normal file
66
PA01-0906/PA01_Main.c
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
// header files
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include "EncryptionUtility.h"
|
||||
|
||||
|
||||
// local constants
|
||||
|
||||
// local functions
|
||||
|
||||
// program
|
||||
int main( int argc, char *args[] )
|
||||
{
|
||||
char toEncrypt[ HUGE_STR_LEN ], decryptedStr[ HUGE_STR_LEN ];
|
||||
char fileName[ STD_STR_LEN ], stringFromFile[ HUGE_STR_LEN ];
|
||||
SquareArrayType *encryptedInput, *uploadedInput;
|
||||
|
||||
srand( time( NULL ) );
|
||||
|
||||
printf( "\nEncryption Program\n" );
|
||||
printf( "==================\n\n" );
|
||||
|
||||
promptForString( "Enter string to be encrypted: ", toEncrypt );
|
||||
|
||||
encryptedInput = encryptData( toEncrypt );
|
||||
|
||||
printf( "\nDisplay encryption as values:\n" );
|
||||
displayArray( *encryptedInput, DISPLAY_INTS );
|
||||
|
||||
printf( "\nDisplay encryption as characters:\n" );
|
||||
displayArray( *encryptedInput, DISPLAY_CHARS );
|
||||
|
||||
printf( "\nDecrypting the input string\n" );
|
||||
decryptData( decryptedStr, encryptedInput );
|
||||
|
||||
printf( "\nDecrypted string: %s\n", decryptedStr );
|
||||
|
||||
printf( "\nDownloading encryption\n" );
|
||||
promptForString( "\nEnter file name for download: ", fileName );
|
||||
downloadData( fileName, *encryptedInput );
|
||||
|
||||
printf( "\nUploading encryption\n" );
|
||||
promptForString( "\nEnter file name for upload: ", fileName );
|
||||
uploadedInput = uploadData( fileName );
|
||||
|
||||
printf( "\nDisplay uploaded data:\n" );
|
||||
displayArray( *uploadedInput, DISPLAY_INTS );
|
||||
|
||||
printf( "\nDecrypting the uploaded string\n" );
|
||||
decryptData( stringFromFile, uploadedInput );
|
||||
|
||||
printf( "\nUploaded string: %s\n", stringFromFile );
|
||||
|
||||
// end program
|
||||
|
||||
// clear arrays
|
||||
encryptedInput = clearArrayType( encryptedInput );
|
||||
|
||||
// display end of program
|
||||
printf( "\nProgram End\n" );
|
||||
|
||||
// return success
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue