|
-
Oct 4th, 2000, 06:09 AM
#1
Thread Starter
New Member
Can anyone help me?
a) I must write a program that encrypts a meesage using rot13
b) Then i must decrypt the skrambled message using 13 as the key.
My code looks like this now:
Option Explicit
Dim mAlfabet As String
Private Sub cmdDeKrypter_Click()
Dim Melding As String
Dim Tegn As String
Dim teller As Single
Dim foran As String
Dim bak As String
Dim antallTegn As Integer
Dim temp As Integer
Dim res As String
Melding = txtMelding.Text
For teller = 1 To Len(Melding)
bak = Right(Melding, Len(Melding) + teller)
Melding = foran & Tegn & bak
txtOutputKrypter.Text = txtOutputKrypter.Text
txtOutputKrypter.Text = ""
Next teller
MsgBox Melding
End Sub
Private Sub cmdKrypter_Click()
Dim Melding As String
Dim Tegn As String
Dim teller As Single
Dim foran As String
Dim bak As String
Dim antallTegn As Integer
Dim temp As Integer
Dim res As String
Melding = txtMelding.Text
For teller = 1 To Len(Melding)
Tegn = Mid$(Melding, teller, 1)
temp = InStr(1, mAlfabet, Tegn, vbBinaryCompare)
Tegn = Mid$(mAlfabet, temp + 13, 1)
foran = Left(Melding, teller - 1)
bak = Right(Melding, Len(Melding) - teller)
Melding = foran & Tegn & bak
txtOutputKrypter.Text = txtOutputKrypter.Text
txtOutputKrypter.Text = ""
Next teller
MsgBox Melding
End Sub
Private Sub Form_Load()
mAlfabet = "abcdefghijklmnopqrstuvwxyzabcdefghijklmn"
End Sub
Private Sub mnuAvslutt_Click()
End
End Sub
Thank you!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|