The stereotypical decoder ring is remembered as a cereal box prize from the 1950s. Kids learned about cryptography by starting with the simple transposition cipher. There were many different rings made. One of the more common had two rings on a common center, each with the letters of the alphabet in order. You would rotate the inner ring relative to the outer to produce a shift of letters, so the cipher was to produce a positive or negative shift of the alphabet, giving a letter by letter code key.
Whether or not it really was in cereal boxes, your job is to produce a MATLAB function that codes a string using the letter shift required. You must keep the case of the output the same as the input.
simpleDecoderRing('I am ready to try it - with punctuation and CAPS!',-3)
is
'F xj obxav ql qov fq - tfqe mrkzqrxqflk xka ZXMP!'
Solution Stats
Problem Comments
2 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers122
Suggested Problems
-
Remove the polynomials that have positive real elements of their roots.
1743 Solvers
-
1376 Solvers
-
251 Solvers
-
Matrix indexing with two vectors of indices
782 Solvers
-
Flip the vector from right to left
11365 Solvers
More from this Author2
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Be sure to drink your Ovaltine?
Why do they call it Ovaltine? The jar is round. The mug is round. They should call it Roundtine.