from libnum import * from Crypto.Util.number import *
def samen(a1, a2, b1, b2, c): def egcd(m, n): if n == 0: return m, 0 else: x, y = egcd(n, m % n) return y, x - (m // n) * y
k = egcd(b1, b2) k1 = k[0] k2 = k[1]
if k1 < 0: k1 = - k1 a1 = invmod(a1, c) elif k2 < 0: k2 = - k2 a2 = invmod(a2, c) e = long_to_bytes((pow(a1, k1, c) * pow(a2, k2, c)) % c)
print(e)
samen( 54995751387258798791895413216172284653407054079765769704170763023830130981480272943338445245689293729308200574217959018462512790523622252479258419498858307898118907076773470253533344877959508766285730509067829684427375759345623701605997067135659404296663877453758701010726561824951602615501078818914410959610, 91290935267458356541959327381220067466104890455391103989639822855753797805354139741959957951983943146108552762756444475545250343766798220348240377590112854890482375744876016191773471853704014735936608436210153669829454288199838827646402742554134017280213707222338496271289894681312606239512924842845268366950, 17, 65537, 111381961169589927896512557754289420474877632607334685306667977794938824018345795836303161492076539375959731633270626091498843936401996648820451019811592594528673182109109991384472979198906744569181673282663323892346854520052840694924830064546269187849702880332522636682366270177489467478933966884097824069977)
|