Hackthebox, Hacking, Hackthebox Writeup, Htb, Crypto.
(self.p-1)*(self.q-1)) def encrypt(self, data: bytes) -> bytes: pt = int(data.hex(), 16) ct = pow(pt, self.e, self.n) return long_to_bytes(ct) def decrypt(self, data: bytes) -> bytes: ct = int(data.hex(), 16) pt = pow(ct, self.d, self.n) return long_to_bytes(pt) def main(): crypto = RSA() print