Retired

Caesar Cipher (retired)

Description:

In cryptography, a Caesar cipher is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a left shift of 3, D would be replaced by A, E would become B, and so on. The method is named after Julius Caesar, who used it in his private correspondence.

Your task is to write a function that takes exactly 2 arguments (string, shiftkey) and encrypts the given string. Any other character than isn't a letter should stay unchanged.

Assumption: shiftkey is integer from [-25, 25] interval.

For example:

  • caesar("Abcd", 2) should return "Cdef"
  • caesar("message", -1) should return "ldrrzfd"
  • caesar("ZZ Top", 3) should return "CC Wrs"
    and so on ...
Algorithms
Encryption
Cryptography
Logic
Security
Ciphers
Strings
Data Types
Functions
Control Flow
Basic Language Features
Fundamentals

Stats:

CreatedJan 13, 2015
Warriors Trained420
Total Skips8
Total Code Submissions304
Total Times Completed85
Python Completions70
Ruby Completions6
JavaScript Completions12
Total Stars7
% of votes with a positive feedback rating89% of 49
Total "Very Satisfied" Votes42
Total "Somewhat Satisfied" Votes3
Total "Not Satisfied" Votes4
Total Rank Assessments49
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • deleted_account Avatar
  • GiacomoSorbi Avatar
Ad