for i inrange(len(ul)): assert ul[i]**2 - wl[i] * vl[i]**2 == 1 e = 7 cl1 = [int(powmod(bytes_to_long(m1), e, x)) for x in ul] cl2 = [int(powmod(bytes_to_long(m2), e, y)) for y in vl] print(wl, cl1, cl2, sep=', ')
#!/usr/bin/env sage # -*- coding: utf-8 -*- from Crypto.Util.number import long_to_bytes, bytes_to_long from Crypto.Hash import SHA from gmpy2 import invert, iroot
defsolve_pell(_wl): cf = continued_fraction(sqrt(_wl)) conv = cf.convergents() for _ in conv: numer, denom = _.numerator(), _.denominator() if numer ^ 2 - _wl * denom ^ 2 == 1: return ZZ(numer), ZZ(denom)
# n = pq n, p_1_q, t = 85198615386075607567070020969981777827671873654631200472078241980737834438897900146248840279191139156416537108399682874370629888207334506237040017838313558911275073904148451540255705818477581182866269413018263079858680221647341680762989080418039972704759003343616652475438155806858735982352930771244880990190318526933267455248913782297991685041187565140859, 106239950213206316301683907545763916336055243955706210944736472425965200103461421781804731678430116333702099777855279469137219165293725500887590280355973107580745212368937514070059991848948031718253804694621821734957604838125210951711527151265000736896607029198, 60132176395922896902518845244051065417143507550519860211077965501783315971109433544482411208238485135554065241864956361676878220342500208011089383751225437417049893725546176799417188875972677293680033005399883113531193705353404892141811493415079755456185858889801456386910892239869732805273879281094613329645326287205736614546311143635580051444446576104548 r1, s1, s2 = 498841194617327650445431051685964174399227739376, 376599166921876118994132185660203151983500670896, 187705159843973102963593151204361139335048329243 r2, s3 = 620827881415493136309071302986914844220776856282, 674735360250004315267988424435741132047607535029
q = 895513916279543445314258868563331268261201605181 p = 95139353880772104939870618145448234251031105153406565833029787299040378395002190438381537974853777890692924407167823818980082672873538133127131356810153012924025270883966172420658777903337576027105954119811495411149092960422055445121097259802686960288258399754185484307350305454788837702363971523085335074839 g = invert(t, n)
defmul(P, k): assert k >= 0 Q = (1, 0) while k > 0: if k % 2: k -= 1 Q = add(P, Q) else: k //= 2 P = add(P, P) return Q
n = 92916331959725072239888159454032910975918656644816711315436128106147081837990823 C = (44449540438169324776115009805536158060439126505148790545560105884100348391877176, 73284708680726118305136396988078557189299357177640330968917927635171441710392723) g = 2 y = 1225348982571480649501200428324593233958863708041772597837722864848672736148168 ** 2 * 2 % n
# e = int(pari(f"znlog({int(y)},Mod({int(g)},{int(n)}))")) e = 96564183954285580248216944343172776827819893296479821021220123492652817873253