Lecture d'un fichier texte et cryptage
Bonjour à tous, je dois dans le cadre d'un projet, réaliser un algorithme de cryptage, le dit algorithme fonctionne lorsque j'utilise des textbox, je vais maintenant passer a l'utilisation d'un fichier texte en entrée qui contiendra une phrase, et en sortie un nouveau fichier texte qui sera la phrase cryptée du fichier en entrée.
Je voudrais avoir votre avis sur ce code, avant de tester son fonctionnement
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
Dim normal as As New IO.StreamReader("H:\Travail\fichier1.txt")
Dim crypte As New IO.StreamWriter("H:\Travail\fichier2.txt")
Dim n as integer
Dim p as integer
Dim i as integer
Dim j as integer
i = 0
j = 0
Dim toto as string
While normal.peek > 0
toto = normal.readline
For i = 0 to n-1
x = asc (toto(i) - 97
y = asc clef(j) - 97
j = j +1
if j > p -- ( p étant la longeur du fichier texte)
j = 0
fin si
toto = toto & tab(x,y)
crypte.writeline(toto)
Next
endWhile
normal.close()
crypt.close() |
donc si vous pouviez me dire ce qui va pas, ce serait gentil :lol: