mirror of
https://github.com/KyleBanks/XOREncryption.git
synced 2023-08-10 21:13:15 +03:00
Added VB.NET implementation
This commit is contained in:
parent
40db272a4b
commit
f9ece384ff
@ -13,6 +13,7 @@ Simple implementation of XOR Encryption/Decrypting in various languages, includi
|
|||||||
- [JavaScript \(Node.js Compatible\)](JavaScript/XOREncryption.js)
|
- [JavaScript \(Node.js Compatible\)](JavaScript/XOREncryption.js)
|
||||||
- [Objective-C](Objective-C/main.m)
|
- [Objective-C](Objective-C/main.m)
|
||||||
- [Python](Python/XOREncryption.py)
|
- [Python](Python/XOREncryption.py)
|
||||||
|
- [Visual Basic.NET](VB.NET/XORCrypto.vb)
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
|
25
VB.NET/XORCrypto.vb
Normal file
25
VB.NET/XORCrypto.vb
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
Module XORCrypto
|
||||||
|
|
||||||
|
Sub Main()
|
||||||
|
Dim input As String = Console.ReadLine()
|
||||||
|
Dim output As String = encryptDecrypt(input)
|
||||||
|
Console.WriteLine("Input : " & input)
|
||||||
|
Console.WriteLine("Output : " & output)
|
||||||
|
Dim rett As String = encryptDecrypt(output)
|
||||||
|
Console.WriteLine("RoundAbout : " & rett)
|
||||||
|
Console.ReadLine()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Function encryptDecrypt(input As String) As String
|
||||||
|
Dim key As Char() = {"K"c, "C"c, "Q"c}
|
||||||
|
'Any chars will work, in an array of any size
|
||||||
|
Dim output As Char() = New Char(input.Length - 1) {}
|
||||||
|
For i As Integer = 0 To input.Length - 1
|
||||||
|
output(i) = ChrW(AscW(input(i)) Xor AscW(key(i Mod key.Length)))
|
||||||
|
'CharW(CharCode As Integer) As Char : Returns the character associated with the specified character code
|
||||||
|
'AscW([String] As Char) As Integer : Returns an integer value representing the character code corresponding to a character
|
||||||
|
Next
|
||||||
|
Return New String(output)
|
||||||
|
End Function
|
||||||
|
|
||||||
|
End Module
|
Loading…
Reference in New Issue
Block a user