-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc07.py
More file actions
29 lines (20 loc) · 746 Bytes
/
c07.py
File metadata and controls
29 lines (20 loc) · 746 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from pals.ciphers import aes_ecb_decrypt
from base64 import b64decode
def main():
# open file and decrypt
with open('files/c7.txt', 'rb') as f:
ciphertext = b64decode(f.read())
plaintext = aes_ecb_decrypt(ciphertext, b'YELLOW SUBMARINE')
# print result
print(plaintext)
if __name__ == '__main__':
main()
'''
AES in ECB mode
The Base64-encoded content in this file has been encrypted via AES-128 in ECB mode under the key
"YELLOW SUBMARINE".
(case-sensitive, without the quotes; exactly 16 characters; I like "YELLOW SUBMARINE" because it's exactly 16 bytes
long, and now you do too).
Decrypt it. You know the key, after all.
Easiest way: use OpenSSL::Cipher and give it AES-128-ECB as the cipher.
'''