Cody

Problem 1953. Simple Caesar Cypher - shift encrypt a message given an index number

Solution 2877860

Submitted on 25 Aug 2020 by Rafael S.T. Vieira
  • Size: 11
  • This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
message = 'elephant'; shift = 45; correct = 'xexiatgm'; assert(isequal(caesarShift(message,shift),correct))

cyphertext = 120 101 120 105 97 116 103 109

2   Pass
message = 'TiGEr'; shift = -537; answer = 'crpna'; assert(isequal(caesarShift(message,shift),answer))

cyphertext = 99 114 112 110 97

3   Pass
message = 'gozoaobrsf' shift = 12; answer = 'salamander'; assert(isequal(caesarShift(message,shift),answer))

message = 'gozoaobrsf' cyphertext = 115 97 108 97 109 97 110 100 101 114

Suggested Problems

More from this Author1

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!