Skip to content

Crypto square README not consistent with tests #545

@stevensonmt

Description

@stevensonmt

From the README:

The plaintext should be organized in to a rectangle. The size of the
rectangle (r x c) should be decided by the length of the message,
such that c >= r and c - r <= 1, where c is the number of columns
and r is the number of rows.

but from the crypto_square_test.rb:

def test_normalized_ciphertext
# skip
crypto = Crypto.new('Vampires are people too!')
assert_equal 'vrel aepe mset paoo irpo', crypto.normalize_ciphertext
end

def test_normalized_ciphertext_spills_into_short_segment
# skip
crypto = Crypto.new('Madness, and then illumination.')
expected = 'msemo aanin dnin ndla etlt shui'
assert_equal expected, crypto.normalize_ciphertext
end

In the first instance the total number of characters is 20, which should dictate c = 5 and r = 4 but the test is expecting c =4 and r =5. Similarly in the second instance there are 26 characters to encode. This should dictate c = 6 and r = 5, but the test is calling for c = 5 and r = 6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions