10  Cryptography Game Resources

The goal of the game is to design a cryptographic protocol for communication between your encryption and decryption teams, communicating solely via the ‘public-channel’. Scoring a point for each successfully transmitted message, and taking a point away from your rival team for each message your hackers can decipher.

10.1 RULES

  1. All communication with your corresponding teams must be via the public channel.
  2. If using RSA for encryption, do not set \(n=pq\) greater than 500!
  3. Any message can be sent via the public channel, but only those from the list of approved messages will score!

10.2 Asymmetric Encryption Tools (RSA)

Steps for implementing an RSA encryption scheme:

10.2.1 Key Generation (by recipient)

The goal is to compute three numbers:

  • \(e\), the encryption key
  • \(d\), the decryption key
  • \(n\), the product of two primes \(p\) and \(q\).
  1. Pick primes \(p, q\) such that \(n = pq > 127\), compute \(n\).
  2. Compute the totient function \(\phi=(p-1)(q-1)\) and pick \(e<\phi\) such that \(e\) and \(\phi\) are coprime (i.e. \(\gcd(e, \phi)=1\)).
  3. Pick \(d\) such that \(de \equiv 1\mod\phi\).
  4. Send the pair \((e, n)\) to sender.

10.2.2 Encryption and Decryption

For a given \(n\) character long message \(s=s_0\ldots s_n\), with characters \(\{s_i\}\), compute integer character representations \(\{m_i\}\) using ASCII table below.

Character (\(s_i\)) Integer (\(m_i\)) Character (\(s_i\)) Integer (\(m_i\))
(space) 31 N 53
A 41 O 54
B 42 P 55
C 43 Q 56
D 44 R 57
E 45 S 58
F 46 T 59
G 47 U 60
H 48 V 61
J 49 W 62
K 50 X 63
L 51 Y 64
M 52 Z 65

Then, to encrypt a message we take the message \(m_i\), the exponent \(e\), and the modulus, \(n\), and compute:

\[\begin{equation*} c_i = m_i^e \mod n, \end{equation*}\]

m =  ,   e =  ,   n =   ,   c =  

Decryption is the same, but instead you use the decryption key \(d\) instead of \(e\):

\[\begin{equation*} m_i = c_i^d \mod n, \end{equation*}\]

c =  ,   d =  ,   n =   ,   m =  

10.3 Breaking RSA

To aid in cracking RSA we have provided you with a tool that computes the quotient and remainder for two given numbers, i.e. given numbers \(n\) and \(d\) it returns the corresponding \(q\) and \(r\) from the equation:

\[\begin{equation*} n = q\cdot d + r \end{equation*}\]

HINT: This will speed up finding \(p\) and \(q\) as well as the Euclidean algorithm!

n =  ,   d =  ,   q =  ,   r =  

10.4 Vigenère Cipher Tools

Here is a quick tool which will help you encrypt and decrypt messages using the Vigenère cipher, should you decide to use it.

Remember that you can only communicate via the public channel, and it is possible for your opponents to intercept your messages!


Key: