## Elliptic Curves

(require ec) | package: ec |

Provides Racket implementations of elliptic curve arithmetic over prime fields in Jacobian coordinates, efficient integer multiplication in the elliptic curve group, affine/Jacobian coordinate conversion, and [SEC1] point serialization.

Provides parameters for several popular cryptographic elliptic curves.

This library should not be used to process information that must be kept secret. No effort has been made to secure this implementation against side-channel attacks.

For common cryptographic operations over elliptic curves, please see the crypto module.

### 1` `Curves

struct

a : integer? b : integer? P : exact-nonnegative-integer? Gx : exact-nonnegative-integer? Gy : exact-nonnegative-integer? n : exact-nonnegative-integer? bytes : exact-nonnegative-integer?

When (de)serializing points in SEC format, assumes each coordinate has length bytes bytes.

struct

(struct jacobian-point (x y z id curve))

x : exact-nonnegative-integer? y : exact-nonnegative-integer? z : exact-nonnegative-integer? id : boolean? curve : curve?

struct

(struct affine-point (x y id curve))

x : exact-nonnegative-integer? y : exact-nonnegative-integer? id : boolean? curve : curve

procedure

p : affine-point?

procedure

p : jacobian-point?

procedure

p : affine-point?

### 2` `Curve Operations

procedure

(ecdub p) → jacobian-point?

p : jacobian-point?

procedure

(ec+ p q) → jacobian-point?

p : jacobian-point? q : jacobian-point?

procedure

(dG c d) → jacobian-point?

c : curve? d : exact-nonnegative-integer?

procedure

(dO O d) → jacobian-point?

O : jacobian-point? d : exact-nonnegative-integer?

### 3` `SEC Point Representation

procedure

(point->sec p [#:compressed? compressed?]) → bytes?

p : affine-point? compressed? : any/c = #t

procedure

(sec->point c s) → affine-point?

c : curve? s : bytes?

### 4` `Parameters

value

value

value

value

value

value

value

value

value

value

value

value

value

value

value

### Bibliography

[SEC1] | Certicom Research, “SEC 1: Elliptic Curve Cryptography, version 2.0.” 2009. https://www.secg.org/sec1-v2.pdf | |

[SEC2] | Certicom Research, “SEC 2: Recommended Elliptic Curve Domain Parameters, version 1.0.” 2000. https://www.secg.org/SEC2-Ver-1.0.pdf |