Beta
[BF] Caesar Cipher
Description:
Let's implement Caesar cipher in BF.
Background
The Caesar cipher is a popular encryption algorithm that shifts each alphabet in a string (in this kata, to the right) by a predetermined amount.
For example, A
with 5 shifts becomes F
, X
with 4 shifts becomes B
.
Shifting Z
causes it to wrap back to A
.
A -> B -> C -> D -> E -> F (5 shifts)
X -> Y -> Z -> A -> B (4 shifts)
Non-alphabetical characters are unaffected.
Input
The input string is provided in the format \3INPUTSTRING\0
, where:
- First character: the number of shifts as a charcode, from
0
to127
(inclusive). - Second to last character: string to be encrypted, terminated by
\0
(only spaces and uppercase characters are tested here).
Output
Resultant string generated from the Caesar cipher.
Example
"\1A\0" -> "B"
"\1Z\0" -> "A"
"\1ABC\0" -> "BCD"
"\2A Z\0" -> "C B"
Further Reading
Have fun 😀
Ciphers
Cryptography
Strings
Similar Kata:
Stats:
Created | Jun 12, 2022 |
Published | Jun 12, 2022 |
Warriors Trained | 19 |
Total Skips | 1 |
Total Code Submissions | 12 |
Total Times Completed | 6 |
BF Completions | 6 |
Total Stars | 2 |
% of votes with a positive feedback rating | 100% of 4 |
Total "Very Satisfied" Votes | 4 |
Total "Somewhat Satisfied" Votes | 0 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 4 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 6 kyu |