def add(P, Q, a, p):
if P is None: return Q
if Q is None: return P
(x1, y1), (x2, y2) = P, Q
if x1 == x2 and (y1 + y2) % p == 0:
return None
if P == Q:
m = (3*x1*x1 + a) * pow(2*y1, -1, p)
else:
m = (y2 - y1) * pow(x2 - x1, -1, p)
x3 = (m*m - x1 - x2) % p
y3 = (m*(x1 - x3) - y1) % p
return x3, y3
def mul(k, P, a, p):
R = None
while k:
if k & 1:
R = add(R, P, a, p)
P = add(P, P, a, p)
k >>= 1
return R
G = (3, 6) # y^2 = x^3 + 2x + 3 (mod 97)
print(mul(42, G, 2, 97))
def add(P, Q, a, p):
if P is None: return Q
if Q is None: return P
(x1, y1), (x2, y2) = P, Q
if x1 == x2 and (y1 + y2) % p == 0:
return None
if P == Q:
m = (3*x1*x1 + a) * pow(2*y1, -1, p)
else:
m = (y2 - y1) * pow(x2 - x1, -1, p)
x3 = (m*m - x1 - x2) % p
y3 = (m*(x1 - x3) - y1) % p
return x3, y3
def mul(k, P, a, p):
R = None
while k:
if k & 1:
R = add(R, P, a, p)
P = add(P, P, a, p)
k >>= 1
return R
G = (3, 6) # y^2 = x^3 + 2x + 3 (mod 97)
print(mul(42, G, 2, 97))
def add(P, Q, a, p):
if P is None: return Q
if Q is None: return P
(x1, y1), (x2, y2) = P, Q
if x1 == x2 and (y1 + y2) % p == 0:
return None
if P == Q:
m = (3*x1*x1 + a) * pow(2*y1, -1, p)
else:
m = (y2 - y1) * pow(x2 - x1, -1, p)
x3 = (m*m - x1 - x2) % p
y3 = (m*(x1 - x3) - y1) % p
return x3, y3
def mul(k, P, a, p):
R = None
while k:
if k & 1:
R = add(R, P, a, p)
P = add(P, P, a, p)
k >>= 1
return R
G = (3, 6) # y^2 = x^3 + 2x + 3 (mod 97)
print(mul(42, G, 2, 97))
y² = k·x(x²−1)(x²−4) + c
y² = x(x²−1)(x²−4)
many years of experience dealing with all things art and code. digital, virtual
and interactive art, cryptoart, painting, printmaking, graphics and photography —
alongside graphic design, interface and interaction design and programming.
this site leads to my art portfolio as well as a bunch of mathematics- and crypto-tools.
art portfolio
mathematics & cryptology
cryptoart