rm -rf /* (photosinensis) wrote,
rm -rf /*
photosinensis

Something I felt like sharing

So I ran across this blog entry while browsing Reddit today. Now, the bank got taken by this guy. They wanted a Caesar cypher, and he gave them, well, it's an abomination.

In Python:


def caesar(string, key):
  return "".join([x if ord(x.lower()) not in range(97, 123) else chr((((ord(x.lower()) - 97) + key) % 26) + 97) for x in string])


That's in one line, and it preserves spaces and punctuation. We'll not mention his problems with command line user interfaces, which are quite powerful and awesome.
Tags: code
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 2 comments