Question 8
OCR Computer Science June 2018 Paper 1A level17 marks
On the specification
- (a)
- 1.4 Data types, data structures and algorithms
- (b)
- 1.3 Exchanging data1.4 Data types, data structures and algorithms
- (c)
- 2.2 Problem solving and programming1.4 Data types, data structures and algorithms
- (d)
- 1.3 Exchanging data1.5 Legal, moral, cultural and ethical issues
Question text
8 A student writes a program to apply a symmetric encryption algorithm to work on messages of up to 25 ASCII characters. (a) Describe what is meant by the term ‘ASCII’. [2] The encryption algorithm works in the following way. A message of up to 25 characters (spaces and punctuation are not included) is placed in a 5×5 array. Any leftover spaces are filled with random letters. The message I LOVE COMPUTER SCIENCE becomes: I L O V E C O M P U T E R S C I E N C E T O W R M The key is a sequence of ten numbers. In this example we will use 1 2 3 4 5 1 2 3 4 5. The first 5 numbers state how many spaces the rows 0 to 4 must be rotated right. A key with the first 5 digits 1 2 3 4 5 would result in E I L O V P U C O M R S C T E E N C E I T O W R M The next 5 digits state how many spaces down the columns 0 to 4 should be rotated. Applying the last 5 digits 1 2 3 4 5 to the grid above would give T N C O V E O C T M P I W E E R U L R I E S C O M Part of the pseudocode for the algorithm is written below. global array grid[5,5] addMessage() // letters and random letters have been entered // into the 2D array, grid for i = 0 to 4 x = getNextDigitInKey() shiftRow(i,x) next i for i = 0 to 4 x = getNextDigitInKey() shiftColumn(i,x) next i //Now reassemble array back into string. (b) Show the result of running the algorithm on the grid and key below. [2] KEY: 3 3 3 3 3 1 1 1 1 1 T O P S E C R E T M E S S A G E Y R P L U O G G Q Grid after only the rows are shifted: Grid after columns have also been shifted: (c) Write the procedure shiftRow. [4] (d)* Modern encryption is much stronger than the method described in the first part of this question. Discuss the impact of modern encryption on society. You should refer to: • The importance of asymmetric encryption and how it differs from symmetric encryption. • Different circumstances in which symmetric and asymmetric encryption may be used. [9]