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