I love my encryption but I need a program that is dedicated to making a caeser cipher. It will take an input string and will output a ciphered text with the number to decode it. The number can be made whatever you want

The shortest code wins!

  • \$\begingroup\$ I wanted to borrow some code from rosettacode.org/wiki/Caesar_cipher but these are a bit large \$\endgroup\$ – dwana Jan 22 '15 at 15:06
  • 1
    \$\begingroup\$ I've voted to close as "too broad", due to the lack of specifics. This leaves glaring loopholes (as can be seen by current answers) and renders the challenge trivial/uninteresting. \$\endgroup\$ – Geobits Jan 22 '15 at 15:29
  • 1
    \$\begingroup\$ I went for unclear, but w/e. Any close reason will do. \$\endgroup\$ – John Dvorak Jan 22 '15 at 16:22
  • 2
    \$\begingroup\$ @JanDvorak I think it's pretty clear what he's asking. \$\endgroup\$ – KSFT Jan 22 '15 at 17:24

Golfscript, 1 character


Outputs the input string rotated by 0 characters, plus the digit 0 to show how to decode it.

(sorry, I couldn't resist)

| improve this answer | |
  • \$\begingroup\$ also powershell [0-9], for letters 'a' \$\endgroup\$ – dwana Jan 22 '15 at 15:07

Ruby - 12

This was my first idea.

puts gets+?0

I see Doorknob posted an answer as I'm typing this, similar to my next idea:

CJam - 4


Both of these shift by 0.

This might not count, because I haven't actually released the interpreter yet, but my golfing language KSFTgolf can do it like this:


That's zero bytes. It takes a byte to print the zero

Here are more:

Python 2 - 21

print raw_input()+"0"

Python 3 - 18


Perl 5 - 10

| improve this answer | |
  • \$\begingroup\$ Your Ruby solution would output quotes around the string (inspect it), making it invalid. You have to use puts or $><< instead. (You could also save a character by replacing "0" with ?0.) \$\endgroup\$ – Doorknob Jan 22 '15 at 15:41
  • \$\begingroup\$ @Doorknob Is that invalid? I don't think it says so in the question. \$\endgroup\$ – KSFT Jan 22 '15 at 15:55
  • \$\begingroup\$ @Doorknob Meh, I changed it anyway \$\endgroup\$ – KSFT Jan 22 '15 at 15:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.