StrConv Alternative Function

Iniciado por Swellow, 7 Octubre 2012, 17:03 PM

0 Miembros y 1 Visitante están viendo este tema.

Swellow

Cita de: Danyfirex en  8 Octubre 2012, 18:07 PM
Maybe you're trying before compiling. because If you're running into vb IDE doesn't work. but if you compile work correctly. at least for me work correclty.


Did you try using the StrConv alt I posted with the ROTXDecrypt? I do use Karcrack's memory funcs since a while now and I can tell you that the problem is not because of what you think. Just encrypt a string with ROTXEncrypt then use StrConv Alternative on the decrypt function and see if it gives a result, it won't... Now use StrConv normal and it'll work, that is because the Alt function does not work with unicode chars.

Danyfirex

#11
Put some example that doesn't work to you, I don't got  it :huh:

I'm trying this and work correctly

Código (vb) [Seleccionar]
Dim str As String
Dim str2 As String
'Dim str3() As Byte


str = ROTXEncrypt("Work", "pass")
MsgBox (str)
MsgBox (ROTXDecrypt(str, "pass"))



Danyfirex

for me it doesn't work with alternative "AltStrConv" neither StrConv.

now I have to go out. I'll come back later.

Karcrack

Paste the ROTxEncrypt() function please.

Danyfirex

Cita de: Karcrack en  9 Octubre 2012, 00:32 AM
Paste the ROTxEncrypt() function please.

Es esta:

Código (vb) [Seleccionar]
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



Swellow

Some chars cannot be encrypted using ROTX cause it is a poor encryption but u can see a big difference when u decrypt using original StrConv and AltStrConv... This is because it doesnt support unicode chars, Karcrack I count on you :P

Karcrack

Remove "On error resume next" and learn to debug your own codes. You are getting overflow.

Swellow

Cita de: Karcrack en  9 Octubre 2012, 14:24 PM
Remove "On error resume next" and learn to debug your own codes. You are getting overflow.

Yeah now use StrConv normal you won't get overflow.

Karcrack