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 to 127 (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

More By Author:

Check out these other kata created by Just4FunCoder

Stats:

CreatedJun 12, 2022
PublishedJun 12, 2022
Warriors Trained19
Total Skips1
Total Code Submissions12
Total Times Completed6
BF Completions6
Total Stars2
% of votes with a positive feedback rating100% of 4
Total "Very Satisfied" Votes4
Total "Somewhat Satisfied" Votes0
Total "Not Satisfied" Votes0
Total Rank Assessments4
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
6 kyu
Ad
Contributors
  • Just4FunCoder Avatar
Ad