Skip to content

Instantly share code, notes, and snippets.

@elch10
elch10 / file.py
Last active May 16, 2019 15:46
Modular Equation Solver: (a mod ring_size) * (x mod ring_size) = (b mod ring_size) for specified a and b. This script use Extended Euclidean algorithm
def gcd(a,b):
if a < b:
a, b = b, a
if b == 0:
return a, 1, 0
t_1, t_2 = 0, 1
s_1, s_2 = 1, 0
i = 1
while b > 0:
q = a // b