Write your question here.
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.
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.
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:
Rules & Regulations for posting on C++ forums
1: Try your best to solve your problem on your own before posting; no one appreciates people dumping their homework assignments without even trying to do them first.
2:Explain your problem or assignment very clearly (or just post the assignment itself).
3:Post whatever code you have already written, so we can see that you've actually made some effort on it, as well as any compiler errors, warnings, etc that you are having trouble with. This is linked to 1 above.