Created
August 2, 2014 11:38
-
-
Save loosechainsaw/a878046e69462510b4e5 to your computer and use it in GitHub Desktop.
ROT13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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