示例#1
0
def test_bifid():
    raises(ValueError, lambda: encipher_bifid("abc", "b", "abcde"))
    assert encipher_bifid("abc", "b", "abcd") == "bdb"
    raises(ValueError, lambda: decipher_bifid("bdb", "b", "abcde"))
    assert encipher_bifid("bdb", "b", "abcd") == "abc"
    raises(ValueError, lambda: bifid_square("abcde"))
    assert bifid5_square("B") == bifid5_square("BACDEFGHIKLMNOPQRSTUVWXYZ")
    assert bifid6_square("B0") == bifid6_square("B0ACDEFGHIJKLMNOPQRSTUVWXYZ123456789")
示例#2
0
def test_bifid():
    raises(ValueError, lambda: encipher_bifid('abc', 'b', 'abcde'))
    assert encipher_bifid('abc', 'b', 'abcd') == 'bdb'
    raises(ValueError, lambda: decipher_bifid('bdb', 'b', 'abcde'))
    assert encipher_bifid('bdb', 'b', 'abcd') == 'abc'
    raises(ValueError, lambda: bifid_square('abcde'))
    assert bifid5_square("B") == \
        bifid5_square('BACDEFGHIKLMNOPQRSTUVWXYZ')
    assert bifid6_square('B0') == \
        bifid6_square('B0ACDEFGHIJKLMNOPQRSTUVWXYZ123456789')
示例#3
0
def test_bifid():
    raises(ValueError, lambda: encipher_bifid('abc', 'b', 'abcde'))
    assert encipher_bifid('abc', 'b', 'abcd') == 'bdb'
    raises(ValueError, lambda: decipher_bifid('bdb', 'b', 'abcde'))
    assert encipher_bifid('bdb', 'b', 'abcd') == 'abc'
    raises(ValueError, lambda: bifid_square('abcde'))
    assert bifid5_square("B") == \
        bifid5_square('BACDEFGHIKLMNOPQRSTUVWXYZ')
    assert bifid6_square('B0') == \
        bifid6_square('B0ACDEFGHIJKLMNOPQRSTUVWXYZ123456789')
示例#4
0
def test_bifid5_square():
    A = alphabet_of_cipher()
    A.remove("J")
    f = lambda i, j: symbols(A[5*i + j])
    M = Matrix(5, 5, f)
    assert bifid5_square("") == M
示例#5
0
def test_bifid5_square():
    A = bifid5
    f = lambda i, j: symbols(A[5*i + j])
    M = Matrix(5, 5, f)
    assert bifid5_square("") == M
示例#6
0
def test_bifid5_square():
    A = bifid5
    f = lambda i, j: symbols(A[5 * i + j])
    M = Matrix(5, 5, f)
    assert bifid5_square("") == M
示例#7
0
def test_bifid5_square():
    A = alphabet_of_cipher()
    A.remove("J")
    f = lambda i, j: symbols(A[5 * i + j])
    M = Matrix(5, 5, f)
    assert bifid5_square("") == M