Viewing: Cryptography Resources

Cryptography Resources

Cryptography: on paper and in Python
Cryptographers in action at Glasgow Science Centre

Last summer we ran two Cryptography Dojos at Glasgow Science Centre based on the idea of sending and decoding secret messages. The young coders learned about ciphers, from the Caesar cipher used by Roman Emperor Julius Caesar 2000 years ago, to RSA encryption  used to provide secure internet connections for online shopping today.  They also learned about methods used to break these ciphers. After breaking a few messages encrypted using  a Caesar cipher “by hand”, the coders were given a Python program that implemented the same cipher, but had several bits missing.  During the remainder of the session they implemented the decrypt function, a function that allowed the user to specify the encryption key used, and a brute force function to enable any message to be broken quickly. This code was also used during some workshops with CBBC at their “Live in Leeds” event last summer, and as part of a “Cryptography Treasure Hunt” with a group of coders from the Princes’ Trust where the “treasure” was the means to save Glasgow from an attack by the Extreme Violence and Insurrection League (E.V.I.L.). However, our team of secret agents and cryptographers needs to be expanded to enable us to face further threats like the one above.  With this in mind, we hope that other dojos will run cryptography sessions.  To assist you in this our code can now be downloaded from our Github repository : File caesarCipher2_7base.py has a cut-down version of the program that has a complete encryption function but only skeletons for decrypt and brute force functions. The key (the value to shift letters by to encrypt) is also hard coded. This allows coders to work out for themselves how to code decrypt, brute force, and obtaining the key. File caesarCipher2_7original.py contains the complete program in case any of the coders runs out of time or finds the task too challenging. The inner loop in the nested loop in the brute-force function could be replaced by the decrypt function, but it can be a useful way of introducing nested loops. The repository also contains a python program that implements a Vignère cipher. This uses the encrypt and decrypt functions from the Caesar Cipher program, so link in to the previous code. The Vigenère program also allows you to customise your program by setting the EVIL_ORGANISATION variable. If you have any questions you can email me at claire@coderdojoscotland.com  (on a secure channel, of course…) Claire Quigley CoderDojo Mentor

4 responses to “Cryptography Resources

  1. Thanks Claire for an interesting post. Running specific cryptography sessions sounds like a good idea to me – code-breaking’s a lot of fun and provides an interesting context for developing algorithms.

    1. Thanks, John – the sessions are definitely fun, let me know if you decide to run one 🙂

Comments are closed.