예제 #1
0
파일: test.py 프로젝트: hellman/cry
def try_good():
    A = SBox2.new.random_linear_permutation(N)
    B = SBox2.new.random_linear_permutation(N)
    s1 = gen()
    s2 = B * s1 * A
    At, Bt = SBox2.are_linear_equivalent(s1, s2)
    assert Bt * s1 * At == s2
    assert At.is_linear()
    assert Bt.is_linear()
    assert At.is_permutation()
    assert Bt.is_permutation()
예제 #2
0
파일: test.py 프로젝트: hellman/cry
def try_bad():
    s1 = gen()
    s2 = gen()
    res = SBox2.are_linear_equivalent(s1, s2)
    assert res is False