Codeur Décodeur

    Publicités

Users Who Are Viewing This Thread (Total: 0, Members: 0, Guests: 0)

marvindusi

Membre
Oct 2, 2010
24
0
907
28
Voilà je commence le VB.net et voilà mon premier programme entièrement de moi =)

Le logiciel consiste à coder une phrase très facilement et de décoder une phrase codée par celui-ci

Ce lien n'est pas visible, veuillez vous connecter pour l'afficher. Je m'inscris!

Public Class Codeur

Private Sub TXT_DEPART_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TXT_DEPART.TextChanged

End Sub

Private Sub BT_TRANSFO_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT_TRANSFO.Click
Dim Phrase As String = Me.TXT_DEPART.Text
Phrase = Phrase.Replace("a", "1")
Phrase = Phrase.Replace("c", "2")
Phrase = Phrase.Replace("e", "3")
Phrase = Phrase.Replace("g", "4")
Phrase = Phrase.Replace("i", "5")
Phrase = Phrase.Replace("k", "6")
Phrase = Phrase.Replace("n", "7")
Phrase = Phrase.Replace("o", "8")
Phrase = Phrase.Replace("q", "9")
Phrase = Phrase.Replace("s", "§")
Phrase = Phrase.Replace("u", "é")
Phrase = Phrase.Replace("w", "ç")
Phrase = Phrase.Replace("z", "0")
Phrase = Phrase.Replace("m", "$")
Phrase = Phrase.Replace("b", "µ")
Me.TXT_FIN.Text = Phrase

End Sub


Private Sub TXT_BOX_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TXT_FIN.TextChanged
End Sub

Private Sub BT_DECODER_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT_DECODER.Click
Dim Phrase2 As String = Me.TXT_FIN.Text
Phrase2 = Phrase2.Replace("1", "a")
Phrase2 = Phrase2.Replace("2", "c")
Phrase2 = Phrase2.Replace("3", "e")
Phrase2 = Phrase2.Replace("4", "g")
Phrase2 = Phrase2.Replace("5", "i")
Phrase2 = Phrase2.Replace("6", "k")
Phrase2 = Phrase2.Replace("7", "n")
Phrase2 = Phrase2.Replace("8", "o")
Phrase2 = Phrase2.Replace("9", "r")
Phrase2 = Phrase2.Replace("§", "s")
Phrase2 = Phrase2.Replace("é", "u")
Phrase2 = Phrase2.Replace("ç", "w")
Phrase2 = Phrase2.Replace("0", "z")
Phrase2 = Phrase2.Replace("$", "m")
Phrase2 = Phrase2.Replace("µ", "b")
Me.TXT_DEPART.Text = Phrase2
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.TXT_DEPART.Clear()
Me.TXT_FIN.Clear()
End Sub

Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click

End Sub
End Class

Merci de laisser une critique ou autre =)
 

Evaelis

La Voix de la Sagesse
V
Ancien staff
Apr 28, 2010
22,949
468
1,699
Valhalla
Il n'y a pas tout les caractères un conseille passe en Ascii puis remets en str
 

Evaelis

La Voix de la Sagesse
V
Ancien staff
Apr 28, 2010
22,949
468
1,699
Valhalla
Je poste mon code source

---------- Message ajouté à 14h44 ---------- Le message précédent était à 14h29 ----------

Cryptage
Private Sub cripter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cripter.Click
Dim Lettre As String
Dim Lettreasc As String
Dim Final As String

TextCible.Text = ""
For i = 1 To Len(TextSource.Text)
Lettre = Mid(TextSource.Text, i, 1)
Lettreasc = Asc(Lettre)
Lettreasc = Lettreasc + 23 'Nombre à ajouter dans la table ascii
Final = Chr(Lettreasc)
TextCible.Text = TextCible.Text + Final

Next
End Sub
Décryptage :
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim Lettre As String
Dim Lettreasc As String
Dim Final As String
TextCible.Text = ""
For i = 1 To Len(TextSource.Text)
Lettre = Mid(TextSource.Text, i, 1)
Lettreasc = Asc(Lettre)
Lettreasc = Lettreasc - 23 'Ici tu peut mettre ce que tu veut
Final = Chr(Lettreasc)
TextCible.Text = TextCible.Text + Final

Next
End Sub