Last active
November 26, 2018 09:09
-
-
Save grocid/56fa8638f1996f6e537082f99ecf0b6e to your computer and use it in GitHub Desktop.
ASIS - From Iran with love
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""" | |
4xy-1 | (x^2-1)^2 => y=x/4 unless we are in an extension field, which we are not. | |
"""" | |
n = 237208661199745562854999011156890039658700624152069768103478192376446011451563080102038926093429456568834763101670299023855209780208357989354187741220887434093445832053260820374057698536366310646709843292762098892763071941659180702872523374338002990634791530684934580442053477022156162366489308571093408738058202661075523678446993387566419473559496808890276411442794625881261218417618592944482709643179343556236764351094165882369216152131528731802397725841715884617995220672391771367636479091539565264093157655322614325467162392620067542379092098044726657951495178546838097135583079589159125360265518837906720645050689016923228195974542415769684256619204962162522459153674087141078545300766312260316437997542698233496702710935961462212483590372175093468084893379945291511926341421929128937050766066839263709894409330515350862643975434672167211784319893914290739561470488373027212771732370024834991877795280594056215574958475491614342501166271571411185563385259797340149621939682189478799803205150021662236189311805238773477991069445860104488040145460845194136267688166755645071490219315368768113585148834441299043087394196126499591177415918625047671564145405328623518725129263531904479881850888316979658651970826009785064373072138757456046177795601701397888842913460004944726064665546030316255775470522077884166312432860443123636130688104115146189573893714479271063793543800122244646380712004281797502684930701417262951942589405462271445896944747142389800355344382153180444383799578543011116908137300002068002052731958132747417052338373021936449 | |
enc = 221148507448816144821104493749348817149595032358290127827230308554099022869540682480727973197267728616331531228328887712922139141963072591382354597290232139434096532822211056133946409120595700668027448541264890523834887577908226077665847662002793595378293858977475906390333801013773433899187288192871446901144113591150554192567918281872709472582273969963332462981358479986392810366764342953277899518557673496078820749893876369267183968300123174369834825409268477841269499570219717206856757543601581693000107877309606762034267901099166212430977265412566785257735907444045707463962980777473283237320098353657838280445990787806071294663649425864156624533354262027372527257251881701590902918161383773288536347993396430641585230232681651515355741033205023456313797369746126567359740516512863549655970796133232943799407231417504680702328144451919739311577639456973737878053951267761749702697954973744065043086979266622808695180950661504024316682895900582275439119661644249077229479083968022466401544262760320478424490778911099180686410212915462299502637743592882962650728313297035522119515866554337877243259592726550952247859317159606595025894232625725594410646435685475659357381983043419829320549145334480389196556486823796385136564743590139125169252120057763978345634935564733552014373561116100284187414721801774584840228516181703072198141045575710991838404594420311225366729697933304538839826228402809184384759818570179205585295531427381919621283311133733112879521205261267850662112905282003979509390893991058738797221280624622467256244867784379953 | |
x, _ = gmpy2.iroot(n / 5125 * 65536, 10) | |
x = int(x) | |
y = x / 4 | |
p = gmpy.next_prime(x**5 + y**5) | |
q = gmpy.next_prime(x**2*y**3 + y**2*x**3) | |
d = gmpy.invert(65537, (p-1)*(q-1)) | |
print hex(pow(enc, d, n))[2:].rstrip("L").decode("hex") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment