Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim T As Byte = 0 'Text byte. Dim Hold As String = "" 'Holding string for final output. Dim CryptKey As String = "DefaultCryptKey1234567890" 'CryptKey. Dim K As Integer = 0 'CryptKey byte. Dim KeyPosition As Integer = 1 'Current position in the Cryptkey. If TextBox2.Text <> "" Then CryptKey = TextBox2.Text 'Use default CryptKey if none entered. For LoopCount = 1 To Len(TextBox1.Text) 'Main loop. If KeyPosition >= Len(CryptKey) Then KeyPosition = 1 'If end of CryptKey is reached, go to start again. K = Asc(Mid(CryptKey, KeyPosition, 1)) 'Get a new cryptkey character. T = Asc(Mid(TextBox1.Text, LoopCount, 1)) 'Get a new text character. Hold += Chr(T Xor K) 'XOR them and add to Hold string. KeyPosition += 1 'Increment the character position in CryptKey. Next 'All characters done? TextBox1.Text = Hold 'Dump Hold string into Textbox. End Sub
Hold
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)