Ed25519 Signature Algorithm: A Detailed Explanation

Introduction

Ed25519 is a modern, high-security, and efficient digital signature algorithm based on Edwards-curve Digital Signature Algorithm (EdDSA), using the twisted Edwards curve Curve25519. It is widely used due to its fast signing, fast verification, and resistance to side-channel attacks.

Key Components

  • Curve25519: An elliptic curve defined over a finite field.

  • SHA-512: A cryptographic hash function used for hashing keys and messages.

  • Clamping: A process that ensures certain properties of private keys to improve security.

Key Generation

Ed25519 generates a key pair (public key, private key) as follows:

  1. Generate a 32-byte random seed: Let this be .

  2. Derive a 64-byte private key:

    • Compute the SHA-512 hash of :

    • Split into two 32-byte halves: (, )

    • Modify (clamping):

      • Set the first 3 bits to zero: Ensures small subgroup attacks are avoided.
      • Set the second-most significant bit: Ensures group order is prime.
  3. Compute the public key:

    • Interpret as an integer and multiply it by the generator point G:
    • The point P on the curve is actually represented as X and Y coordinates (32 bytes each). Many times, the Y cordinate is discarded and public key is just the X coordinate.

Signature Generation

Given a message , and the two halves derived from private key, the signature is computed as follows:

  1. Compute the nonce:

    • Compute: r
    • Compute the nonce point R:
    • Here also, only X coordinate of R is considered toverify.
  2. Compute the challenge hash:

    • Concatenate , , and :
  3. Compute the final signature value:

    • Compute:
    • The signature is concatenated R and S, i.e. (R, S). Its length is 64 bytes toverify .

Signature Verification

Given a public key , a message , and a signature , the verification process is:

  1. Compute the challenge hash:

    • Compute k:
  2. Verify the signature equation:

    • Check if:
    • If true, the signature is valid; otherwise, it is invalid.
    • Why does this work?

Security Features

  • Fast & Efficient: Uses small, constant-time operations, making it resistant to timing attacks.

  • Collision Resistance: Uses SHA-512 to hash inputs.

  • No Side-Channel Leaks: Protects against branch prediction & cache timing attacks.

  • Deterministic Signatures: Prevents nonce reuse attacks.