-6
\$\begingroup\$

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!

\$\endgroup\$
4
  • \$\begingroup\$ I wanted to borrow some code from rosettacode.org/wiki/Caesar_cipher but these are a bit large \$\endgroup\$
    – dwana
    Jan 22, 2015 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, 2015 at 15:29
  • 1
    \$\begingroup\$ I went for unclear, but w/e. Any close reason will do. \$\endgroup\$ Jan 22, 2015 at 16:22
  • 2
    \$\begingroup\$ @JanDvorak I think it's pretty clear what he's asking. \$\endgroup\$
    – KSFT
    Jan 22, 2015 at 17:24

2 Answers 2

6
\$\begingroup\$

Golfscript, 1 character

0

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

(sorry, I couldn't resist)

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

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

q0pp

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:

0

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

print(input()+"0")

Perl 5 - 10

print<>.0;
\$\endgroup\$
3
  • \$\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, 2015 at 15:41
  • \$\begingroup\$ @Doorknob Is that invalid? I don't think it says so in the question. \$\endgroup\$
    – KSFT
    Jan 22, 2015 at 15:55
  • \$\begingroup\$ @Doorknob Meh, I changed it anyway \$\endgroup\$
    – KSFT
    Jan 22, 2015 at 15:58

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