shaima88 0 Newbie Poster


hi :(
i am a student
i have problem i can not understand how to transfer encryption code to decryption
>>>>>
i have exam soon
please help me to advance my self in vb.6

that is my code in encyption and i use transposition cipher ..

Public Function encrypt(ByVal pt As String, ByVal key As String) As String


Dim c, r, k, i, j As Integer
Dim et As String
Dim mt(10, 10) As String

For i = 0 To 9
For j = 0 To 9
mt(i, j) = "/"
Next
Next


c = Len(key)


If (Len(pt) Mod c) = 0 Then

r = Len(pt) / c

Else

r = (Len(pt) / c) + 1

End If


k = 1

For i = 1 To r

For j = 1 To c

If k <= Len(pt) Then

mt(i, j) = Mid(pt, k, 1)

Else

mt(i, j) = "/"

End If

k = k + 1

et = et & mt(i, j)
Next
Next
'MsgBox et
et = ""


For k = 0 To 9

For j = 1 To c

If k = Val(Mid(key, j, 1)) Then

r = 1

While mt(r, j) <> "/"


et = et & mt(r, j)
r = r + 1

Wend

End If

Next

Next

encrypt = et


End Function


>>>>>

can you help me to get decryption code from this code
>>>>>
waiting for your help