### a C++ program to perform 128-bit encryption and decryption using XOR operation.

Write a C++ program to perform 128-bit encryption and decryption using XOR operation.
Your program must ask for 128-bit key and plain text then perform encryption and decryption.
 Write a C++ program to perform 128-bit encryption and decryption using XOR operation. Your program must ask for 128-bit key and plain text then perform encryption and decryption.

You didn't write your c++ question! What part of this are you having trouble with? What have you done so far? Post your current code.
i got this in an assignment ,i haven't even started the code as i have no idea what to do in this question , any tip or hint would be great thanks
read in 128 bits. that is 16 bytes. ask for the key in hex (32 letters typed in) or some format you can easily mash into 16 bytes as an array. remember that they type in text, but you want to work with it as a numeric value.
then iterate. for all the letters in the string, letter^=key[index%16]. But, how do you decrypt it? what is the special property of xor ?

special note: ascii xor results are frequently going to be unprintable. Print in hex, or to a binary file, or something, but do not be astounded if you get an ascii zero or other goofball result. That is fine. Its really just numbers, and the numbers are valid and will decrypt correctly even if it is nonsense when encrypted. You can use the UUencode algorithm if you need to display the encrypted values on screen as an alternative to hex -- its a way to turn 1 byte of binary into 2 bytes of printable text.
Last edited on
Have you even read the book? The teacher shouldn't be giving you assignments without telling you how to do them. Have you learned 128-bit encryption, or even encryption at all? Have you learned how to use XOR?

If you really don't know how to do it, google "128 bit encryption c++" and that should give you something to start on.

Here're some rules to go by when posting here: