Question 8
OCR Computer Science Specimen Paper 2A level8 marks
On the specification
- 1.3 Exchanging data2.2 Problem solving and programming
Question text
8 It is possible to use XOR together with a key to encrypt a plain text message. For example, to encrypt the bit pattern 111100001111 using the number 5 as a key, the key is repeated as often as necessary to match the length of the message. An XOR operation is performed to generate the encoded message. 111100001111 <- Message to be encrypted 101101101101 <- Key: repeated as necessary 010001100010 <- Encrypted message Write an algorithm to accept a text message and a key that would use the method above to generate an encoded message. Annotate your pseudocode with comments to show how it solves the problem.