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

Join 86,269 VB.NET Programmers. There are 1,882 online right now! Ask your question and get quick answers from Dream.In.Code experts. Join the #1 programming help community on the internet! Registration is fast and FREE... Join Now!

Chat LIVE With a VB.NET Expert
Powered by LivePerson.com

Register to Make This Box Go Away!

A simple encryption program

 
Closed TopicStart new topic

A simple encryption program

lisa0527
post 7 May, 2008 - 05:47 PM
Post #1


New D.I.C Head

*
Joined: 27 Mar, 2008
Posts: 3



I can not get the encrption to work with this code.
It is suppose to take in a word from the user and encrypt it based on the substitution string in the code.

CODE

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 = 1 To plain.Length  'go through user input string

         For index2 = 1 To plain.Length  ' go through the cipher alphabet string the length of the input string
            cipher &= cipherAlphabet.Chars(index2) ' append character to string
         Next
         cipherTextLabel.Text = cipher ' output new string to label
      Next
   End Sub ' SubstitutionCipher
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


jayman9
post 7 May, 2008 - 08:46 PM
Post #2


Student of Life

Group Icon
Joined: 26 Dec, 2005
Posts: 5,548

Please do not create duplicate topics. You only need to post your question once. Just be patient and someone will answer your question as soon as they are online.

Topic closed.
User is online!Profile CardPM
Go to the top of the page
+Quote Post

Closed TopicStart new topic
Time is now: 5/16/08 10:29AM

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month