Welcome to Dream.In.Code
Getting Help is Easy!

Join 136,271 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,232 people online right now. Registration is fast and FREE... Join Now!




Vigenere cipher in visual studio 2005

 
Reply to this topicStart new topic

Vigenere cipher in visual studio 2005

Blakereed
26 Aug, 2008 - 07:35 AM
Post #1

New D.I.C Head
*

Joined: 26 Aug, 2008
Posts: 1

question1 : i am trying to use the username the user register as a key however i cant apply the key to the textbox where they fill it in. is there any way to make it to a=0 b=1 and etc...
question 2 : i am using AscII table to add both the password and username to a encrypted password. but it always end up in some text that is not on the keyboard. this mean i cant decrypt it manually. how can i code it such as it only remain on A-Z


CODE
Public Class Form1
    Dim s1 As String
    Dim key As String
    Dim cAsc As String
    Dim newpass As String
    Dim mystring As String
    Dim kAsc As String
    Dim A As Integer
    Dim N As Integer
    Dim i As Integer
    Dim m As Integer
    Const Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"



    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        mystring = ""
        If Password.Text = "" Then
            MsgBox("Enter ID")

        Else
            Dim mykey As Integer
            Dim VSquare(25) As String
            

            N = Len(Username.Text)

            For m = 1 To N
                For mykey = 0 To 25
                    VSquare(mykey) = Alphabet.Substring(mykey, 1)
                    Key = (Username.Text.ToUpper.Substring(m - 1, 1))
                    
                    kAsc = Asc(Key)
                    
                Next
            Next m
            

            A = Len(Password.Text)

            For i = 1 To A
                s1 = Password.Text.ToUpper.Substring(i - 1, 1)
                cAsc = Asc(s1) + kAsc

                newpass = Chr(cAsc)
                mystring = mystring + newpass
                
            Next i



        End If

    End Sub
End Class


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 04:56AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month