problem-specifications icon indicating copy to clipboard operation
problem-specifications copied to clipboard

Simple Cipher problem description is unclear

Open asarkar opened this issue 2 years ago • 1 comments

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.

asarkar avatar Jun 06 '22 08:06 asarkar