示例#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