I am always receiving the same 'bb' output and not sure why.
Can you please take a look at the code.
Thanks
Public Class EncryptionForm ' using the substitution cipher Private Sub SubstitutionCipher() ' normal alphabet String Dim normalAlphabet As String = _ "abcdefghijklmnopqrstuvwxyz .!?," ' substitution alphabet String Dim cipherAlphabet As String = _ "cdefg.hijk!lmn opqr?stuv,wxyzab" Dim index1 As Integer ' index variable for For...Next loop Dim index2 As Integer ' inner index variable Dim plain As String = plainTextBox.Text ' String entered by the user Dim cipher As String ' encrypted String cipherTextLabel.Text = "" ' clear output TextBox plain = plain.ToLower() ' make characters lowercase For index1 = 0 To 30 ' go through string for normal alphabet plain = normalAlphabet.Chars(index1) For index2 = 0 To 30 ' go through string for cipher alphabet cipher = cipherAlphabet.Chars(index2) ' new string = new character cipher &= cipherAlphabet(index2) ' append character to string Next cipherTextLabel.Text = cipher ' output new string to label Next End Sub ' SubstitutionCipher ' using the transposition cipher Private Sub TranspositionCipher() Dim counter As Integer = 0 'loop counter variable Dim input As String = plainTextBox.Text ' input word by user Dim output As String ' changed word Do While counter <= 30 counter = +2 Loop End Sub ' TranspositionCipher Private Sub encryptButton_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles encryptButton.Click If substitutionRadioButton.Checked = True Then 'if substitution radio button checked SubstitutionCipher() ' goto function Else TranspositionCipher() ' if transposition radio button checked goto function End If End Sub End Class ' EncryptionForm

New Topic/Question
Reply




MultiQuote


|