<commit_before>from matasano.util.converters import base64_to_bytes
from Crypto.Cipher import AES
import base64

if __name__ == "__main__":

    chal_file = open("matasano/data/c7.txt", 'r');

    key = "YELLOW SUBMARINE"

    # Instantiate the cipher
    cipher = AES.new(key, AES.MODE_ECB)

    # Covert from base64 to bytes and encode
    ct = base64_to_bytes(chal_file.read()).encode('latin-1')

    # Perform the decryption
    pt = cipher.decrypt(ct)
    print(pt.decode())

<commit_msg>Switch to using base64 builtin decoder for simplicity.<commit_after>from matasano.util.converters import base64_to_bytes
from Crypto.Cipher import AES
import base64

if __name__ == "__main__":

    chal_file = open("matasano/data/c7.txt", 'r');

    key = "YELLOW SUBMARINE"

    # Instantiate the cipher
    cipher = AES.new(key, AES.MODE_ECB)

    # Covert from base64 to bytes and encode
    ct = base64.b64decode(chal_file.read())

    # Perform the decryption
    pt = cipher.decrypt(ct)
    print(pt.decode())


{'fraction_non_alphanumeric': 0.10693069306930693, 'fraction_numerical': 0.02277227722772277, 'mean_word_length': 3.6376146788990824, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6313919', 'n_tokens_mistral': 390, 'n_tokens_neox': 347, 'n_words': 87}