diff options
| author | Nicholas Rodrigues Lordello <[email protected]> | 2024-07-25 22:13:39 +0200 |
|---|---|---|
| committer | Nicholas Rodrigues Lordello <[email protected]> | 2024-07-25 22:13:39 +0200 |
| commit | 33fe06c71019b826e47d3fdcf0f217ee9f32b5b1 (patch) | |
| tree | b8816cfe8731dda302a0ac8d25026cf8dcad2af7 /lib | |
| parent | fd50c91473eda09db01c63421fbb7084ed896494 (diff) | |
Notes on elliptic curves
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/curve.ml | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/curve.ml b/lib/curve.ml new file mode 100644 index 0000000..896cce1 --- /dev/null +++ b/lib/curve.ml @@ -0,0 +1,45 @@ +(** Elliptic Curve. *) + +(** Module signature for an elliptic curve. *) +module type S = sig + type t + (** A type representing an element in an elliptic curve. *) + + val inf : t + (** The point at infinity or additive identity. *) + + val g : t + (** The generator point. *) + + val n : Z.t + (** The order of the curve. *) + + val equal : t -> t -> bool + (** [equal a b] returns [true] if [a] is equal to [b]. *) + + val neg : t -> t + (** [neg a] is the additive inverse of [a]. [add a (neg a) = zero] for all + [a]. *) + + val add : t -> t -> t + (** [add a b] is the sum of [a] plus [b] *) + + val sub : t -> t -> t + (** [sub a b] is the difference of [a] minus [b]. It is equivalent to + [add a (neg b)]. *) + + val scalar_mul : Z.t -> t -> t + (** [scalar_mul k a] is the scalar multiplication of [a] by [k]. *) + + val ( ~- ) : t -> t + (** [neg]. *) + + val ( + ) : t -> t -> t + (** [add]. *) + + val ( - ) : t -> t -> t + (** [sub]. *) + + val ( $* ) : Z.t -> t -> t + (** [scalar_mul]. *) +end |
