Cody

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

Solution 2111370

Submitted on 30 Jan 2020 by Asif Newaz
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))

m1 = 101 108 101 112 104 97 110 116 pos = 5 12 5 16 8 1 14 20 cyp_pos = 120 101 120 105 97 116 103 109 cyp = 'xexiatgm'

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

m1 = 116 105 103 101 114 pos = 20 9 7 5 18 cyp_pos = 99 114 112 110 97 cyp = 'crpna'

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

message = 'gozoaobrsf' m1 = 103 111 122 111 97 111 98 114 115 102 pos = 7 15 26 15 1 15 2 18 19 6 cyp_pos = 115 97 108 97 109 97 110 100 101 114 cyp = 'salamander'

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!