keerthivibisan.com

BlogsCryptography

ECDSA vs RSA

#Cryptography

On this page

We all have heard about ECDSA and for non-mathematical people it sounds like complicated mathematics. And then there’s RSA, people think it’s old and dead. But is it really?

Let’s get clear first

A lot of blog posts says “everyone is dropping RSA because it’s insecure”, thats not quite right

RSA isn’t broken. RSA-2048 is not going to be cracked in 2026 and at security levels RSA and elliptic-curve cryptography are equally strong against today’s (non-quantum) computers. The real reason the world is shifting toward elliptic curves is efficiency:

  • A 256-bit elliptic-curve key gives roughly the same security as a 3072-bit RSA key.
  • Smaller keys mean faster math, less bandwidth and less power drain.
Same security, much smaller and faster.

That’s why for new systems in 2026, the common recommendation is elliptic-curve keys (P-256 or Ed25519), while RSA-2048 is still widely deployed and considered fine through about 2030.

With that cleared up, let’s build understanding of RSA and ECC (elliptic-curve cryptography) from ground.

How RSA makes its keys: the prime number logic

A prime number is a number divisible only by 1 and itself: 2, 3, 5, 7, 11, 13, and so on. Now here’s how RSA is built on it.

RSA’s “easy forwards, impossible backwards” operation is multiplying prime numbers

  • Forwards (easy): Multiply two primes. 11 × 17 = 187.
  • Backwards (hard): Find “Which two primes made this ?”, Small numbers are easy, but huge numbers make the task difficult and practically impossible to solve with today’s classical computers.

When the two primes are hundreds of digits long, their product becomes a monster number and finding which primes made it can take an impractical amount of time. This is the integer factorization problem RSA relies on.

Easy to multiply, difficult to Reverse

The RSA key generation, in plain steps:

  1. Pick two big secret primes, let’s call them p and q.
  2. Multiply them: n = p × q. This n is public.
  3. Do a bit of extra arithmetic (using p and q) to produce two matching numbers, a public exponent and a private exponent. These two number are mathematically related and this relationship is what makes RSA work.
  4. Your public key is built from n and the public exponent — you share it freely.
  5. Your private key is built from the private exponent — you keep it secret.

So anyone can see ’n’, but without discovering the original secret primes ‘p’ and ‘q’, they cannot reconstruct your private key.

Elliptic-Curve Cryptography (ECC)

ECC cryptography uses different math but follows a similar principle.

Performing certain calculations is easy, while reversing them to recover the secret number is computationally infeasible with appropriately chosen parameters.

Building intuition: from a line to an elliptic curve

A “curve” in math is just a set of points that follow a rule. Let’s walk up a small ladder of rules.

1. A straight line

The rule y = x means “every point where the y-value equals the x-value.”

Plot them — (0,0), (1,1), (2,2) — and you get a straight diagonal line. Simple.

straight-line.png

2. A circle

The rule x² + y² = 25 means “every point exactly 5 units from the center.”

  • Plug in x = 0 and you get y² = 25, so y = ±5 — the points (0, 5) and (0, −5).

  • Plug in x = 3 and you get 9 + y² = 25, so y² = 16, y = ±4 — the points (3, 4) and (3, −4).

Collect all such points and you’ve drawn a circle of radius 5.

Notice something already: for each x there are usually two y-values, one positive and one negative. That “mirror” idea is about to become important.

circle.png

3. An elliptic curve

An elliptic curve is just another shape defined by a rule. The rule is:

y² = x³ + ax + b

You pick the numbers a and b, and the curve is every point that satisfies the equation. Let’s use a = −1, b = 1, giving:

y² = x³ − x + 1

Let’s prove a few points by hand. Plug in x-values and solve for y:

xx³ − x + 1y²ypoints
−1−1 + 1 + 11±1(−1, 1), (−1, −1)
00 − 0 + 11±1(0, 1), (0, −1)
11 − 1 + 11±1(1, 1), (1, −1)
28 − 2 + 17±√7 ≈ ±2.65(2, 2.65), (2, −2.65)
327 − 3 + 125±5(3, 5), (3, −5)

Every single row produces a ± pair. That’s not a coincidence — because y is squared in the equation, if some (x, y) is on the curve, then (x, −y) automatically is too. So the curve is always symmetric about the x-axis: a perfect mirror image, top and bottom.

elliptical-curve.png

The shape has three nice properties:

  1. Smooth — no kinks.
  2. No sharp corners — it flows gently.
  3. Extends forever — it keeps going outward without end.

The weird, wonderful property: you can “add” two points

Here’s the magic that makes elliptic curves useful for cryptography. On this curve, you can take two points and “add” them to get a third point that’s also on the curve:

P + Q = R

That looks strange — point + point = point ? It’s not normal addition. It’s a geometric rule that mathematicians defined (nobody “discovered” it; they invented it because it makes the math behave nicely). Here’s the rule:

  1. Pick two points P and Q on the curve.
  2. Draw the one straight line that passes through both of them.
  3. Extend that line. Because of the curve’s shape, it will hit the curve at exactly one more spot. Call that spot −R.
  4. Reflect −R across the x-axis (flip it to its mirror twin). That reflected point is your answer, R.

So: line, find the third hit, flip it. Three steps.

pqr.png

Why the reflection?

It feels arbitrary — why flip ? Mathematicians could have defined P + Q to be the third hit directly, without flipping. But then the algebra would misbehave. By adding the reflection step, the points obey all the comfortable rules we expect from arithmetic, like:

(P + Q) + R = P + (Q + R)     ← grouping doesn't matter
P + 0 = P                      ← there's a "zero" point

In other words, the flip is the small price that makes elliptic-curve points behave like a proper number system. So the reflection isn’t random — it’s chosen to make the math work.

What happens when we add a point to itself ?

We saw that adding two points P and Q, gives us another point on the curve. But what if both points are the same ?

In this case, we draw a tangent line at P instead of a line through two different points. Extend it until it intersects the curve again, then reflect that intersection across the x-axis to get 2P.

Tip

A tangent is a straight line that touches a curve at a particular point and follows its direction at that point.

The same rule applies to repeated addition:

  • 2P means P + P.
  • 3P means 2P + P.
  • 100P means adding P to itself 100 times.

Computers use efficient algorithms to calculate these multiples. This operation is fundamental to ECC, where a secret number is used to calculate a public key.

point-doubling.png

The chessboard analogy

If the geometry feels abstract, here’s the mental model that makes it click:

Imagine a chessboard. The board itself isn’t interesting. What matters is the rules for how the pieces move.

For elliptic curves:

  • The elliptic curve is the chessboard.
  • The points on it are the squares.
  • The point-addition rule (line, hit, flip) is how the pieces move.

The points, together with this movement rule, form a self-contained little universe where you can do arithmetic. Mathematicians call this structure a group. Cryptography is built entirely on doing arithmetic inside that universe. The curve is the security.


The twist that makes it real: doing it all on a clock (mod p)

The smooth curve we’ve drawn helps us visualise the idea. But real ECC works differently: it performs calculations using modular arithmetic with a large prime number ‘p’.

The rule becomes:

y² ≡ x³ + ax + b   (mod p)

Confused by mod p ? Think about a clock. If you add 5 hours to 10 o’clock, you get 3 o’clock. After 12, the count wraps around.

That’s the idea behind mod p: every result wraps back into the range from 0 to (p-1).

Instead of a smooth curve, we now have a finite set of points. The point-addition rules still work, but the calculations follow modular arithmetic.

The important part: ECC is secure not because the points look random, but because recovering the secret number from the public result is extremely difficult.


How this becomes a key — and why it’s practically impossible to break

Let’s connect the dots to cryptographic keys.

Everyone using a particular curve agrees on a public starting point called the generator point ‘G’. Think of ‘G’ as a specific dot in that scattered cloud — say it sits at coordinates like (5, 1). Everyone in the world knows ‘G’, it’s not a secret.

private key  =  k          (a secret number, e.g. 3)
public key   =  Q = k · G   (a specific point on the curve)

Here Q is calculated using (k · G), means adding 'G' to itself 'k' times.
Q = 3G = G + G + G

Your private key is a secret number. Your public key is the point you reach.

So we publish Q and keeps k (the number of hops) secret. In a real system k isn’t 3 — it’s a random number with about 78 digits and reaching Q takes a clever shortcut so it’s still instant, but the idea is identical: a secret hop-count produces a public landing point.

Why is it hard to reverse ?

An attacker knows the starting point (G), the public point (Q), and the rules. What they need to discover is the secret number (k).

This is called the Elliptic Curve Discrete Logarithm Problem (ECDLP).

Calculating the public key is efficient. Recovering the private key from it is computationally infeasible with properly chosen curves and key sizes using known classical attacks.

Easy to calculate forward. Extremely difficult to reverse. That’s the central idea behind ECC, similar to RSA’s reliance on the difficulty of factoring large numbers.


So what actually happens when you sign and verify?

ECDSA uses all of the above to prove authorship. Here’s the high-level flow, no heavy math:

To sign a message:

  1. Run the message through a hash function (like SHA-256) to turn it into a fixed number.
  2. Pick a fresh random secret number (called the nonce) for this one signature.
  3. Do some curve arithmetic that blends together the hash, the random nonce, and your private key.
  4. Out comes a pair of numbers, written (r, s) — that’s your signature. Attach it to the message.

To verify (anyone can do this with your public key):

  1. Hash the message the same way.
  2. Plug the hash, the signature (r, s), and the signer’s public key into the verification equation.
  3. The equation only balances if the signature was made with the matching private key. If it balances, the signature is genuine and the message wasn’t altered.

Your private key is hidden inside s, scrambled together with the random nonce and the hash, so nobody can extract it from a signature.

One critical warning: never reuse the nonce

That random number in step 2 must be fresh and unpredictable for every single signature. If you ever reuse it across two messages, an attacker can do simple algebra and recover your private key. This isn’t theoretical — it’s how the Sony PlayStation 3’s signing key was famously extracted (they reused the same nonce), and it has caused real cryptocurrency thefts. Modern libraries avoid this with “deterministic” ECDSA, which derives the nonce safely. If you remember one safety rule: never reuse the nonce.


Which curves do people actually use?

ECDSA isn’t one fixed thing — it runs on top of a chosen curve, which is just a pre-agreed, carefully vetted set of those a, b, and G values. You don’t invent your own; you pick a trusted standard:

CurveAlso known asFamous use
P-256secp256r1, prime256v1TLS / HTTPS — most of the web
P-384 / P-521secp384r1 / secp521r1Higher-security and government systems
secp256k1—Bitcoin and Ethereum
Curve25519 (Ed25519)—SSH, Signal, modern systems

A useful note for readers: Ed25519 (built on Curve25519) is technically a refined cousin of ECDSA called EdDSA. It’s a popular modern choice precisely because it’s deterministic by design — it sidesteps the nonce-reuse trap entirely. Where it’s supported, many people now prefer it.

Warning

The quantum footnote, Everything above protects you against today’s computers. But a sufficiently large quantum computer running Shor’s algorithm could break both RSA and ECC. That’s why, as of 2026, the industry is beginning to layer in post-quantum algorithms — newly standardized schemes designed to resist quantum attacks — often deployed alongside classical ECC during a multi-year transition. So if you’re writing for the long term: ECC is the best classical signature tool available right now, and post-quantum is the next chapter.


↑↓ move↵ openesc close