hi
rippler cooler code ich hab das auch schommal geprogt
war bei mir viel länger
hab aber nur ganz einfache befehle verwendet
bourner wenn s dir weiter hilft hier der code:
Public Class Form1
Dim ver As String = "" & _
"ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜabcdefghijklmnopqrstuvwxyzäöü1234567890ß!§" & _
"%,.;:()=?/*-+[]{}<>\_'`´³²^°µ|" & """"
Dim länge As Integer = 1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles Button1.Click
Dim t(0) As Integer
Dim s(0) As Integer
Dim x(0) As Integer
Dim schlüssel As String = ""
Dim txt As String = ""
Dim xx As String = ""
If TextBox1.Text = Nothing Then
MsgBox("Schlüssel fehlt!", MsgBoxStyle.Exclamation, "Fehler")
Else
If ver Like Mid(TextBox1.Text, Len(TextBox1.Text), 1) Then
MsgBox("Ungültige Zeichen!", MsgBoxStyle.Exclamation, "Fehler")
Else
txtzuschlüssel()
End If
End If
End Sub
Function schlüsselzuZahl(ByVal s)
Dim schlüssel As String = TextBox1.Text
Dim a As Integer = 1
Dim b As Integer = 0
Do Until b = Len(schlüssel)
b = b + 1
While Mid(schlüssel, b, 1) <> Mid(ver, a, 1)
a = a + 1
End While
s(b) = a - 1
a = 1
Loop
Return s
End Function
Function txttzuzahl(ByVal t)
Dim txt As String = TextBox2.Text
Dim a As Integer = 1
Dim b As Integer = 0
Do Until b = Len(txt)
b = b + 1
While Mid(txt, b, 1) <> Mid(ver, a, 1)
a = a + 1
End While
t(b) = a - 1
a = 1
Loop
Return t
End Function
Sub txtzuschlüssel()
Dim s(Len(TextBox1.Text)) As Integer
schlüsselzuZahl(s)
Dim t(Len(TextBox2.Text)) As Integer
txttzuzahl(t)
Dim txt As String = TextBox2.Text
Dim x(Len(txt)) As Integer
Dim schlüssel As String = TextBox1.Text
Dim a As Integer = 1
Dim c As Integer = 1
While a <> Len(txt) + 1
If c = Len(schlüssel) + 1 Then
c = 1
End If
x(a) = s(c) + t(a)
If x(a) > 104 Then
x(a) = x(a) - 104
End If
a = a + 1
c = c + 1
End While
a = 1
Dim xx As String = "ü"
Dim b As Integer
While a <> CInt(Len(txt) + 1)
b = x(a)
xx = xx + Mid(ver, b, 1)
a = a + 1
End While
TextBox3.Text = Mid(xx, 2, Len(xx) - 1)
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles TextBox1.TextChanged
prüf()
Button1_Click(Nothing, Nothing)
End Sub
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles TextBox2.TextChanged
prüf()
Button1_Click(Nothing, Nothing)
End Sub
Sub prüf()
If Not ver Like Mid(TextBox1.Text, länge, 1) Then
MsgBox("EE")
End If
End Sub
End Class es gibt 3 textboxen
1: schlüssel
2: text
3:ausgabe
ich hoff mal des is hilfriech für dich
is aber nicht genau die vigenere verschlüsslung sondern was andres:
der schlüssel wird auch so oft wiederholt wie der text lang ist dann gibt es ein muster zb das alphabet
jedes zeichen darin hat einen wert zb A im alphabet 1; B2 ...
der geheimtext wird dann um den wert des schlüssels verschoben |