Ethereum: On public keys compression, why does an even or odd y coordinate correspond to the positive / negative sign respectively?

February 5, 2025 yanz@123457 No comments exist

The Art of Compression: Understanding Public Key Coordinates

Ethereum: On public keys compression, why an even or odd y coordinate corresponds to the positive / negative sign respectively?

In the realm of cryptography, public key compression is a clever technique used to reduce the size of large public keys while preserving their essential properties. One aspect of this compression process is related to the coordinate system used in public key systems, particularly Ethereum. In this article, we will delve into the world of compressed public keys and explore why an even or odd y-coordinate corresponds to the positive or negative sign respectively.

According to Andreas Møller’s book on compressed/uncompressed public keys, “Chapter 4 – Section – Key Formats”, uncompressed public keys have a prefix of 04, followed by a sequence of bytes that represent the cryptographic hash of the public key. When this public key is compressed, it typically takes the form of an elliptic curve digital signature (ECDSA) or a similar algorithm. As part of the compression process, the y-coordinate of the compressed public key is often affected.

The reason behind this seemingly arbitrary choice lies in the underlying mathematics of elliptic curves and cryptography. In an elliptic curve-based system like Ethereum’s, each point on the curve corresponds to a unique pair of coordinates (x, y). These points are represented by pairs (x, y), where y is typically computed as -log(x).

When we consider compressed public keys, the compression algorithm often reduces the size of the x-coordinate while preserving the integrity and security of the key. However, the y-coordinate, which represents the point on the curve corresponding to a particular public key, may experience changes during the compression process.

The reason for this change in behavior is rooted in how the compression algorithm works. When compressing an elliptic curve-based public key, the algorithm typically uses a simple transformation that maps the original coordinates (x, y) to a new set of coordinates (x', y'). In many cases, this transformation involves reducing the y-coordinate by a constant factor or applying a non-linear function.

The specific implementation of compression algorithms can vary depending on the chosen encryption scheme and cryptographic library. However, in general, an even or odd y-coordinate corresponds to a positive or negative sign respectively due to the inherent mathematical properties of elliptic curves. This is because when computing y as -log(x), it is common for -log(x) to be symmetric around zero.

To illustrate this concept, consider an example where we have an elliptic curve with coordinates (x, y) = (1, 2). Applying the transformation defined by the compression algorithm, we get (x', y') = (1, -2). In this case, the original even y coordinate corresponds to a positive sign, while the transformed odd y coordinate corresponds to a negative sign.

In conclusion, the choice of whether an even or odd y-coordinate in compressed public keys is not arbitrary; it’s deeply rooted in the mathematical structure of elliptic curves and cryptography. The compression algorithm typically reduces the size of the x-coordinate while preserving the integrity of the key, which results in an even or odd y coordinate corresponding to a positive or negative sign respectively.

As we continue to explore the intricacies of public key systems, it’s essential to understand how these mathematical choices impact the security and usability of these cryptographic protocols. By grasping the underlying principles behind compression algorithms, we can better appreciate the importance of careful design and implementation in creating secure and reliable cryptography systems like Ethereum.

Leave a Reply

Your email address will not be published. Required fields are marked *