Lesson 4 – More code

Learning Outcomes

Objectives:

To make a fully working “Combination lock” program.
To adapt, modify and improve existing code, looking for faults in a program

Must

Get the full Safelock program working on the microbit, tested and bug free.

Should

Amend and improve the code,  adding meaningful comments.

Could

Make the program more secure, having calculated and proved how weak it currently is.

Keywords

Words to learn for this lesson are: Security, strength, brute force, debug.

Starter

How does a combination lock work? How secure is it? Can you open one if you don’t kn ow the number?  How?

How would this work on a computer?  Is it a good way to protect your document.

Main

You’ll need the pdf document found here.  Open it up, and make sure you have the code from page 4 copied into the micropython editor.

Make sure it is incredibly carefully typed.  Your code will NOT work with tiny little mistakes.  If it helps, you can use the larger printout of the code on page 4 of the pdf.

Get the code working on your microbit as per the instructions in the pdf document (Page 3).

Task 1: 
Everybody in the class has the same combination!   Not very secure at all.  Can you change yours? Flash it to the microbit.

Task 2:
Can you unlock someone else’s microbit without seeing their code?  How secure is this?  Work it out in your book.

Task 3:
Now adapt the code so that the program is more secure…   You’ll need to make some fairly fundamental changes to your code.

Task 4:
Most importantly – COMMENT YOUR CODE!  We need a #comment explaining how all the code works, but especially your changes in these tasks.

Plenary

In your book make a quick series of bullet points explaining how you could improve your code.  How could this program be made better/more secure/extended?

Homework

You’ll need to complete  >>these<< python questions, and print them out for your teacher (unless you’re asked to submit them via google classroom!)