Paste the ROTxEncrypt() function please.
Es esta:
Private Sub Form_Load()
Dim str As String
Dim str2 As String
str = ROTXEncrypt("-978ç___#{~#{~#'é(-è", "pass")
MsgBox (str)
MsgBox (ROTXDecrypt(str, "pass"))
End Sub
Public Function AltStrConv(Temp As Variant, Conversion As VbStrConv) As Variant
Dim i As Long, lLen As Long, bvHack(0) As Byte, lHackDelta As Long
Dim bArr() As Byte, sString As String
lHackDelta = VarPtr(bvHack(0))
If Conversion = vbFromUnicode Then
sString = Temp
lLen = Len(sString)
ReDim bArr(0 To lLen - 1)
For i = 0 To lLen - 1
bvHack(VarPtr(bArr(0)) - lHackDelta + i) = bvHack(StrPtr(sString) - lHackDelta + (i * 2))
Next i
AltStrConv = bArr
ElseIf Conversion = vbUnicode Then
bArr = Temp
lLen = UBound(Temp) + 1
sString = Space$(lLen)
For i = 0 To lLen - 1
bvHack(StrPtr(sString) - lHackDelta + (i * 2)) = bvHack(VarPtr(bArr(0)) - lHackDelta + i)
Next i
AltStrConv = sString
End If
End Function
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