Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Perl Cryptography - Seeking Resources

by ljamison (Sexton)
on Jul 24, 2016 at 14:46 UTC ( #1168426=perlquestion: print w/replies, xml ) Need Help??

ljamison has asked for the wisdom of the Perl Monks concerning the following question:

Greetings, Monks!

Starting August 1st I'll be teaching a 2-week programming camp to high school students (9th, 10th, and 11th graders) which consists of two parts -- Mathematics and Programming. Another person is teaching the Math side but this year I am teaching the programming side. The topic of the camp this year is Cryptography.

Are there any resources available which aid in teaching Perl-based Cryptography?

Replies are listed 'Best First'.
Re: Perl Cryptography - Seeking Resources
by QuillMeantTen (Friar) on Jul 24, 2016 at 19:32 UTC

    I guess it depends, crypto is quite a wide subject, what are you going to teach? I'm not familiar with the grading system so... Do you want to implement actual algorithms? Then re implementing md5 Can be a good start! Its not that hard to do and it does look impressive... Other than that, depending on your students level you could have a in depth look at pki set up and management, or even implementing well known algorithms that are a bit harder such as rsa or current aes. In both those endeavors, having handy copies ofCrypt::Openssl::AES and Crypt::Openssl::RSA can be a boon as reference material and such.
    If you decide to put yourself in a hacker's shoes (which can do for a fun programming camp) then you can go the audit road. It might take a bit of a preparation but you can grab any entry level cryptanalysis book and do easy two step classes for a bunch of well known ciphers (eg caesar):

    1. implement the cypher
    2. Do a cryptanalysis
    if your students are very good you can also go in full cracker mode, prepare your course by implementing some algorithms (such as md5,aes, rsa) in a sloppy way, thus introducing a flaw only YOU know about (or a backdoor, depending on the pov) and then look for it with your students.

    On that topic, something else you can go about implementing would be a random number generator, I'd advise implementing two, one cryptographically strong and a weak one. Then you make the students use both and study attacks against both, thus demonstrating why using low entropy sources is a bad idea.

    Food for thought, food for thought... Hope I have helped.

Re: Perl Cryptography - Seeking Resources
by Marshall (Canon) on Jul 24, 2016 at 22:33 UTC
    Wow sounds like a heck of a lot of ground to cover in 2 weeks! Intro to programming + cryptography. Geez...

    I would be thinking about starting at some place far easier than MD5. A book on the history of cryptography could be helpful. It been a decade since I read a book like that and my memory is fuzzy.

    Anyway, I would be thinking of starting with simple substitution cyphers, like ROT13 and variants. Some basic probability math would be appropriate with this subject.

    I could envision a number of fairly simple programs to help break a code like that which could be done within the time frame that you have.

    I forget the names of many early ciphers, but these things that used various lookup tables, etc. are implementable with basic programming. If you have to get into low level details like binary polynomials, then the basics of what that is and how to program that could overwhelm the students. There is a limit to what you can do in your 1/2 of the 2 weeks.

    How say DES works, could be a lecture, but I doubt a student could go from "ground zero" to working code in 2 weeks, even with the algorithm clearly spelled out.

    Update: you could have some fun with the Unix password encryption system.

Re: Perl Cryptography - Seeking Resources
by Laurent_R (Canon) on Jul 25, 2016 at 06:24 UTC
    In a somewhat similar setting, we implemented with my students a Caesar cypher and then spent some time trying to break it with probabilistic analysis. Not too complicated and quite rewarding. But that obviously does not take two weeks.

    Anyway, say hello from me to Alice and Bob. ;-)

    Update: fixed typo.

Re: Perl Cryptography - Seeking Resources
by $h4X4_|=73}{ (Monk) on Jul 25, 2016 at 09:50 UTC
Re: Perl Cryptography - Seeking Resources
by Anonymous Monk on Jul 24, 2016 at 21:30 UTC
    If you want to teach how to use cryptography in Perl perhaps CryptX distribution covers 99% of cases: sym/asym crypto, hashes, hmacs etc.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1168426]
Approved by kcott
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2022-06-26 02:35 GMT
Find Nodes?
    Voting Booth?
    My most frequent journeys are powered by:

    Results (83 votes). Check out past polls.