def test_should_add_message_to_key_columns(): message = b'wearediscoveredfleeatonce' key = _distribute_text_to_key_columns(message, [6,3,2,4,1,5]) assert_equal(key[0][1], ['w', 'i', 'r', 'e', 'e']) assert_equal(key[1][1], ['e', 's', 'e', 'a']) assert_equal(key[2][1], ['a', 'c', 'd', 't']) assert_equal(key[3][1], ['r', 'o', 'f', 'o']) assert_equal(key[4][1], ['e', 'v', 'l', 'n']) assert_equal(key[5][1], ['d', 'e', 'e', 'c'])
def test_should_create_cipher_text_from_key_columns(): key_columns = _distribute_text_to_key_columns(b'wearediscoveredfleeatonceqkjeu', [6,3,2,4,1,5]) ciphertext = _read_ciphertext_from(key_columns) assert_equal(ciphertext, b"evlne acdtk eseaq rofoj deecu wiree")