How does this code I found work? Cipher : <p>So I found this cool cipher, im making a project for school (its kinda like, show us everything you learned kinda of project) and were allowed to get heavy look at other peoples code online (as long is its not a complete copy and paste). I want to understand how it works and make my own version (without copy and pasting), ive put comments for the parts I understand, and question marks for the parts I dont.</p>

<pre><code>    Function EncryptDecrypt(ByVal text1 As String, ByVal key As String, ByVal isEncrypt As Boolean) As String //yea got this
        Dim char1 As String //Defining char one
        Dim char2 As String //Defining char two
        Dim cKey As Byte //Defining a key as a byte
        Dim strLength As Integer //Defining strLength as an integer
        Dim Result As String = "" //Defining Result as String equal to nothing
        Dim j As Integer = -1 //Defining j as an integer equal to -1
        If text1 &lt;&gt; "" And IsNumeric(key) Then //if text1 is not nothing and the key is numeric then...
            strLength = text1.Length //making strLength equal to the length of the text.
            For i As Integer = 0 To strLength - 1 //Do until strLenth is less than 1 ???
                char1 = text1.Substring(i, 1) //Char one is equal to 
                If j &lt; key.Length - 1 Then //if j (-1) is less than the key's length - 1 then...
                    j = j + 1 //add one to j
                Else //no explanation needed
                    j = 0 //no explanation needed
                End If //no explanation needed
                cKey = Val(key.Substring(j, 1)) //?? cKey is equal to value of the current character it is looking at (j, 1)??
                If isEncrypt Then //if were encypting it
                   If (Asc(char1) + cKey) &gt; 255 Then //????
                        char2 = Chr(Asc(char1) + cKey - 255) //????
                   Else //no explanation needed
                        char2 = Chr(Asc(char1) + cKey) //??
                   End If //no explanation needed
                Else //no explanation needed
                    If (Asc(char1) - cKey) &lt; 1 Then //????
                        char2 = Chr(Asc(char1) - cKey + 255) //?????
                    Else //no explanation needed
                        char2 = Chr(Asc(char1) - cKey) //?????
                    End If //no explanation needed
                End If //no explanation needed
                Result &amp;= char2 //?????
            Next //no explanation needed
        Else //no explanation needed
            MsgBox("Enter text or key!") //no explanation needed
        End If //no explanation needed
        Return Result //no explanation needed
    End Function //no explanation needed


No explanation needed for these either VVVV
    Private Sub btCrypt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btCrypt.Click
        txtResult.Text = EncryptDecrypt(txtText.Text, txtKey.Text, True)

    End Sub

    Private Sub btDecrypt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btDecrypt.Click
        txtResult.Text = EncryptDecrypt(txtText.Text, txtKey.Text, False)
    End Sub
End Class
</code></pre>

<p>I kinda understand that each "letter" has an "Asc" value, but im not entirely sure how that works. Can anyone help, would be really great and helpful for me!</p>
