# What is a good way to demonstrate elliptic curve cryptography?

For school (high school) I am writing an essay on elliptic curve cryptography. The assignment needs to include a practical part, so I decided to write a Python class for elliptic curves. This class is capable of performing elliptic curve arithmetic and can encrypt files using MV-ElGamal (although it is horribly slow).

The problem is that I need to present my research, including the practical part, to fellow high school students. I considered writing a chat app or something similar, with a connection secured by elliptic curve diffie-hellmann+AES256 and elliptic curve digital signatures, however, I'm not sure how easy that is. What would you suggest? I am looking for something simple, with the focus on the cryptography as much as possible, since that is what my essay is about. I also don't want something too ambitious since I am still only a beginner when it comes to programming (I am more into the math side). Keep in mind that my audience is not particularly interested in mathematics nor programming though.

• Diffie-Hellmann in high school... man, I went to a pretty tough high school back in the '60s/'70s, but the hardest things we had to do were on-the-fly translation of Latin passages from Virgil and Ovid into Anacreontic meter in French, or the like... nothing, ever as hard as this! I stand in awe and upvote this Q for sheer ambition, even though I wouldn't know how to start presenting Diffie-Hellmann even to senior programmers like me (which I guess tells you I don't understand it anywhere like deeply enough!-).
– Alex Martelli
Jan 4, 2015 at 0:44
• DH sounded quite straightforward to me... I am starting to doubt my own understanding now though. Jan 4, 2015 at 0:45
• Watch <a href="youtube.com/watch?v=l6jTFxQaUJA">this video</a>, by two of the experts in the field, who provide a gentle introduction to the topic of elliptic curve cryptography. Maybe you could build a clock-cryptography app and then point out that only the addition law changes when moving to elliptic curve cryptography.
– user448810
Jan 4, 2015 at 0:53
• Elliptic-curve crypto still doesn't sound or feel anywhere like "straightforward" to me even though I may use it daily, but, don't let that hold you back -- I'm sure some common ancestor of ours, a great hunter a few myriad years ago, felt the same about these new-fangled polished rather than chipped stone adzes! New generations should pole-vault clean over the shoulders of us ancient "giants", not lazily stand on them as Newton posited... it's the only way to get as much progress over the next 3-4 centuries as we did over the last 3-4 ones, and man, do we need it!!!
– Alex Martelli
Jan 4, 2015 at 1:01
• That was a very nice presentation indeed. Thank you for sharing! Jan 4, 2015 at 13:53

An encrypted chat application by itself will not really demonstrate anything, since from the users' point of view it will not (if done properly) be any different from an unencrypted one. To demonstrate the encryption, you would need to also use Wireshark or something similar to sniff packets on the network and see that they are encrypted. But if simply showing a ciphertext and saying "this is encrypted" is enough, you can just encrypt a file, which apparently you can already do.

• My encryption algorithm based on elliptic curves (MV-ElGamal) is quite slow though, which is why I'd rather use a ECDH key exchange followed by AES encryption, but how can I demonstrate this best? I'd like to keep things simple as possible. Jan 5, 2015 at 10:27
• If your program is really that slow, you probably need to work on it to make it faster. For example, are you using a naive exponentiation algorithm instead of square-and-multiply? Jan 5, 2015 at 11:10
• If you are referring to point exponentiation: yes I am using square and multiply (since that is what the security of elliptic curves relies on), however for modular squaring and cubing, I am simply using "$(x**2)%p$" or "$(x**3)%p$" Jan 5, 2015 at 11:25
• Then I'm not sure what the problem is on your implementation, but if it's unacceptably slow to encrypt a single message, there's surely one. I'd recommend fixing it over using AES, mostly for simplicity. Jan 5, 2015 at 12:11
• It takes about a second per kilobyte, so there's lots of room for improvement. I'm considering rewriting the function for reduction modulo $p$, although I'm not sure how much of a speed up that would be. The $p$ I'm planning on using comes from a NIST-curve (P-256) and they have an algorithm for reduction. Jan 5, 2015 at 12:16

If you want to demonstrate ECC in a fairly transparent way, you can use my software "Academic Signature". You can easily find it: e.g. google "open source elliptic curve cryptography".

You can easily demonstrate key creation, en-/decryption and signatures and verification of signatures.

It is really not just a demo-program and uses elliptic curves up to 1024 bit group order. Standard sources, approved by the "agencies", will let you have 521 at most.

• Don't you think a 521-bit curve gives enough security? Jan 20, 2017 at 14:05
• One might even argue that 384-bit or smaller order is enough (depending on how much you fear multi-target attacks), after all we're not gonna get to be able to carry out the required $>2^{128}$ for this purpose anyways before quantum computers completely smack ECC security. cc @CurveEnthusiast Jan 20, 2017 at 16:43
• @SEJPM Completely agree! Jan 20, 2017 at 18:45