コード例 #1
0
def test_known_key():
    cipher = Hill(alphabet, 4, key2)
    criptotext = cipher.cipher("UN MENSAJE CON Ñ")
    assert True
    assert criptotext == "PBYSQPJJRWSBCA"
    assert cipher.decipher(criptotext) == "UNMENSAJECONÑA"
    criptotext = cipher.cipher("UN MENSAJE DE LONGITUD PAR")
    assert criptotext == "PBYSQPJJSUAFSBFLTMBVRR"
コード例 #2
0
def test_random_key():
    cipher = Hill(alphabet, 4)
    c1 = cipher.cipher("UN MENSAJE CON Ñ")
    assert cipher.decipher(c1) == "UNMENSAJECONÑA"
    c2 = cipher.cipher("UN MENSAJE DE LONGITUD PAR")
    assert cipher.decipher(c2) == "UNMENSAJEDELONGITUDPAR"