Confusion with the Lesson



So I am very confused with this lesson. I am not sure how to explain it to my students when I don’t understand it for myself.

How to Teach this Lesson

I have a Master’s degree in computer science and I don’t understand all the math involved in this. I freely admit that to my students. I think the key take away is that you can have a public key that’s used to encode a message but unless you have the private key you can’t decode it. The internet is secure because it would take far too long to guess the private key and decode the message.

What do others think?


The math is hard to understand and students do not need to know the math. I don’t spend too much time on the activity guide except demonstrating the beans and cups activity. I stress on how the mod function is a one-way function that makes it hard to solve the problem backwards, i.e. determine the divisor based on knowing the remainder. Here is a video that has a simple explanation of public and private key encryption. I hope this helps.


Sangeeta (@bhatnagars) is right. Student’s don’t need to know the math, only that asymmetric encryption is a thing that allows anyone to encrypt things with a public key, but only the person in possession of a private key can decrypt.

As an author of this lesson I SO WANT people to understand the math though – actually what I want is really just for anyone to take one step further to understand why/how it’s possible (with math) to create these public and private keys, because I find it unsatisfying any time someone says what I just said above :slight_smile: So it kills me that we haven’t been able to convey it easily, but I totally understand why it’s hard. To repeat: it’s beyond the scope of what students have to know. But I hate hate hate it when there is “magic” that we’re supposed to just trust and rely on.

I don’t think it’s not the math itself that is hard to understand, it’s just multiplication + modulo, but the application and certain properties of numbers and how they work. Also, there are a lot of steps and ideas you have to string together, and I can see how it’s easy to get lost in the steps. So this is making me want to take another crack at it, just for the satisfaction.

Would it be worth it to do this?



Maybe if there was just a video solving a few simple versions of this problem without the widget it would be helpful :slight_smile:


I can appreciate your passion for the math involved, and what students’ understanding of that math might accomplish, but I personally feel that that level of complexity should be explored in an actual math class. My understanding has always been that CSP is more of a survey course, one that allows students to be exposed to the “big ideas” of computer science, with the hope that they will get excited about what they’re learning and possibly go on to major in CS or pursue some related degree, where perhaps understanding concepts like these at a much deeper level is necessitated. My 2¢ anyhow.


I am a first time AP CSP teacher. In the beginning I was very excited to teach this lesson and my kids very excited too. But even with my degree in computer science and engineering and it took me one week to wrap my head around the math and the properties of modulo operation.
So I focused more on Modulo operation and the takeaways from the worksheet. I thought its fine as long as the students understand the MOD operation, prime factorization and how the use of large numbers makes the public key encryption possible.
I had the students play around the public key crypto widget and had them see the difference when they choose small numbers Vs big numbers for the public modulus. I didnt go into the algorithm and math itself but I did put out the resource included in the lesson “How and Why Does the Public Key Crypto Really Work?”. It is actually explains the math behind very well.

With all this being said I too agree that just like “TSP” and “MST”, it is very complicated topic to be handled in an High School Computer Science class.