well before reading about Karcrack says , I notice that is necesary to remove array bounds checks and try out of Visual Basic IDE, it means Compiled, And work Correctly.
try it.
Yes I already checked that but It's not the problem, the function works but fails with unicode chars, try using it on this function and then try encrypting a string you will realize that it does not work...
Function ROTXDecrypt(ByVal strData As String, ByVal strKey As String)
On Error Resume Next
Dim bData() As Byte, bKey() As Byte
bData = AltStrConv(strData, vbFromUnicode)
bKey = AltStrConv(strKey, vbFromUnicode)
For i = 0 To UBound(bData)
If i <= UBound(bKey) Then
bData(i) = bData(i) - bKey(i)
Else
bData(i) = bData(i) - bKey(i Mod UBound(bKey))
End If
Next i
ROTXDecrypt = AltStrConv(bData, vbUnicode)
End Function
Function ROTXEncrypt(ByVal strData As String, ByVal strKey As String)
On Error Resume Next
Dim bData() As Byte
Dim bKey() As Byte
bData = StrConv(strData, vbFromUnicode)
bKey = StrConv(strKey, vbFromUnicode)
For i = 0 To UBound(bData)
If i <= UBound(bKey) Then
bData(i) = bData(i) + bKey(i)
Else
bData(i) = bData(i) + bKey(i Mod UBound(bKey))
End If
Next i
ROTXEncrypt = StrConv(bData, vbUnicode)
End Function