Public Function Encrypt(ByVal strData As String, ByVal strKey As String) As String
Dim k1 As Integer
Dim strCompleteEncrypted As String
Dim s3 As String
Dim intI As Integer
Dim blnFlag As Boolean
Dim intJ As Integer
k1 = 0
strCompleteEncrypted = ""
s3 = ""
intI = strData.Length
blnFlag = False
intJ = intI
For intJ = intI To 1 Step -1
If k1 = strKey.Length Then k1 = 0
Dim intSingleASCValue As Integer
intSingleASCValue = Asc(strKey.Substring(k1, 1))
Dim i1 As Integer
i1 = (intSingleASCValue Mod 13) + 1
If k1 < strKey.Length - 1 Then
Dim k As Integer
k = Asc(strKey.Substring(k1 + 1, 1)) + k1 + 1
If k > 122 Then k = 65 + (122 - k)
Dim intArrayASCValue(0 To strKey.Length - 1) As Integer
Dim intCounter As Integer
For intCounter = 0 To strKey.Length - 1
intArrayASCValue(intCounter) = Asc(strKey.Substring(intCounter, 1))
Next
intArrayASCValue(k1 + 1) = k
Dim intKeyTemp As Integer
intKeyTemp = strKey.Length - 1
strKey = ""
For intCounter = 0 To intKeyTemp
strKey = strKey & Chr(intArrayASCValue(intCounter))
Next
End If
Dim str4 As String
str4 = strData.Substring(intJ - 1, 1)
intSingleASCValue = Asc(str4)
Dim intEncryptedASC2 As Integer
intEncryptedASC2 = intSingleASCValue \ 11
intEncryptedASC2 = 122 - intEncryptedASC2 - i1
Dim intEncryptedASC1 As Integer
intEncryptedASC1 = intSingleASCValue Mod 11
intEncryptedASC1 = 65 + intEncryptedASC1 + i1
Dim strEncrypted1 As String
Dim strEncrypted2 As String
strEncrypted1 = Chr(intEncryptedASC1)
strEncrypted2 = UCase(Chr(intEncryptedASC2))
strCompleteEncrypted = strCompleteEncrypted + strEncrypted1 + strEncrypted2
k1 = k1 + 1
Next
Return strCompleteEncrypted
End Function