Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Jul 8th, 2005, 4:03 PM   #1
Intimidat0r
Hobbyist Programmer
 
Intimidat0r's Avatar
 
Join Date: May 2005
Location: Don't know, but the padded walls are a nice touch.
Posts: 126
Rep Power: 0 Intimidat0r is an unknown quantity at this point
Send a message via ICQ to Intimidat0r Send a message via AIM to Intimidat0r Send a message via MSN to Intimidat0r Send a message via Yahoo to Intimidat0r
ROT Decryptor

I have tried to make a program to decrypt simple ROT decryptions which is where if it's like ROT 4 you move each letter 4 spaces down, so A becomes E, W becomes Z and so on. Here is my code:

    Dim ROTIndex As Integer
    Dim Encrypted As String
    Dim Decrypted() As String = ""

    Sub Main()
        Console.WriteLine("Rotation index: ")
        ROTIndex = Console.ReadLine()
        Console.WriteLine("Encrypted text: ")
        Encrypted = Console.ReadLine()
        For Index As Integer = 0 To Encrypted.Length
            Decrypted = Decrypted & Chr(Asc(Encrypted.Substring(Index, 1) + 13))
        Next
        Console.WriteLine("Decrypted Text: " & Decrypted)
    End Sub

It looks all well and good but when I try to run it I get a bug saying "Invalid cast exception -> cast from string "h" to type 'Double' is not valid" and it says it's occurring on the line that says this:

Decrypted = Decrypted & Chr(Asc(Encrypted.Substring(Index, 1) + 13))

Does anybody know why it may be doing this?
__________________
Children in the dark cause accidents, and accidents in the dark cause children.

http://www.ronincoders.org
Intimidat0r is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:21 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC