Skip to content

Instantly share code, notes, and snippets.

@loosechainsaw
Created August 2, 2014 11:38
Show Gist options
  • Save loosechainsaw/a878046e69462510b4e5 to your computer and use it in GitHub Desktop.
Save loosechainsaw/a878046e69462510b4e5 to your computer and use it in GitHub Desktop.
ROT13
module Encryption =
module private Helpers =
let rec encrypt s =
match s with
| [] -> []
| h :: t -> ( char ((int h) + 13)) :: (encrypt t)
let rot13 (s: string) =
let characters = s.ToCharArray ()
let enc = characters |> List.ofArray |> Helpers.encrypt |> List.toArray
new string(enc)
let text = "Hello"
let result = text |> Encryption.rot13
printfn "%s" result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment