Exemplo n.º 1
0
def test_compare_ignores_random_letters():
    cipher = Fleissner(
        key="XooXooooooXoXoooXoooXXoXoooooooooXoXoooXooooXoooXoXoooXXoooooooo")

    ciphertext = cipher.encrypt("WELCOME TO VILLIERS PARK")
    assert cipher.compare_ciphertext(
        ciphertext,
        "WEHERRXSJQL C  POPVBMEA XTZRJRCKMTXOR Q NMMYVXGJIELAIOLIUB Q J Z")
Exemplo n.º 2
0
def test_from_worksheet():
    cipher = Fleissner(
        key="XooXooooooXoXoooXoooXXoXoooooooooXoXoooXooooXoooXoXoooXXoooooooo")

    ciphertext = cipher.encrypt("WELCOME TO VILLIERS PARK")
    assert cipher.compare(
        "WEXEXRXSXXL CXXXOPXXMEA XXXRXXXKXTXOXXX XXXXVXXXIXLXXXLIXXXXXXXX",
        ciphertext), ciphertext
    plaintext = cipher.decrypt(
        "WEXEXRXSXXL CXXXOPXXMEA XXXRXXXKXTXOXXX XXXXVXXXIXLXXXLIXXXXXXXX")
    assert cipher.compare("WELCOME TO VILLIERS PARK", plaintext), plaintext

    ciphertext = cipher.encrypt("FLEISSNER IS A FUNNY NAME")
    assert cipher.compare_ciphertext(
        "FUHLINDNVXEYIRACS RNSNNEKEXAZZQMKRE BDGIENXPSZMN GAJKX FRTBUDSKC",
        ciphertext), ciphertext
    plaintext = cipher.decrypt(
        "FUHLINDNVXEYIRACS RNSNNEKEXAZZQMKRE BDGIENXPSZMN GAJKX FRTBUDSKC")
    assert cipher.compare_plaintext("FLEISSNER IS A FUNNY NAME",
                                    plaintext), plaintext