Bonsoir a tous les membres
je suis nouveau dans le domaine de la programmation en VB6 et j'aimerai demander de l'aide dans ce forum.
je veux créer un petit prog d'encryptage et de décryptage sous vb6 en utilisant le mélange de caractères d'ascii.
j'ai suivi un petit tuto ici (http://www.sourcecodester.com/tutori...using-vb6.html) avec comme code vb suivant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
27
28
    Private Sub Command1_Click()
        Text2.Text = Encrypt(Text1.Text, Len(Text1.Text))
    End Sub
 
    Public Function Encrypt(Name As String, Key As Long) As String
    Dim v As Long, c1 As String, z As String
        For v = 1 To Len(Name)
            c1 = Asc(Mid(Name, v, 1))
            c1 = Chr(c1 + Key)
            z = z & c1
        Next v
        Encrypt = z
    End Function
 
    Private Sub Command2_Click()
        Text2.Text = Decrypt(Text2.Text, Len(Text1.Text))
        Text1.Text = ""
    End Sub
 
    Public Function Decrypt(Name As String, Key As Long) As String
    Dim v As Long, c1 As String, z As String
        For v = 1 To Len(Name)
            c1 = Asc(Mid(Name, v, 1))
            c1 = Chr(c1 - Key)
            z = z & c1
        Next v
        Decrypt = z
    End Function
Donc ma question est de savoir comment je pourrai faire pour coder un simple programme qui fait la meme chose mais avec un encodage different qui donnerait :

abcdef = (=C+f<d@B0x

123456 = Nqo(&FZV|ixr

123456789 = Qj>:i5&F:LaGYXuyxr

abcdefghij = Luvwi5zn>:Kw?6wtg:,,

0123456789 = A/uy&Fi5&F:LaGYXuyxr

1234567890 = ZV=?d@D)|i3kBo(l/e>

et voici le code de l'encodage et du decodage :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function encrypt(ecode)
Dim texts
dim i
for i=1 to len(ecode)
texts=texts & chr(asc(mid(ecode,i,1))+i)
next
encrypt = texts
end function 
 
function decrypt(dcode) 
dim texts
dim i
for i=1 to len(dcode)
texts=texts & chr(asc(mid(dcode,i,1))-i)
next
decrypt=texts
end function
 
function mistake(preString)
Dim texts
Dim seed
Dim i,length
prestring = trim(preString)
length = len(preString)
seed = length
Randomize(length)
texts = ""
for i = 1 to length
seed = int(94*rnd(-asc(mid(preString,i,1))-seed*asc(right(prestring,1)))+32)
texts = texts & chr(seed) & chr(int(94*rnd(-seed)+32))
next
dim dist
dist=""
for i = 1 to len(texts)
if mid(texts,i,1)<>"'" then
dist=dist+mid(texts,i,1)
end if
next 
mistake = dist
end function
Comment dois je faire pour que quand je tape '123456' sur un text box et que je clique sur le bouton encrypt et cela me donne 'Nqo(&FZV|ixr' ? et vise versa?
Merci et bonne journée.