mirror of
https://github.com/KyleBanks/XOREncryption.git
synced 2023-08-10 21:13:15 +03:00
F# impl
This commit is contained in:
parent
8cdc7c574d
commit
5bd51c69ae
15
F#/Program.fs
Normal file
15
F#/Program.fs
Normal file
@ -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
|
||||||
|
|
||||||
|
[<EntryPoint>]
|
||||||
|
let main argv =
|
||||||
|
let encrypted = encrypt "IzzyDev"
|
||||||
|
printfn "Encrypted: %s" encrypted
|
||||||
|
let decrypted = encrypt encrypted
|
||||||
|
printfn "Decrypted: %s" decrypted
|
||||||
|
0
|
@ -12,6 +12,7 @@ Simple implementation of XOR Encryption/Decrypting in various languages, includi
|
|||||||
- [JavaScript](JavaScript/XOREncryption.js)
|
- [JavaScript](JavaScript/XOREncryption.js)
|
||||||
- [Objective-C](Objective-C/main.m)
|
- [Objective-C](Objective-C/main.m)
|
||||||
- [Python](Python/XOREncryption.py)
|
- [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.
|
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.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user