-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcry7.py
18 lines (14 loc) · 1.74 KB
/
cry7.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from Crypto.PublicKey import RSA
import base64
e = 0x10001
d = 0x11694afd8208b11d092b961ba313bda3c0d22f32562a5d08d3ef2367ccb4ac03d6b7f252b0de794d32c73e3c8456407bb0143310e7adb2d53adcddb476bbbfd9262b5d0c7ca9c46119e8823dcec6ce11716f64ac726d675a9752d9074ad1a8fa90e750301e5519d228ae6d1ce1ae91fc005bb52d2284bbab14d5af09bc940d7946ef3d1d6d4e4a4c3118e0a2a72a6f1aaffae8ee833af4a4a89564fa44f6a3469301d1c64cd516d2c58da039cd94814c73ae9e124cdb3bb15887432349290e2db2380c36d7bab5ce1ededa19f91bbcea4cb7234bcdb1e4f63d6822af0d439a9a0c04fa34f177886c08daa8c882f1ad0125e624f509ca345ef390a317c3e619c5
n = 0xd5f8807a494ad7217c9ad37068f6d9ec4ae21206c6bdaebf88b7e17ecec1988e91823b55a99ebe20b1ca0b58a0d997d1aca674a78cd6bc8479e5677f72887bdad39dbf19e4d51762cf85767be89595119e1a436b29f8e4ff5ff76a2377b2082e5dba03c3d8e813d1a2159ee4ae4428bc1881a5529ad83a66f92ad8d332e0fa446df49bedecf4ea977e73569d95ff5fa1a82b35ff675c331b07582de8db40f64c8bebdede8b9745587ea82184b4f7dcd18351671169b6164fd45354fbe3ba46a726dd65be9f1a697aecb5d9475067dbdf4eaabc78c61a8d8d8a36339551b73bae3ea68882f3b4d14c228a8633cc753c90676c52307f884141a0a0a47afaef260b
ciphertext_b64 = "ms5alhfHqhZe75D1h+JnLLNtrDh04LXB6RIjzZJaK1mXoOYklkpS1wXyAI7QAyp/vp+PGBeyKOeFjjs5+fRNumpt8Iav/a9bdb5RCvWSNzIuDewBb0eFiIdpgchzqdK5+Lejw7rn64wmgN92BNq6jF7MPMzIgTBR+ZS02/YBiCNyqRg+BG37ylfRximoIq/SKwEBikbdTDgQIUfnf+0Ft/Nh9frKEE7q8CYKXpUNXlkJpAeWXA+7YzYMbH0E7HbuqKPxB8JRMBgNFBiT9rPobQohz1sLlCj9DWLrosndHde32fEMTUKpl8p4vKxeygYQdyCXP6r2feKEdYJiNczsbw=="
ciphertext = base64.b64decode(ciphertext_b64)
def decrypt_rsa(ciphertext, d, n):
cipher = int.from_bytes(ciphertext, "little")
plain = pow(cipher, d, n)
plaintext = plain.to_bytes((plain.bit_length() + 7) // 8, "little")
return plaintext
output = decrypt_rsa(ciphertext, d, n)
print(output.decode())