Beispiel #1
0
def test_mix_columns_raises_exception_if_state_is_not_a_correct_array():
    with pytest.raises(ValueError):
        aes.mix_columns(
            state=np.random.randint(0, 255, (12, 12), dtype='uint8'))
    with pytest.raises(ValueError):
        aes.mix_columns(
            state=np.random.randint(0, 255, (12, 16), dtype='uint16'))
Beispiel #2
0
def test_mix_columns_returns_correct_array(aes_datas):
    state = aes_datas['input_state']
    expected = aes_datas['expected_mix_columns']
    assert np.array_equal(
        expected,
        aes.mix_columns(state=state)
    )
    assert expected.shape == state.shape
Beispiel #3
0
def test_mix_columns_raises_exception_if_state_is_not_array():
    with pytest.raises(TypeError):
        aes.mix_columns(state='foo')
    with pytest.raises(TypeError):
        aes.mix_columns(state=12)