ECCHacks

A gentle introduction
to elliptic-curve cryptography

Introduction
The clock:
Real clock
Clock addition
Finiteness:
Finite fields
Finite clocks
Clock crypto
Elliptic curves:
Edwards curves
Edwards addition

The real clock

[Python snippets]

The clock is a curve in the plane. Specifically, the points on the clock are the points (x,y) satisfying the equation x2+y2=1. Here are some examples of points on the clock:

  • (0,1), also known as "12:00".
  • (0,-1), also known as "6:00".
  • (1,0), also known as "3:00".
  • (-1,0), also known as "9:00".
  • (sqrt(1/2),sqrt(1/2)), also known as "1:30".
  • (sqrt(3/4),1/2), also known as "2:00".

The following Python function, oclock, returns a clock point given the time (12, 6, 3, 9, 1.5, etc.):

     import math
     
     def oclock(time):
       radians = time * math.pi / 6
       return math.sin(radians),math.cos(radians)
     
     # example:
     P = oclock(2)
     print P
     # output: (0.8660254037844386, 0.5000000000000001)
     
     # math people write ^ for exponentiation
     # in python, ^ is xor, and ** is exponentiation
     print P[0]**2 + P[1]**2 == 1
     # output: True

This function (like your smartwatch) isn't perfectly accurate: the correct answer for P[1] would have been exactly 0.5, and the correct answer for P[0] would have had infinitely many digits. Try comparing oclock(3) to oclock(15). Python isn't performing exact computations on real numbers; it's performing limited-precision computations on "floating-point numbers". Don't worry that this imprecision will cause problems for cryptography: soon we'll replace real numbers with exact integers.


Version: This is version 2014.12.27 of the realclock.html web page.