|A gentle introduction
to elliptic-curve cryptography
Clock addition is a standard way to add points on the clock. Examples:
The following Python function, returns the sum of two clock points P1 and P2:
def clockadd(P1,P2): x1,y1 = P1 x2,y2 = P2 x3 = x1*y2+y1*x2 y3 = y1*y2-x1*x2 return x3,y3 # example: P1 = (0.8,0.6) P2 = (0.28,0.96) print clockadd(P1,P2) # output: (0.936, 0.3519999999999999) print clockadd(P2,P1) # output: (0.936, 0.3519999999999999) # perfect real output would have been (0.936, 0.352) import math def oclock(time): radians = time * math.pi / 6 return math.sin(radians),math.cos(radians) print clockadd(oclock(4),oclock(1)) # output: (0.5000000000000002, -0.8660254037844385) print oclock(5) # output: (0.49999999999999994, -0.8660254037844387) # perfect real output would have matched
As before, these functions aren't perfectly accurate.
Something to try: Can you write a clocksub that subtracts two clock points? For example, subtracting "3:00" from "1:00" should give "10:00".
Version: This is version 2014.12.27 of the clockadd.html web page.