Skip to content

Instantly share code, notes, and snippets.

@AndyNovo
Created November 11, 2021 06:26
Show Gist options
  • Save AndyNovo/92acde5f777e54069379b876097478dd to your computer and use it in GitHub Desktop.
Save AndyNovo/92acde5f777e54069379b876097478dd to your computer and use it in GitHub Desktop.
from Crypto.Util.number import *
e=65537
your_e = getPrime(20)
msg=bytes_to_long("ninja{REDACTED}")
p=getPrime(512)
q=getPrime(512)
n=p*q
assert(msg < n)
ct=pow(msg, e, n)
your_d = inverse(your_e, (p-1)*(q-1))
print(your_e)
print(your_d)
print(n)
print(e)
print(ct)
954433
19788674929618593937465879825425937245767592324588092827967786342473772121287742500360335300938759726745141619248679571294753415355784934576560098493206942909962636537208632826421634649366224597724190981034770060267189828321487472716916643228946037888539664507455402748054286438328005619998982020761239650097
148217915976211191250813187781402321040985822825096621611399297026582041066940475235596976325903327099253264622759501434307998983561316537803683555958839062761105388485387049959505281213582801428246598352419012624225440620108402973104234276913990315734299163695400948033317581514121605752609632708349491303001
65537
72817231319581951572718356390490693613775043886733469247093846671905333657469693844692514296160345659354270492009346824174878573096753203230642901120524499899573267313512727639411480481891253589709784889189869802564015134961408917748671874653253091996657708298138738947805047998711357841206926346382816285812
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment