Skip to content

Commit b715c56

Browse files
committed
Merge pull request KyleBanks#3 from pawelizycki/master
F# implementation
2 parents 8cdc7c5 + 3e72905 commit b715c56

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

F#/Program.fs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
open System
2+
3+
let encrypt (word : string) =
4+
let key = "KCQ"
5+
[ 0..(word.Length - 1) ]
6+
|> Seq.map (fun idx -> Convert.ToChar(Convert.ToInt32 word.[idx] ^^^ Convert.ToInt32 key.[idx % key.Length]))
7+
|> String.Concat
8+
9+
[<EntryPoint>]
10+
let main argv =
11+
let encrypted = encrypt "IzzyDev"
12+
printfn "Encrypted: %s" encrypted
13+
let decrypted = encrypt encrypted
14+
printfn "Decrypted: %s" decrypted
15+
0

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Simple implementation of XOR Encryption/Decrypting in various languages, includi
1212
- [JavaScript](JavaScript/XOREncryption.js)
1313
- [Objective-C](Objective-C/main.m)
1414
- [Python](Python/XOREncryption.py)
15+
- [F#](F%23/Program.fs)
1516

1617
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.
1718

0 commit comments

Comments
 (0)