Eine einfache Text-Verschlüsselung kann mit folgender Funktion vorgenommen werden:
Public Function EnCrypt(tSource As String, tPassword As String) As String
Dim iPassword As Integer
Dim iCrypt As Integer
Dim X As Integer
For X = 1 To Len(tPassword)
iPassword = iPassword + Asc(Mid$(tPassword, X, 1))
Next X
For X = 1 To Len(tSource)
iCrypt = Asc(Mid$(tSource, X, 1)) + iPassword + X
Do Until iCrypt <= 255
iCrypt = iCrypt - 255
Loop
EnCrypt = EnCrypt & Chr(iCrypt)
Next X
End Function
Zum Entschlüsseln einfach folgende Funktion benutzen:
Public Function DeCrypt(tSource As String, tKey As String) As String
Dim iPassword As Integer
Dim iCrypt As Integer
Dim X As Integer
For X = 1 To Len(tKey)
iPassword = iPassword + Asc(Mid$(tKey, X, 1))
Next X
For X = 1 To Len(tSource)
iCrypt = Asc(Mid$(tSource, X, 1)) - iPassword - X
Do Until iCrypt > 0
iCrypt = iCrypt + 255
Loop
DeCrypt = DeCrypt & Chr(iCrypt)
Next X
End Function