def ascii_attack_elgamal(b, c, p, message): return int_to_ascii(attack_elgamal(b, c, p, message))
def test_attack_rsa(self): n=4993627030669 e=202829 message=874814388105 decrypted_message = int_to_ascii(attack_rsa(n, e, message)) self.assertEqual(decrypted_message, 'hi')
def test_decryption(self): l = 237 p = 1009 message, header = 421, 661 self.assertEqual(decrypt(message, header, l, p), 559) self.assertEqual(decrypt(5154192, )) if __name__ == '__main__': #unittest.main() #print encrypt(1235, 2, 6329323223, 8209120459) #print generate_keys() #=========================================================================== # p = 3079259 # b = 448 # private_key = 7 # public_key = fast_exponentiation(b, private_key, p) # print decrypt(message=683482, # header=2054398, # l=7, # p=p) # #print decrypt(20, 197, 72, 291) print encrypt(message=104105, b=60096, c=168710, p=191747) print int_to_ascii(decrypt(message=3415555458673405466, header=1580194612606838012, l=1245269559009664185, p=4462768852845629707))
def ascii_decrypt(self, message): return int_to_ascii(self.decrypt(message))