Skip to content

Instantly share code, notes, and snippets.

View joshy's full-sized avatar

Joshy Cyriac joshy

  • Universitätsspital Basel
  • Basel
View GitHub Profile
@joshy
joshy / caesar.clj
Created September 4, 2013 07:46
Simple caesar encode/decode of strings in clojure.
(ns caesar.core)
(def secret "RVAWNUEVFGJVRQREIBEORVHAQRFUNGXHPURAORQVRAGRHPU")
(def text "EINJAHRISTWIEDERVORBEIUNDESHATKUCHENBEDIENTEUCH")
(defn encode
"Encodes the text with shifting each char shift positions"
[text shift]
(apply str (map char (map #(+ (mod (+ shift %) 26) 65) (map int text)))))