import pytest from cryptography_s_des_exploring.sdes.encrypt import encrypt, encrypt_block @pytest.mark.parametrize("key, message, expected_ciphertext", [ ('1111001110', '11110011', '00100001'), ('1111001111', '00010011', '11110111'), # 0b1101000 = 104 ('h') ('1111001110', '01101000', '10100011'), # 0b1100101 = 101 ('e') ('1111001110', '01100101', '10000111'), # 0b1101100 = 108 ('l') ('1111001110', '01101100', '11100110'), # 0b1101111 = 111 ('o') ('1111001110', '01101111', '11001110'), ]) def test_encrypt_block(key, message, expected_ciphertext): result = encrypt_block(key, message) assert expected_ciphertext == result @pytest.mark.parametrize("key, message, expected_ciphertext", [ ('1111001110', 'hello', b'wkwaR1xMpoE='), ('1111001110', 'привіт', b'nEp+f+C3CRmcSkp/5s1MCQ=='), ]) def test_encrypt(key, message, expected_ciphertext): result = encrypt(key, message) assert expected_ciphertext == result