<jupyter_start><jupyter_text>Salsa<jupyter_code>data = [
    '<KEY>',
    'a59a0eaeb4d1fc325ab797b31425e6bc66d36e5b18efe8060cb32edeaad68180db4979ede43856a24c7d',
    '<KEY>',
    '<KEY>',
    '<KEY>',
    'b09b4afda3caf93c5aa78ce6096bb2a67ad86e4302f3e10602b37acbb1829680935137e8bb2919b6503fccfdca5461',
    'a59a0eaeb5d7af3115b287b31425e6a460d3200f19f5e35406f567dde3cc8d9c9e4179eee92557f1463edc',
    '<KEY>',
    'ad924af7a9cdaf3a1bb0c3e71a27adf37fdf3a474dfef44914b17d8ea2cc86c89d4d72f9e93556a44d71dfb8980034b3cea5c4d4',
    'ab864af9a7d4e4790db797fb5b00afbd6fc5acaff9f3e95443b961dda6829680930874e6a42156bf1f25c6a4891c6d',
    '<KEY>',
    '<KEY>',
    '<KEY>9',
    'b39d1ee6e6cbe6210ea7c3e01e28a9bd6cc5690f1af2f4520bf561c8e3c68b9b824979eaac6c4ba4517d89f1ca',
    'bd9b1ffcb598e62a5aaa8bf65b0ea7a17cde6e4e03f9a64315b07cd7b7ca8b86910863e1a8381ea21f38c7f183006df6c2a5',
    'a59a0e6c462cf83113bd8bb31238e6be67c42bcded09ff4916f262c2e3c087c897085ae8a76019bc4671dabe8455'
]

data = [bytes.fromhex(el) for el in data]

i, j = 2, 4
size = min(len(data[i]), len(data[j]))
a, b = data[i][:size], data[j][:size]
import numpy as np

sub = np.array([a[i] ^ b[i] for i in range(len(a))])
sub
word = np.array([ord(el) for el in 'and lose, and start again at your beginnings'])
print(word)

for i in range(0, len(sub) - len(word) + 1):
    orig = ''.join(chr(el) for el in word ^ sub[i:i+len(word)])
    print(f'pos {i}: {orig}')
cipher = word ^ np.array(list(data[8]))
cipher
result = []

for row in data:
    decoded = cipher[:len(row)] ^ list(row)
    result.append(''.join(chr(el) for el in decoded))

result<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1252302025782689, 'fraction_numerical': 0.26887661141804786, 'mean_word_length': 6.7990430622009566, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '470396', 'license': 'MIT', 'n_tokens_mistral': 1033, 'n_tokens_neox': 849, 'n_words': 95, 'path': '.ipynb_checkpoints/lab_2-checkpoint.ipynb', 'repo_name': 'Vasniktel/crypto-assignments', 'size': '2296'}