Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
984 B
1
Indexable
from pwn import *

ciphertext = bytes.fromhex('783f3977627a693a320f313e421e29513e036e485565360a172b00790c211a7b117b4a7814510b2d4b0b01465448580a0369520824294c670c3758706407013e271b624934147f1e70187c1c72666949405c5b4550495e5e02390607217f11695a61587c6351536b741d301d6d182c48254e7f4927683d19')
known_key1 = b'combination'
known_key2 = b'12345'
prefix = b'shctf{'

# Calculate the intermediate values using the known keys and prefix
A = xor(prefix + b'*' * (len(ciphertext) // 3 - len(prefix)), known_key1, known_key2)
B = xor(prefix + b'*' * (len(ciphertext) // 3 - len(prefix)), known_key1)
C = xor(prefix + b'*' * (len(ciphertext) // 3 - len(prefix)), known_key2)

# Calculate the plaintext by xor-ing the intermediate values and ciphertext
plaintext = xor(A, ciphertext[:len(ciphertext) // 3], B)
plaintext += xor(B, ciphertext[len(ciphertext) // 3: 2 * len(ciphertext) // 3], C)
plaintext += xor(C, ciphertext[2 * len(ciphertext) // 3:], A)

print(plaintext.decode())