#include #include using namespace std; // Outputs the contents of Packet with Text prefix void DisplayContents(clPacket & Packet, char * Text) { // Move cursor to start of packet Packet.SetCursor(0); // Return string containing contents of packet char * Contents = Packet.GetStringC(Packet.GetUsedSize(),true); // Write packet contents to screen cout << Text << '\n'; cout << Contents << "\n\n"; // Deallocate memory of string delete[] Contents; } void main() { // Create packet clPacket Packet; Packet.SetMemorySize(1024); // Create key to be used when encrypting // The 4 parameters of mnCreateKey256 act as a password // Without these values it is impossible to decrypt the packet long long int Key = mnCreateKey256(1251521,15215215,121512515,151252151); // Get input char Input[1024]; cout << "Enter data to be encrypted (max len = 1024):\n"; cin.getline(Input,1024); cout << "\n\n"; // Load input into packet Packet.AddStringC(Input,0,false); // Display packet contents DisplayContents(Packet,"Original contents: "); // Encrypt the packet using the key that we created earlier Packet.Encrypt(Key); // Display encrypted contents DisplayContents(Packet,"Encrypted contents: "); // Decrypt packet using the key that we created earlier Packet.Decrypt(Key); // Display decrypted contents DisplayContents(Packet,"Decrypted contents: "); system("PAUSE"); }