Challenge Description

Time for a quiz!

Flag proof

UNR{fc6c94f33086bcc1dd0a508581c8109d09a4820c4391391dabf3218aa3ede230}

Summary

A simple ElGamal quiz, done with netcat. Really great way to learn about elgamal. Solved using wikipedia and other elgamal tools found on github.

Details

After looking at the title, the first thing I did was look up ElGamal. I have never heard of ElGamal before, so the best way to familiarize myself with it was by using Wikipedia:

https://en.wikipedia.org/wiki/ElGamal_encryption

The quiz started off with the key-pair generation.

Q1

Q:Let’s start by creating a key pair and signing a message. If q=65537 and g=31337, can you come up with a valid x?

Per the wiki, x must be an integer from $\lbrace1,\dots,q-1\rbrace$, so we choose 2. A: 2

Q2

Q: Great choice! We’ll use that x for now. Please input the value of h

Per the wiki, $h=g^x\mod q$. On wikipedia, we see that $h=g^x$, but the quiz tests us by using a cyclic group G of order q → remainder group G modulo q. So, for each operation, we must use modulo q. A: g^x%q = 1161

Q3

Q: Well done! We’ll need a message to encrypt. Convert ‘hi’ to a number (text -> hex -> int)

Simply use https://www.rapidtables.com/convert/number/ascii-to-hex.html to get hex: 6869, then https://www.rapidtables.com/convert/number/hex-to-decimal.html to get dec: 26729 A: 26729