# Elliptic Curve Cryptography (ECC)

### Why ECC?

There are many asymmetric cryptosystems (like **RSA** or **DLP-based systems**). ECC stands out because it achieves the **same level of security with much shorter keys**:

* RSA/DLP require keys of **1024–2048 bits**.
* ECC needs only **160–256 bits**.

Shorter keys mean:

* **Faster computation**
* **Smaller digital signatures**
* **More efficient storage and transmission**

#### RSA / DLP vs ECC: Key Size, Signature Length, and Security Equivalence

| **Cryptosystem** | **Typical Key Size (bits)** | **Signature Length (bits)** | **Approx. Security Equivalence** |
| ---------------- | --------------------------- | --------------------------- | -------------------------------- |
| RSA / DLP        | 1024 – 2048                 | 1024 – 2048                 | RSA 2048 ≈ ECC 224               |
| ECC              | 160 – 256                   | 160 – 256                   | ECC 224 ≈ RSA 2048               |

***

### Elliptic Curves and Finite Fields

In cryptography, an **elliptic curve** is a type of **polynomial equation** defined over a **finite field**.

* The most common fields are **prime fields GF(p)**, where all arithmetic is done **mod p**.
* The general curve equation is:

**y² ≡ x³ + ax + b (mod p), with p > 3**

**Special conditions:**

* Coefficients **a** and **b** must satisfy: **4a³ + 27b² mod p ≠ 0**
* An **identity element (Φ)** is included, called the **point at infinity**.

<figure><img src="/files/TefBIiqXlUiVLTrcZu0n" alt=""><figcaption></figcaption></figure>

### Group Operations on Elliptic Curves

Elliptic curves form a **group** under a special kind of point addition.

#### Point Addition

To add two points **P** and **Q**:

1. Draw a line through **P** and **Q**.
2. Extend it until it intersects the curve at another point.
3. Reflect that intersection across the x-axis → this gives **P + Q**.

#### Special Cases

* **Point Doubling (P + P):** If Q = P, the line becomes a **tangent** at P. Reflecting its intersection gives **2P**.
* **Inverse Point:** If Q = –P (mirror across x-axis), then **P + Q = Φ** (the identity).
* **x = 0 Case:** If P = (x, 0), then **P + P = Φ**.

<figure><img src="/files/lcgr1McoieSvlyEhBLSa" alt=""><figcaption></figcaption></figure>

### Scalar Multiplication

Scalar multiplication is the operation of adding a point **P** to itself **n times**:

**nP = P + P + … (n times)**

This is the foundation for key generation in ECC and **ECDSA**.

#### Efficient Computation: Square-and-Multiply Algorithm

1. Convert scalar **n** into binary.
2. Start scanning from the most significant bit (MSB).
3. For each bit:
   * **0 → Point Doubling**
   * **1 → Point Doubling + Point Addition**
4. Continue until least significant bit (LSB).

<figure><img src="/files/qx58Y2FXg9l2f4GPC0wV" alt=""><figcaption></figcaption></figure>

### Example: Computing 11P

* Write **11** in binary: **1011**.
* Step through the bits using the square-and-multiply method:
  * **Bit 1 (MSB):** Initial P
  * **Bit 0:** Double → 2P
  * **Bit 1:** Double + Add → 5P
  * **Bit 1:** Double + Add → 11P

Result: **11P computed efficiently**.

<figure><img src="/files/MqViC2JrFDIdXYUPdcVl" alt=""><figcaption></figcaption></figure>

### ECC in Practice

* The set of curve points + identity element form a **cyclic group**.
* Every cyclic group has a **generator point (G)**.
* Multiplying G by different scalars generates the entire group.

This leads directly to the use of ECC in **ECDSA**, where:

* **Private keys** = scalars (n)
* **Public keys** = corresponding points (nP)

***

### Key Takeaway

* ECC achieves **high security with small keys**.
* It relies on elliptic curves over finite fields, where operations like point addition and scalar multiplication create a secure mathematical structure.
* ECC underpins modern cryptographic systems such as **ECDSA**, making it one of the most important tools in digital security today.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hub.bsvblockchain.org/higher-learning/bsv-academy/bitcoin-primitives-digital-signatures/ecdsa-prerequisites/elliptic-curve-cryptography-ecc.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
