UDAES
Fork of UDAES by
Diff: udaes.cpp
- Revision:
- 2:852dbf21ccf6
- Parent:
- 1:470744ec67c0
--- a/udaes.cpp Tue Jun 13 03:33:09 2017 +0000 +++ b/udaes.cpp Tue Jun 20 05:34:59 2017 +0000 @@ -12,7 +12,7 @@ //Function to print the hexadecimal ASCII value of the data taking data and its length as parameters -void printData(const void* data, size_t length) +/*void printData(const void* data, size_t length) { const char* dataBytes = (const char*)data; //Casting the data to the character pointers for (size_t i = 0; i < length; i++) { @@ -21,19 +21,19 @@ printf("0x%02X, ", dataBytes[i]); //Print the hexadecimal ASCII value of the respective character } printf("\n"); -} +}*/ //Function for encryption of data taking char enc[] as a parameter char* encryptData(char enc[]) { - printf("\nOriginal message: \"%s\"", enc); //Print the message to be encrypted i.e. enc[] - printData(enc, 16); //Print the hexadecimal ASCII form of the data + //printf("\nOriginal message: \"%s\"", enc); //Print the message to be encrypted i.e. enc[] + // printData(enc, 16); //Print the hexadecimal ASCII form of the data aes.setup(key, AES::KEY_128, AES::MODE_CBC, iv); //Setup the configuration of AES in 128 bit and CBC mode aes.encrypt(enc, encackmsg, 16); //Encrypt the given message and store it in encackmsg aes.clear(); //clear the AES printf("\nEncrypted message: \"%s\"\n", encackmsg); //Print the encrypted data stored in encackmsg - printData(encackmsg, sizeof(encackmsg)); //Print the hexadecimal ASCII form of the encackmsg + // printData(encackmsg, sizeof(encackmsg)); //Print the hexadecimal ASCII form of the encackmsg char* encstr=encackmsg; //Store the value of encackmsg in encstr return encstr; //Return encstr } @@ -47,7 +47,7 @@ aes.decrypt(dec, message1, 16); //Decrypt the given encrypted data and store it in message1 aes.clear(); //clear the AES printf("\nDecrypted message: \"%s\"", message1); //Print the Decrypted data stored in message1 - printData(message1, 16); //Print the hexadecimal ASCII form of the message1 + // printData(message1, 16); //Print the hexadecimal ASCII form of the message1 char* decstr=message1; //Store the value of message1 in decstr return decstr; //Return decstr