diff --git a/F#/Program.fs b/F#/Program.fs new file mode 100644 index 0000000..2cbce62 --- /dev/null +++ b/F#/Program.fs @@ -0,0 +1,15 @@ +open System + +let encrypt (word : string) = + let key = "KCQ" + [ 0..(word.Length - 1) ] + |> Seq.map (fun idx -> Convert.ToChar(Convert.ToInt32 word.[idx] ^^^ Convert.ToInt32 key.[idx % key.Length])) + |> String.Concat + +[] +let main argv = + let encrypted = encrypt "IzzyDev" + printfn "Encrypted: %s" encrypted + let decrypted = encrypt encrypted + printfn "Decrypted: %s" decrypted + 0 \ No newline at end of file diff --git a/README.md b/README.md index 25a2554..4a507e9 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Simple implementation of XOR Encryption/Decrypting in various languages, includi - [JavaScript](JavaScript/XOREncryption.js) - [Objective-C](Objective-C/main.m) - [Python](Python/XOREncryption.py) +- [F#](fsharp/Program.fs) This implementation goes beyond the basic single-key model to use multiple keys in a particular sequence, making it that much more difficult to brute-force.