4512/1 practical programming AQA computer science Cand number:00000 Harry Strong Harry strong 4512 Text Encryption Wildern school Design of solution 1. I have been asked to use a program which when we write a paragraph it encrypts the content, encryption which is a type of cipher text. What is encryption? Encryption is the best way to achieve data security. To read an encrypted file, you must have access to a secret key or password that enables you to decrypt it. Unencrypted data is called plain text; encrypted data is referred to as cipher text. 2. What is Encryption? Is a text which is mixed up to try keep 3. Secret? My moving letters in and hour. Task 1 Develop a main menu for the program. The options should be: Encrypt message. Decrypt message. Exit the program. Harry strong 4512 Text Encryption Wildern school Task 2 `Develop the part of the program that reads the contents of a text file to be encrypted. When the user selects the ‘encrypt message’ option from the task menu created in task 1 the program should: Ask the user to enter the name of the file containing the message to be encrypted. Task 3 1. Generate a random number between 33126. 2. Convert the random number into its equivalent ASCII character. 3. Repeat steps A and B eight times to generate and eight character key. 4. Display the eight key to the user. Harry strong 4512 Text Encryption Wildern school Task 4 1. Develop the part of the program that converts each character. In the message into its ASCII code and encrypts it using the flowy. 2. If the character is a space they do not encrypt the character. 3. Otherwise: Convert the character into its ASCII code(eg B=66) Task 5 1. Develop the part of the program that converts each character. In the message into its ASCII code and encrypts it using the flowy. 2. If the character is a space they do not encrypt the character. 3. Otherwise: Convert the character into its ASCII code(eg B=66) Harry strong 4512 Text Encryption Wildern school Task 1 – During this task I create a main menu with three options Prints main menu Gives option for the user to enter 1,2,3 to make the decision on what it is going to do the three options there is are Encrypt message, decrypt it or exit or exit program depending on choice. Task 2 Reads the file in the same folder called sample.txt. Harry strong 4512 Text Encryption Wildern school Task 3 Generates a random key and is eight character’s long. Task 4 Calculates an offset key for the user. Technique used Print() choice Input () If else For import ranndint Int () While Elif Read Chr() Ord Explanation The print function in python is a function that outputs to your console window whatever you say you want to print out. This function on python gives you a choice of to two options which leads you down a different path depending on choice. Input what is put in, taken in, or operated on by any process or system. A if statement is a programming conditional statement that, if proved true, performs a function due to the put in information. Else statement - executes some code if a condition is true and another code if the condition is false. Loop to play the program more than one time. Is when something will be put into the program for example input and output. Separate program and inserts random whole numbers. This will make it a integer by making in to a whole number. It is a loop which makes you choose one of an available option. The condition may be any expression, and the true is any non-zero value. The loop iterates while the condition is true. While choose <1. The elif statement allows you to check multiple expressions for TRUE and execute a block of code as soon as one of the conditions evaluates to TRUE. It will read a file. To identify the input is a character. This will turn the character into a integer. Harry strong 4512 Text Encryption Wildern school Test No Description 1 Test Date Press option 1 If choice == on the main 1 print (“you menu. have chosen to encrypt ”) 2 Please select Elif choice 2 on the main ==2 print menu. (you have a choose to encrypt) 3 Please select 3 on main menu. Elif choice ==print(“you have chosen to exit the program”) Expected Actual outcome Outcome This should be printed on screen if you select ‘option 1’(“you have chosen to encrypt “) This should be printed on screen if you select ‘option 2(“you have chosen to decrypt”) This should be printed on the screen as (“exit the program then it will shut down”) Further Action? Harry strong 4512 Text Encryption Wildern school Testing and Evaluation Harry strong 4512 Text Encryption Wildern school Task number User need Did I meet this How was this need? need met? Task 1 Encrypt for decrypt message. yes Task 2 For the yes program to read the file and output the file. For the yes program to create 8 random generated keys. For the yes program to output Task 3 Task 4 How could this need be better met? There was a To go into the menu that encryption displayed option. choice 1 or 2 to encrypt/decrypt message. By a command read file and then a print the file. There was a scale from 33 to 126 By using the commands to randomise the character key.