On Github MarcScott / crypto_edu
Created by Marc Scott / @coding2learn using reveal.js A School CryptoParty by Marc Scott is licensed under a Creative Commons Attribution 3.0 Unported License.
We use computers every day of our lives.
Sometimes we use computers without really knowing they're computers, such as our:
It is important that you understand some of the issues and implications of using these computers.
Staying safe and secure while using computers is becoming more and more important.
Governments, Companies and Criminals all want to have as much access to your private information as they can get.
It is important that you learn how to keep yourself safe and secure and that you know some of the theory behind the methods used to protect your information.
Data is little more than a collection of facts and figures.
On it's own data has little meaning or use.
For instance here is some data:
[87,92,78,93,98,85]
What do you think this data means?
Data on it's own is pretty meaningless. It can become information when it is given a context.
For instance;
[87,92,78,93,98,85]
tells us very little on it's own, but if you know that it is the percentage of each Year 9 class in the school, planning on studying Computing at GCSE, now you have some information.
Decide which of the following statements are True and which are False.
My mobile phone company knows where I am whenever my phone is on, within about three miles. My mobile phone company knows who I have called/texted and who has called/texted me. My broadband provider keeps a record of every website I visit. Google keeps a record of eveything I have searched for using their search engine. My email provider scans all the emails I send and receive. Facebook scans every message and post I make and keeps a record of them all. Facebook regularly tracks which websites I visit.They're all True.
The problem with all these forms of authentication, is that the user can't change them. If somebody manages to make copies of your fingerprints, then they could potentially commit identifty fraud, and you are unable to change your own fingerprints.
Our program is going to have to perform a few actions
Ask the user to enter a password. Store that password as a variable.You probably know how to write this alogrithm already, but before you start we're going to look at some simple pseudocode.
Pseudocode is a quick and easy way to jot down the the basics of any program you're planning on writing.
Watch the video to see the pseudocode for the first script.
The video below shows how to write the same script in Python
Computer programs usually ask for validation of PINs and Passwords.
This is to ensure that the user has entered the password or pin correctly
Our next script is going to validate the PIN entry we have just done
Functions are named sections of a program or script that perform a specific task.
Functions are useful, as they help to keep our code organised and can be used over and over again in a program.
The first function we're going to create in Pseudocode is one to get the user's PIN
Follow the tutorial below to see how this is accomplished in pseudocode
Follow the next tutorial to see how to recreate the function in Python
Once a function is written, it won't run until it has been called.
Watch the tutorial below to learn how to run a function
Functions can have parameters associated with them. Parameters go in the brackets () after a function's name.
Things (strings, lists, variables, even other functions) that we pass into functions are called arguments. Watch the video below to see a function being used with Python that has arguments passed into it.
Watch the video below to see how it can all be tied together to create a complete program. Once you've watched the tutorial, have a go at creating the finished program in Python.
In most programming languages, there are several functions that are built into the language itself.
One example of an inbuilt function is input() which you have already used.
Another one is len() which checks the length of a string or list.
The next tutorial will take you through using len() in your program
Let's build a checkLength Function in Pseudocode that we can use in our program.
The function you've just created needs calling in the main program loop. Have a go and use the video below if you need to.
There's an error in the code. Can you find it?
Run the code and see if you can spot an error - you might have fixed them already though.
We want to check that the user is only typing in the numerals 0-9
To do this we're going to need to learn about the in and not in syntax, as well as learning about for loops.
We can check whether a string exists within another string or list of strings using the in syntax. Try typing the following three lines into your interpreter and see what happens.
'b' in 'abc' 'b' in 'def' 'b' not in 'def'
The following video can show you more
A for loop will iterate over a range of values, a string or a list.
Try running these lines of code, or skip to the video on the next slide.
for number in range(10): print(number) for letter in 'abcde': print(letter) for item in [1,2,'a','b',3]: print(item)
You might now be able to create a function that checks for acceptable characters.
We now want to call the function in the main loop. The video below will help if you need it to.
We're going to re-factor out code a little.
This will make it a little more usable.
Watch the video below for an extension task if you finish early.