def test_generated(self, msg: List[str], sound_a: List[str]): for a in sound_a: for b in range(0, 26): cipher_txt = Affine.encrypt(msg=msg, a=a, b=b) assert msg != cipher_txt lo_plain_txt = Affine.decrypt(msg=cipher_txt, a=a, b=b) assert msg == lo_plain_txt
def affine_decrypt(msg: str, file: str, a: int, b: int): cipher_txt: str = Affine.decrypt(file=file, msg=msg, a=a, b=b) print(cipher_txt)
def test_invalid_b(self, b): with pytest.raises(InvalidArgumentException): Affine.encrypt(msg="foo", a=1, b=b)
def test_invalid_a(self, a): with pytest.raises(InvalidArgumentException): Affine.encrypt(msg="foo", a=a, b=25)
def test_decrypt_char(self, params): assert Affine._decrypt_char(index=params["index"], a=params["a"], b=params["b"]) == params["expected"]