Question: 1.12.9 A Caesar cipher is an encryption scheme where each letter in the text is shifted up or down the alphabet. The shift amount is
1.12.9 A Caesar cipher is an encryption scheme where each letter in the text is shifted up or down the alphabet. The shift amount is the key. For ex- ample, the word "functional" encrypted with key 3 is "ixqfwlrqdo", since I comes three letters after "f," "x" comes three letters after "u", etc. At the end of the alphabet, we wrap around to the beginning, so "Y" shifted 3 is "b." Write a function encodeString that takes a string and a key and produces the string encrypted with the given' key (so, encodeString("functional", 3): should produce "ixqfulrqdo"). Assume that the string contains only lower case letters and spaces, and do not encode spaces. You will need to write a couple of helper functions first. Your function should also work with negative numbers (any key from - 25 to 25); note that encodeString(encodeString('functional", 3), "3) results in "functional
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
