Created
August 27, 2017 01:23
-
-
Save faidamine/16742a5fa4d9a42239ac8302bd69e628 to your computer and use it in GitHub Desktop.
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
#usr/bin/python | |
#Faid Mohammed Amine | |
#Fb : piratuer | |
####### HackCon CTF 2017 - Crypto - RSA 1 | |
import gmpy | |
import binascii | |
p = 152571978722786084351886931023496370376798999987339944199021200531651275691099103449347349897964635706112525455731825020638894818859922778593149300143162720366876072994268633705232631614015865065113917174134807989294330527442191261958994565247945255072784239755770729665527959042883079517088277506164871850439 | |
q = 147521976719041268733467288485176351894757998182920217874425681969830447338980333917821370916051260709883910633752027981630326988193070984505456700948150616796672915601007075205372397177359025857236701866904448906965019938049507857761886750656621746762474747080300831166523844026738913325930146507823506104359 | |
c = 8511718779884002348933302329129034304748857434273552143349006561412761982574325566387289878631104742338583716487885551483795770878333568637517519439482152832740954108568568151340772337201643636336669393323584931481091714361927928549187423697803637825181374486997812604036706926194198296656150267412049091252088273904913718189248082391969963422192111264078757219427099935562601838047817410081362261577538573299114227343694888309834727224639741066786960337752762092049561527128427933146887521537659100047835461395832978920369260824158334744269055059394177455075510916989043073375102773439498560915413630238758363023648 | |
e = 65537 | |
n = p*q | |
phi = (p-1)*(q-1) | |
d= gmpy.invert(e,phi) | |
m = hex(pow(c,d,n))[2:] | |
flag = binascii.unhexlify(m) | |
print flag | |
#d4rk{s1mpl3_rsa_n0t_th1s_34sy_next_time}c0de |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment