AuthorMessage
NightLitch
Clone
Posts: 1

Code:

Function Lock2Key(StrLock As String) As String
    Dim TLock2Key As String, TChar As Integer
    If Len(StrLock) < 3 Then
      Lock2Key = Left$("BROKENCLIENT", Len(StrLock))
      Exit Function
    End If
    TLock2Key = Chr$(Asc(Left$(StrLock, 1)) Xor Asc(Right$(StrLock, 1)) Xor Asc(Mid$(StrLock, Len(StrLock) - 1, 1)) Xor 5)
    For i = 2 To Len(StrLock)
        TLock2Key = TLock2Key & Chr$(Asc(Mid$(StrLock, i, 1)) Xor Asc(Mid$(StrLock, i - 1, 1)))
    Next i
    For i = 1 To Len(TLock2Key)
        TChar = Asc(Mid$(TLock2Key, i, 1))
        TChar = TChar * 16 + TChar \ 16 'Swap bits 11110000 -> 00001111
        TChar = TChar Mod 256
        If TChar = 0 Or TChar = 5 Or TChar = 36 Or TChar = 96 Or TChar = 124 Or TChar = 126 Then
            Lock2Key = Lock2Key & "/%DCN" & Right$("000" & TChar,3) & "%/"
        Else
            Lock2Key = Lock2Key & Chr$(TChar)
        End If
    Next i
End Function

Thx in advanced // NightLitch
vickmaker
Ametuar
Posts: 127

dunno if its ever been done tbh :?
-//v
Corayzon
Regular
Posts: 67

If you still havnt solved your problem i think the best way to get this done would be,
get the c++ lock to key transformer function and then goto a c++ and ask someone to translate it. Cause im sure i remember seeing compliers that compile from c++ to lua.
Hope it helps