Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ashutosh1206
GitHub Repository: ashutosh1206/crypton
Path: blob/master/RSA-encryption/Intro-Challenges/7h3_Godf4ther/encrypt.py
1402 views
1
from Crypto.Util.number import *
2
from secret import flag
3
4
e = 65537
5
n = 551504906448961847141690415172108060028728303241409233555695098354559944134593608349928135804830998592132110248539199471080424828431558863560289446722435352638365009233192053427739540819371609958014315243749107802424381558044339319969305152016580632977089138029197496120537936093909331580951370236220987003013
6
dp = 11830038111134559585647595089660079959437934096133759102294626765549623265660232459679672150751523484215314838435592395437758168739238085557609083462380613
7
8
message = bytes_to_long(flag)
9
ciphertext = pow(message, e, n)
10
ciphertext = long_to_bytes(ciphertext)
11
ciphertext = ciphertext.encode("hex")
12
13
f = open("ciphertext.txt",'w')
14
f.write(ciphertext)
15