from pwn import *
ciphertext = bytes.fromhex('783f3977627a693a320f313e421e29513e036e485565360a172b00790c211a7b117b4a7814510b2d4b0b01465448580a0369520824294c670c3758706407013e271b624934147f1e70187c1c72666949405c5b4550495e5e02390607217f11695a61587c6351536b741d301d6d182c48254e7f4927683d19')
known_key = b'12345'
# Extract intermediate values A and B from the ciphertext
A = ciphertext[:len(ciphertext) // 3]
B = ciphertext[len(ciphertext) // 3: 2 * len(ciphertext) // 3]
# Calculate the plaintext using the known key
p = xor(B, known_key)
# Calculate the other key using the plaintext and the intermediate value A
k2 = xor(A, p, known_key)
print("Plaintext: ", p)
print("Other key: ", k2)