ECC Sample Problems 1
Worked solutions for the first ECC problem set: RSA key, Diffie-Hellman, EC point addition and membership tests.
Tools needed before the problemsSearch on YouTube
This page solves Assignment 1 (25 marks). It has four problems. Each problem needs one of three computations. Learn the setup lines first. Then each problem is only arithmetic.
RSA key generationSearch on YouTube
Given primes and and a public key :
The private key satisfies , so .
Diffie-Hellman key exchangeSearch on YouTube
Common open parameters are a prime and a primitive root of . Party A picks a private key and publishes:
Party B does the same with and secretly computes:
Both raise the other party's public key to their own private key, so the shared key is equal on both sides.
Elliptic curve point additionSearch on YouTube
For and with on the curve over a field of modulus :
The slope contains a division modulo . To divide, multiply by the inverse: . For point doubling, with :
Membership test: a point lies on when .
Problem 1: RSA private key (5 marks)Search on YouTube
Statement. Participant A in an RSA cryptosystem uses primes and . The public key of A is . Find the private key of A.
Step 1, modulus and totient.
Step 2, invert modulo . Find with .
| 5 | 175 | 175 |
| 7 | 245 | 53 |
| 9 | 315 | 123 |
| 11 | 385 | 385 − 384 = |
Step 3, answer.
, so and the private key of A is 11.
To find quickly, test the values for . Stop at the first value that 35 divides exactly. , so .
Problem 2: Diffie-Hellman key exchange (5 marks)Search on YouTube
Statement. A and B agree on prime and primitive root . A chooses and B chooses . Find the key they exchange.
Step 1, public key of A.
, so :
Step 2, public key of B.
, so :
Step 3, shared key from B's side. A computes :
Step 4, cross-check from A's side. B computes :
, and . Both paths give the same value:
Reduce after each multiplication to keep the numbers small. , so . Then .
Problem 3: point addition on an elliptic curve (10 marks)Search on YouTube
Statement. An elliptic curve is defined over a finite field of integer modulus 23: , with . Given and , compute .
Step 1, slope .
Step 2, invert 7 modulo 23. Solve by trial:
| 1 | 7 | 7 |
| 2 | 14 | 14 |
| 3 | 21 | 21 |
| 10 | 70 | 70 − 69 = |
So . Then:
Add a multiple of the modulus: , so:
Step 3, .
Because .
Step 4, .
, so , hence :
Answer.
and have different values here, so the addition formula applies. When the line becomes a tangent and the doubling slope replaces the secant slope. When and , the sum is the point at infinity .
Problem 4: membership on an elliptic curve (5 marks)Search on YouTube
Statement. Check whether the points and lie on the elliptic curve over the finite field with modulus 23.
Test for . Left side and right side, both reduced by 23:
, so is on the curve.
Test for .
The right side is again , and , so is not on the curve.
Membership: square the , cube the , add plus , reduce both by . Equal, keep. Different, drop.
Error pattern to avoidSearch on YouTube
The four problems share one trap. Each division is a multiplication by a modular inverse. Each result must be in the range 0 to : is , is , is .
. Do not leave a negative remainder. Add multiples of until the value is in .
Quick self-testSearch on YouTube
In the RSA problem, what are , and for , , ?
, , and , because .
In the Diffie-Hellman problem with , , , , what are , and ?
, , , and the same follows from .
How do you divide 5 by 7 in the field of modulus 23?
Find , because . Then .
Give the three element formulas for on .
, then , then , and the sum is .
For and on with , what is ?
, , . The sum follows.
Which of and lies on mod 23, and why?
lies on it: equals . does not: differs from .
When must the doubling slope be used instead of the secant slope?
When , that is point doubling. The secant divides by , which is zero there.
What is the slope formula for doubling, and how is it different from the addition slope?
Doubling uses , where is the -coefficient of the curve. Addition uses the difference of the values over the difference of the values.
- RSA private keys: , , . With , , : .
- Diffie-Hellman: publish , then . With , , , : , , .
- A fraction modulo needs a modular inverse: . Then .
- Point addition: , then , then , all reduced by . Here .
- Membership: compare with . passes, fails.
Elliptic Curve (ECC) with example - Cryptography lecture series