exercism / problem-specifications

Shared metadata for exercism exercises.
MIT License
327 stars 541 forks source link

Simple Cipher problem description is unclear #2049

Open asarkar opened 2 years ago

asarkar commented 2 years ago

There are quite a few things that are vague.

Step 1:

substitute the fourth letter of the alphabet, namely D, for A

Every letter is shifted forward by 4. But the image shows D going to A, which is a negative 4 shift. ???

Step 2:

Given the key "ddddddddddddddddd", encoding our string "iamapandabear" would return the obscured "ldpdsdqgdehdu"

There is no explanation given, but apparently, the logic is "for each corresponding character in the key, calculate its shift with respect to a, and apply the same shift to the letter". This is not obvious, at all, and shouldn't be omitted.

To make matters more confusing, the example is totally contradictory to what is shown in the Wikipedia link at the bottom of the page. Quoting:

the keyword zebras gives us the following alphabets:

Plaintext alphabet    | ABCDEFGHIJKLMNOPQRSTUVWXYZ
Ciphertext alphabet   | ZEBRASCDFGHIJKLMNOPQTUVWXY

So, each letter in plain is directly mapped to the corresponding letter in the key, no shifting involved. If the key is shorter than the string, the unused letters from the alphabet are used to make the lengths equal.

In the exercise, what do we do when the key length is not equal to the string? If it's smaller, how do we fill the gaps? What if it's larger (why would it be larger if there are 26 letters?)

Step 3:

Let's make your substitution cipher a little more fault tolerant by providing a source of randomness

What does this mean? How do we provide a "source of randomness"? if we are talking about a salt, how should that be applied?

Students should be given the information needed to solve a problem, unambiguously.

coriolinus commented 2 years ago

As this description derives directly from that in the problem specifications, I'm transferring the issue there.