I'm very new to VB.NET language so there are some things I'm still learning and I need some help here. So I'd appreciate any guidance.
I'm making an XOR encryption app where there's a key, input and output. The flow is like this: Key XOR Input and the result will appear as the output. I managed to successfully come out with workable codes for that part though.
However, right now, I need to make a continuation from that part. I need the output to come out within the ASCII range of 33 - 126 (DEC) only.
I have not done anything much in terms of coding as I can't seem to find the right guide. Additionally, I don't really know where to start except that some mathematical logic (MOD) is involved here.
So any pointers? Thank you.
I am using Visual Studio (2017) and here's my code:
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim key As String
Dim input As String
Dim output As String
Dim keyCounter As Integer = 0
Dim length As Integer
key = TextBox1.Text
input = TextBox2.Text
length = key.Length
For Each letter As Char In input
output = output & Chr(Asc(letter) Xor Asc(key.Chars(keyCounter)))
If keyCounter = length - 1 Then
keyCounter = 0
Else
keyCounter += 1
End If
Next
TextBox3.Text = output
End Sub
End Class