# 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.

-

## migrated from stackoverflow.comJan 4 '15 at 22:11

This question came from our site for professional and enthusiast programmers.

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 '15 at 0:44
DH sounded quite straightforward to me... I am starting to doubt my own understanding now though. – Dasherman Jan 4 '15 at 0:45
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 '15 at 1:01
Why do you need an encrypted chat program to demonstrate ECC? Is it not enough to write some code that demonstrates the properties of elliptic curves? I feel doing the encrypted chat will just obscure the topic and confuse the audience. – user13741 Jan 7 '15 at 14:16

Watch this video, 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.

-
Beautiful pointer, thanks! – Alex Martelli Jan 4 '15 at 0:56
That was a very nice presentation indeed. Thank you for sharing! – Dasherman Jan 4 '15 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. – Dasherman Jan 5 '15 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? – fkraiem Jan 5 '15 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$" – Dasherman Jan 5 '15 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. – fkraiem Jan 5 '15 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. – Dasherman Jan 5 '15 at 12:16